iag-geo / bootleaf

An open-source version of IAG's Bootleaf fork
https://demo.bootleaf.xyz
MIT License
89 stars 65 forks source link

Problem with identify geoserver wms and query #13

Closed FJRicca closed 5 years ago

FJRicca commented 5 years ago

Hello, first I would like to congratulate for this project. I am preparing a map in which I load several wms services generated with geoserver and that now I would be able to ask for information and make queries about them. However, in both cases I am having problems and I do not know how to solve them. imagen imagen

On the other hand, how can the repetition of the labeling be solved. I have been testing with the meta tile option but without success.

Thanks in advance

slead commented 5 years ago

Sometimes WMS sites need a reverse-proxy in order to avoid cross-origin issues. This isn't my area of expertise, but I put some information at https://github.com/iag-geo/bootleaf/blob/master/reverseProxy.md with things to try which worked for me.

If that doesn't help, can you please attach a copy of your config.js file?

FJRicca commented 5 years ago

Hi Stephen, Idon´t know if it is the problem because I try in Internet Explorer and work fine. Don´t work in chrome, firefox and opera. [image: image.png] Also, I am working in local. Attach the config file.

Thanks

El dom., 13 ene. 2019 a las 11:43, Stephen Lead (notifications@github.com) escribió:

Sometimes WMS sites need a reverse-proxy in order to avoid cross-origin issues. This isn't my area of expertise, but I put some information at https://github.com/iag-geo/bootleaf/blob/master/reverseProxy.md with things to try which worked for me.

If that doesn't help, can you please attach a copy of your config.js file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/iag-geo/bootleaf/issues/13#issuecomment-453819085, or mute the thread https://github.com/notifications/unsubscribe-auth/Asb2-BtamIhceowBZzDBbnUIDYeWgXrUks5vCw3XgaJpZM4Z7KC8 .

-- FJRicca

var config = { "title": "Piloto Plaza de las Tendillas", "start": { // "maxZoom": 16, "center": [37.884,-4.779], "zoom": 11, "attributionControl": true, "zoomControl": false }, "about": { "title": "Visor Prueba", "contents": "

Pruebas

" }, "controls": { "zoom": { "position": "topleft" }, "boxzoom":{ "position": "topleft" }, "leafletGeocoder": { //https://github.com/perliedman/leaflet-control-geocoder "collapsed": true, "position": "topleft", "placeholder": "Search for a location", "type": "OpenStreetMap", // OpenStreetMap, Google, ArcGIS //"suffix": "Australia", // optional keyword to append to every search //"key": "AIzaS....sbW_E", // when using the Google geocoder, include your Google Maps API key (https://developers.google.com/maps/documentation/geocoding/start#get-a-key) }, "TOC": { //http://leafletjs.com/reference-1.0.2.html#control-layers-option "collapsed": false, "uncategorisedLabel": "Capas", "position": "topright", "toggleAll": true }, "history": { "position": "bottomleft" }, "bookmarks": { "position": "bottomright", "places": [ { "latlng": [ 37.888,-4.782 ], "zoom": 10, "name": "Córdoba", "id": "a148fa354ba3", "editable": true, "removable": true } ] } }, // "activeTool": "identify", // options are identify/coordinates/queryWidget //"basemaps": [ 'Aerial','esriGray', 'esriDarkGray', 'esriStreets', 'OpenStreetMap'], //Si dejamos el basemaps vacío no se carga el menú de mapas base. No es necesario modificar el html "basemaps": [], "bing_key": "AkYQkvUhwVLr-SiGNlM7s5nM3--ClYRJeAJP2Z5OWOQkttXhQBXWR8CVhyEFIBbI", "mapboxKey": "enter your MapBox key", // "defaultIcon": { // "imagePath": "http://leafletjs.com/examples/custom-icons/", // "iconUrl": "leaf-green.png", // "shadowUrl": "leaf-shadow.png", // "iconSize": [38, 95], // "shadowSize": [50, 64], // "iconAnchor": [22, 94], // "shadowAnchor": [4, 62], // "popupAnchor": [-3, -76] // }, "tocCategories": [ { "name": "Capas temáticas", "layers": ["locales", "arbolado", "us_density"] }, { "name": "Servicios WMS/WFS", "layers" : ["Viales","CDAU","PNOA","trees", "counties", "railways", "us_states"] }, { "name": "Capas Generales", "layers" : ["TTMM","Secciones","Nucleos"] }, { "name": "Mapas Base", "layers": [ "countries"], "exclusive": false } ], "projections": [ {4269: '+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs '} ], "highlightStyle": { "weight": 2, "opacity": 1, "color": 'white', "dashArray": '3', "fillOpacity": 0.5, "fillColor": '#E31A1C', "stroke": true }, "layers": [ { "id": "locales", "name": "Locales", "type": "geoJSON", "cluster": true, "showCoverageOnHover": false, "minZoom": 12, "url": "./data/v_om_demolicion.geojson", "icon": { "iconUrl": "./img/comercios.png", "iconSize": [24,28] }, "style": { "stroke": true, "fillColor": "#00FFFF", "fillOpacity": 0.5, "radius": 10, "weight": 0.5, "opacity": 1, "color": '#727272', }, "visible": false, // "label": { // "name": "NAME", // "minZoom": 14 // } }, { "id": "arbolado", "name": "Arbolado", "type": "geoJSON", "cluster": true, "showCoverageOnHover": false, "minZoom": 12, "url": "./data/v_licencias_1ocupacion.geojson", "style": { "stroke": true, "fillColor": "#00FFFF", "fillOpacity": 0.5, "radius": 10, "weight": 0.5, "opacity": 1, "color": '#727272' }, "icon": { "iconUrl": "./img/museum.png", "iconSize": [24,28] }, "visible": true, "identify": { "layerName": "Arbolado", "primaryField": "titulo", "outFields": [ {"name": "titulo", "alias": "titulo"} ], "maxAllowableOffset": 1 }, // "label": { // "name": "NAME", // "minZoom": 14 // } }, { "id": "PNOA", "name": "Ortofoto PNOA (WMS)", "type": "wmsTiledLayer", "url": "http://www.ign.es/wms-inspire/pnoa-ma", "layers": "OI.OrthoimageCoverage", "visible": true, "format": 'image/png', "transparent": false, "maxZoom": 20, "attribution": "© Instituto Geográfico Nacional" }, { "id": "TTMM", "name": "Terminos Municipales", "type": "wmsTiledLayer", "url": "http://localhost:1080/geoserver/Cordoba/wms?", "layers": "TTMM", "visible": true, "format": 'image/png', "transparent": true, "maxZoom": 12, "identify": { "layerName": "TTMM", "layerLabel": "TERMINOS", "primaryField": "NOMBRE", "outFields": [ {"name": "COD_INE", "alias": "CODINE"}, {"name": "NOMBRE", "alias": "NOMBRE"} ], }, "maxAllowableOffset": 0.01, "queryWidget": { "queries" : [ {"name": "NOMBRE", "alias": "NOMBRE"} ], "outFields": [ {"name": "NOMBRE", "alias": "NOMBRE"} ] }, }, { "id": "Secciones", "name": "Secciones Censales", "type": "wmsTiledLayer", "url": "http://localhost:1080/geoserver/Cordoba/wms?", "layers": "Secciones", "visible": true, "minZoom": 12, "format": 'image/png', "transparent": true, // "layerDefs": {3:"POP2000 > 1000000"}, "useCors": true, "visible": true, "identify": { "layerName": "Secciones", "primaryField": "secc", "outFields": [ {"name": "secc", "alias": "NOMBRE"} ] }, "maxAllowableOffset": 0.01, "queryWidget": { "queries" : [ {"name": "secc", "alias": "NOMBRE"} ], "outFields": [ {"name": "secc", "alias": "NOMBRE"} ] }, "maxZoom": 20 }, { "id": "Nucleos", "name": "Nucleos urbanos", "type": "wmsTiledLayer", "url": "http://localhost:1080/geoserver/Cordoba/wms?", "layers": "Nucleos", "visible": false, "minZoom": 12, "format": 'image/png', "transparent": true, // "layerDefs": {3:"POP2000 > 1000000"}, "useCors": true, "visible": true, "identify": { "layerName": "Nucleos", "primaryField": "NOMBRE", "outFields": [ {"name": "NOMBRE", "alias": "NOMBRE"} ] }, "queryWidget": { "queries" : [ {"name": "NOMBRE", "alias": "NOMBRE"} ], "outFields": [ {"name": "NOMBRE", "alias": "NOMBRE"} ] }, "maxZoom": 20 }, { "id": "Viales", "name": "Superficies Vial", "type": "wmsTiledLayer", "url": "http://localhost:1080/geoserver/Cordoba/wms?", "layers": "Viales", "visible": true, "format": 'image/png', "transparent": true, // "layerDefs": {3:"POP2000 > 1000000"}, "useCors": true, "visible": true, "identify": { "layerName": "viales", "primaryField": "NOMBRE", "outFields": [ {"name": "NOMBRE", "alias": "NOMBRE"} ] }, "queryWidget": { "queries" : [ {"name": "NOMBRE", "alias": "NOMBRE"} ], "outFields": [ {"name": "NOMBRE", "alias": "NOMBRE"} ] }, "maxZoom": 20 }, { "id": "CDAU", "name": "Callejero CDAU (WMS)", "type": "wmsTiledLayer", "url": "http://www.callejerodeandalucia.es/servicios/cdau/wms?", "layers": "CDAU_wms", "visible": true, "format": 'image/png', "tiled": true, "transparent": true, "maxZoom": 20, "attribution": "© Instituto de Estadística y Cartografía de Andalucía" } ] }

FJRicca commented 5 years ago

Hi again Stephen. I have managed, using nginx, to operate the identification tool on wms, in any of the available navigator. What I can not make it work is the query tools. The layer and fields are showing in the tool but when I run the query get this error:

image

I leave the definition of the layer in the configuration file.

    {
        "id": "TTMM",
        "name": "Terminos Municipales",
        "type": "wmsTiledLayer",
        "url": "http://pruebasvisor.tcasa.es/geoserver/Cordoba/wms?",
        "layers": "TTMM",
        "visible": true,
        "format": 'image/png',
        "transparent": true,
        "maxZoom": 12,
        "useCors": true,
        "identify": {
        "layerName": "TTMM",
        "buffer": 10,
        "outFields": [
                {"name": "NOMBRE", "alias": "NOMBRE"},
                {"name": "LINK", "alias": "ENLACE"}
            ]
        },
        "maxAllowableOffset": 0.01,
        "queryWidget": {
            "queries" : [
                {"name": "NOMBRE", "alias": "NOMBRE", "defaultOperator": "contains"}
            ],
            "outFields": [
                {"name": "NOMBRE", "alias": "NOMBRE"}
            ]
        }
    }

King regards

SchroeC commented 5 years ago

I've run into a similar issue for geoserver when using hosted layers that have an EPSG other than 4326. After some investigation, I was able to fix this while using the 'Within current map extent' filter by doing the following:

In app.js->runQueryWidget()->near // Search within the map extent or a polygon change:

queryData.CQL_FILTER += "and BBOX(" + geomField + "," + bounds._southWest.lng + "," + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + ")"

to

queryData.CQL_FILTER += "and BBOX(" + geomField + "," + bounds._southWest.lng + "," + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + " ,'EPSG:4326')"

The 'Within polygon' filter is less straight forward. It would appear, from my research that it cannot be done with a CQL_FILTER through geoserver. An OGC filter may work in this case.

References:

https://gis.stackexchange.com/questions/102994/wfs-request-with-cql-filter-projection http://osgeo-org.1560.x6.nabble.com/How-to-tell-SRID-in-CQL-FILTER-td5289150.html

FJRicca commented 5 years ago

Hello SchroeC, thanks for your help. I had tried what you told me and I discovered that the problem was that I had not defined the "geomField". Now the query tool work but when I click in any result don´t zoom in.

On the other hand, there is some way that one of the fields shows up as a URL link.

[image: image.png]

Thanks

El jue., 17 ene. 2019 a las 19:31, SchroeC (notifications@github.com) escribió:

I've run into a similar issue for geoserver when using hosted layers that have an EPSG other than 4326. After some investigation, I was able to fix this while using the 'Within current map extent' filter by doing the following:

In app.js->runQueryWidget()->near // Search within the map extent or a polygon change:

queryData.CQL_FILTER += "and BBOX(" + geomField + "," + bounds._southWest.lng + "," + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + ")"

to

queryData.CQL_FILTER += "and BBOX(" + geomField + "," + bounds._southWest.lng + "," + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + " ,'EPSG:4326')"

The 'Within polygon' filter is less straight forward. It would appear, from my research that it cannot be done with a CQL_FILTER through geoserver. An OGC filter may work in this case.

References:

https://gis.stackexchange.com/questions/102994/wfs-request-with-cql-filter-projection

http://osgeo-org.1560.x6.nabble.com/How-to-tell-SRID-in-CQL-FILTER-td5289150.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/iag-geo/bootleaf/issues/13#issuecomment-455278852, or mute the thread https://github.com/notifications/unsubscribe-auth/Asb2-GeLzFtiNDvkcgKbzhRZ8BN_pewjks5vEMGDgaJpZM4Z7KC8 .

-- FJRicca

FJRicca commented 5 years ago

Hi, i modify app.js to show field value of layer as link and it works fine.

imagen

Now, I have another problem, in this case when I try to see de map in a mobile. I can´t see all the tools, for example, the identify or query tools. imagen

slead commented 5 years ago

@FJRicca I'm glad you solved the identify and query problems.

With regards to some windows not appearing on mobile, this is by design - the idea being that there isn't enough room for those functions, so they're not available.

You can see this in the index.html file if you search for hidden-sm and hidden-xs. These are Bootstrap options for hiding elements on small or extra-small devices.

You could try removing those classes if you want the elements to be visible on mobile, but you'll probably have to refactor them to make them fit nicely.

FJRicca commented 5 years ago

Hi Stephen, thank you very much for your help. I really appreciate it.

Greetings

El mar., 29 ene. 2019 a las 2:17, Stephen Lead (notifications@github.com) escribió:

@FJRicca https://github.com/FJRicca I'm glad you solved the identify and query problems.

With regards to some windows not appearing on mobile, this is by design - the idea being that there isn't enough room for those functions, so they're not available.

You can see this in the index.html https://github.com/iag-geo/bootleaf/blob/master/index.html file if you search for hidden-sm and hidden-xs. These are Bootstrap options for hiding elements on small or extra-small devices.

You could try removing those classes if you want the elements to be visible on mobile, but you'll probably have to refactor them to make them fit nicely.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iag-geo/bootleaf/issues/13#issuecomment-458368256, or mute the thread https://github.com/notifications/unsubscribe-auth/Asb2-OLNusKqJ0J9h3Gmk0hB_R-JOR2eks5vH6ETgaJpZM4Z7KC8 .

-- FJRicca

bitSurvey commented 5 years ago

Hi, i modify app.js to show field value of layer as link and it works fine.

imagen

Now, I have another problem, in this case when I try to see de map in a mobile. I can´t see all the tools, for example, the identify or query tools. imagen

Can you share how to show field value of layer as link??

quanvugirc commented 4 years ago

Hi, i modify app.js to show field value of layer as link and it works fine.

imagen

Now, I have another problem, in this case when I try to see de map in a mobile. I can´t see all the tools, for example, the identify or query tools. imagen

Can you show me how to show field value of layer as link, I have 1 field is image and I want to show it in info window?

maheshkumar1407 commented 4 years ago

I have a similar problem.. I tried to use query widget for geojson layers. Getting the options in query tool, but after clicking "run query", it shows the error "Unable to find URL to query this layer". Can anyone suggest a solution for this issue?

fatih0057 commented 3 years ago

I have a similar problem.. I tried to use query widget for geojson layers. Getting the options in query tool, but after clicking "run query", it shows the error "Unable to find URL to query this layer". Can anyone suggest a solution for this issue?

hello can you solve this problem. If you have any, would you share it with me. Thanks in advance forever.