-- Insertar la fuente de mapas, observer el dominio de origen, debe coincidir con el de Arches
-- en caso de un despliegue de desarrollo, en lugar del dominio, se debera especificar la IP de arches.

INSERT INTO map_sources (name, source) VALUES ('ponderacion-pg-tilesrv', '{"type": "vector", "tiles": ["https://pmoxos.patrimonio.org.bo/pgtileserv/public.ponderacion/{z}/{x}/{y}.pbf"], "tileSize": 512}') ON CONFLICT DO NOTHING;
-- Insertar capas para pgtileserv y búsqueda simple
INSERT INTO map_layers (maplayerid,name,layerdefinitions,isoverlay,icon,activated,addtomap,centerx,centery,zoom,legend,searchonly,sortorder,ispublic) VALUES
('41af761-693d-49ff-9153-149e8b7fab36',
'Ponderacion',
'[
   {
      "id": "ponderacion-fill-pg-tilesrv",
      "type": "fill",
      "paint": {
         "fill-color": [
            "match",
            [
               "get",
               "valor_resultante"
            ],
            "Valor A",
            "#fc4e2a",
            "Valor B",
            "#fd8d3c",
            "Valor C",
            "#ffeda0",
            "rgba(130, 130, 130, 0.3)"
         ]
      },
      "source": "ponderacion-pg-tilesrv",
      "maxzoom": 20,
      "minzoom": 3,
      "source-layer": "public.ponderacion"
   },
   {
      "id": "ponderacion-line-pg-tilesrv",
      "type": "line",
      "paint": {
         "line-color": "rgba(200, 200, 200, 0.7)",
         "line-width": 2
      },
      "source": "ponderacion-pg-tilesrv",
      "source-layer": "public.ponderacion"
   }
]'
,true,'',true,false,NULL,NULL,NULL,'',false,0,true),
('5f595b69-436d-11ef-b76d-3f0c29296763', 
'Marcadores de búsqueda',
'[
   {
      "id": "search-results-points-markers",
      "type": "symbol",
      "paint": {
      },
      "filter": [
         "all",
         [
            "==",
            "$type",
            "Point"
         ],
         [
            "!=",
            "highlight",
            true
         ]
      ],
      "layout": {
         "icon-size": 1,
         "icon-image": "marker-15",
         "icon-offset": [
            0,
            -6
         ],
         "icon-allow-overlap": true
      },
      "source": "search-results-points"
   },
   {
      "id": "search-results-points-markers-highlighted",
      "type": "symbol",
      "paint": {
      },
      "filter": [
         "all",
         [
            "==",
            "$type",
            "Point"
         ],
         [
            "==",
            "highlight",
            true
         ]
      ],
      "layout": {
         "icon-size": 1.3,
         "icon-image": "marker-15",
         "icon-offset": [
            0,
            -6
         ],
         "icon-allow-overlap": true
      },
      "source": "search-results-points"
   },
   {
      "id": "search-results-points-markers-point-highlighted",
      "type": "circle",
      "paint": {
         "circle-color": "rgba(250,250,25,0)",
         "circle-radius": 20,
         "circle-translate": [
            0,
            -15
         ]
      },
      "filter": [
         "all",
         [
            "==",
            "$type",
            "Point"
         ],
         [
            "==",
            "highlight",
            true
         ]
      ],
      "layout": {
         "visibility": "visible"
      },
      "source": "search-results-points"
   },
   {
      "id": "search-results-points-markers-point",
      "type": "circle",
      "paint": {
         "circle-color": [
            "match",
            [
               "get",
               "displaydescription"
            ],
            "Valor A",
            "rgba(255, 0, 0, 0.5)",
            "Valor B",
            "rgba(0, 255, 0, 0.5)",
            "Valor C",
            "rgba(0, 0, 255, 0.5)",
            "rgba(250,250,25,0.1)"
         ],
         "circle-radius": 11,
         "circle-translate": [
            0,
            -6
         ]
      },
      "filter": [
         "all",
         [
            "==",
            "$type",
            "Point"
         ]
      ],
      "layout": {
         "visibility": "visible"
      },
      "source": "search-results-points"
   }
]'
,true,'ion-location',true,false,NULL,NULL,NULL,'',true,0,true);
