19

Update The 'hack' given below is necessary only for Geoserver versions 2.2.x and below. With version 2.3.0 and upwards, Geoserver can return JSON for WMS GetFeatureInfo request natively. End of Update There is an open feature request for this on geoserver's bug tracker. Using custom GetFeatureInfo Templates, it is possible to generate a Json response ...


8

You cannot get information for features within a bbox using a WMS getFeatureInfo. Please have a look at the WMS reference for getFeatureInfo. You will see that according to the standards, you can only pass in points, not a bbox. Instead, you could use a getFeature Operation on the WFS service. The BBOX parameter allows you to search for features that ...


7

As stated above, you add an extra ;-separated CQL query for each layer. 1st query aligns to the 1st layer, 2nd to 2nd, etc. So, even if you want the same query on each layer, it'd be something like: https://server.com/geoserver/site/wms?service=WMS&version=1.1.0&request=GetMap &styles=&bbox=-180.0,-90.0,180.0,90.0&width=660&height=...


7

Simple Right click your feature in your "Identify Results" right pane and select "Copy GetFeatureInfo requests URL": Advanced You can also go with PyQGIS. For example, with a single layer loaded from a WMS, in the Python console: layer = iface.activeLayer() provider = layer.dataProvider() provider.dataSourceUri() This will normally show the URI of the ...


6

Because that is the way CORS works! loading images is always (mostly) a safe operation so the browser doesn't care where you get them from. Loading a script (javascript or xml) is potentially dangerous and so to protect you from nice-safe-site.com loading code from very-dangerous-hacker-site.com while you aren't watching CORS prevents this. So WMS (and ...


5

You can do this using the GeoServer propertyName WMS request parameter: http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#propertyname


5

It is simple but you must fool a bit. Feed in your lat/lon or lon/lat depending on your WMS version. Use the point as lower-left corner of BBOX and add some little number for getting the upper-right corner. Ask always for WIDTH=2 and HEIGHT=2 and pixel coordinates 1 and 1. All you need to edit ever is the BBOX. Here comes the request as exploded. I added ...


5

You can only use a x,y (i,j) coordinate search for GetFeatureInfo requests http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getfeatureinfo However, you may test for interactions with polygons (and many other geometries) using a Web Feature Service (WFS) request. E.g. https://wiki.state.ma.us/confluence/display/massgis/GeoServer+-+WFS+-+...


5

I used to following tutorial to figure out how to get popups on WMS and WFS layers. Maybe it will be useful to you. Here is some of the relevant code map.on('click', function(evt) { // Hide existing popup and reset it's offset popup.hide(); popup.setOffset([0, 0]); // Attempt to find a marker from the planningAppsLayer var feature = map....


5

This is how I do it for a GeoServer WMS endpoint: var parameters = { service: 'WMS', version: '1.1.1', request: 'GetFeatureInfo', layers: currentLayer, query_layers: currentLayer, feature_count: 10, info_format: 'text/javascript', format_options: 'callback:handleJson', SrsName: 'EPSG:4326', width: 101, height: 101, x: 50, y: 50, ...


5

What I know is that WMS is a tiled image of the layer What you know isn't quite correct, a WMS provides images on request based on some data source. The data source can be either a raster data set, a vector data set, or indeed a combination of raster and vector data sets. A WMS doesn't provide multiple tiles, a WMS provides a single image. There is a ...


4

This is an interesting question, and I wanted to investigate the issue. Firstly, with some brief experimentation, I saw that Geoserver does not return any data from the non-rendered region when you use the GetFeatureInfo request on the WMS service. To see if this is expected behavior, I checked the documentation for the GetFeatureInfo request. You can ...


4

Solved this by using calculated X & Y instead of using generated from leaflet provided function layerPointToContainerPoint Giving Wrong X & Y var X =map.layerPointToContainerPoint(e.layerPoint).x.toFixed(0); var Y = map.layerPointToContainerPoint(e.layerPoint).y.toFixed(0); Correct X & Y from calculation var bds = map.getBounds(); ...


4

You need to specify WMS params in getGetFeatureInfoUrl() function. In your case, try to ask for more features by adding the param FEATURE_COUNT after INFO_FORMAT. For instance: var url = layers[3].getSource().getGetFeatureInfoUrl( evt.coordinate, viewResolution, 'EPSG:3857', { 'INFO_FORMAT': 'text/html', 'FEATURE_COUNT': '20' //or ...


4

The X and Y coordinates in the GetFeatureInfo query mean the pixel coordinates of the image that is created with the GetMap parameters which are included in the request. You can't change the BBOX parameters independently from the X and Y parameters and suppose that the result would be the same. In your first case the request contains these parameters for ...


4

The problem is that your map is in EPSG:3857 and your getFeatureInfo request is in EPSG:4326. This will work in the sense that no error is thrown because the WMS is stateless and has no idea that the two requests are related but the location of your click is "off" because getFeatureInfo works by "drawing" the map as requested and looking for the feature ...


4

Create a variable that consists of geoserver layer names for layers that are currently drawn on the map, then pass the variable into the URL string. To do this its really beneficial to organize your layers in a data structure like: var layerObj = {}; layerObj["geoserverLayerName"] = layer; Loop through your layers and check if its on the map. If it is, ...


4

Yes, you have to generate one request per layer with FEATURE_COUNT=1 in each.


4

The formatting of a GetFeatureInfo response is controlled by a FreeMarker template rather than GeoServer directly. The FreeMarker documentation suggests that number formats are determined by the locale of the machine it is running on. So it looks like you should get , instead of . if that is what your machine is set up for. If necessary you can override ...


4

Width and Height in a GetFeatureInfo request relate to the width and height of the Map (product of a GetMap request) to which you are supplying your I/J pixel coordinate. This has nothing to do with the size of the response.


4

Doesn't seem that OpenLayers provide any event to handle the clicks while drawing, but it can be done. The map 'click' event recives all the clicks made on the map, so the problem is to distinguish those clicks done while drawing a feature. This can be achieved with the 'drawstart' and 'drawend' events from the 'Draw' interaction object. You can set a ...


4

Is it possible to do a GetFeatureInfo request using WMTS? It depends on what is supported by your service implementation, but in theory it is possible, by which I mean the OpenGISĀ® Web Map Tile Service Implementation Standard (OGC 07-057r7) defines such an operation: 7.3.2 GetFeatureInfo operation (optional in procedure oriented architectural style) ...


4

It is now possible to get the GetFeatureInfo feature out-of-the-box with the leaflet.extras2 package by calling the leaflet.extras2::addWMS() function. See here below an example from the package developer: #remotes::install_github('trafficonese/leaflet.extras2') library(shiny) library(leaflet) library(leaflet.extras2) library(XML) leaflet() %>% ...


4

A nice way to see all remote requests such as GetFeatureInfo is to use the "QGIS Network Logger" plugin: https://plugins.qgis.org/plugins/qgisnetworklogger/ which is available since QGIS 3.6 You can then leave the logger window open and add your WMS layer, query it etc, and see the exact urls generated. You can also right-click on the url and have it open ...


3

Put queryable="true" in your Mapnik XML for that layer. It is by design that layers are not queryable by default.


3

I was trying to do something similar with the WMSGetFeatureInfo control and @JayCrossler's answer above pointed me in the correct direction. I found that for each layer that you want to include in the query you need to check if there is an existing CQL_FILTER and apply this filter to the vendorParams parameter. Note the usage of INCLUDE to represent an empty ...


3

If I have understood your question, you have created the HEADER and the FOOTER files, but not the TEMPLATE one. The latter file is mandatory, and in your scenario it 'generates' the contents of HTML's body. Besides, inside the LAYER object of your mapfile there should also be a reference to the template file, given via TEMPLATE. For point based queries, it ...


3

You can use GetFeatureInfo without proxy, when both your OpenLayers application and GeoServer live in same domain and same port. If they are in different location, you need proxy. Simple as that.


3

It sounds like your workflow would function better with a seamless grid of polygons instead of points. That way there would be no empty space when a user clicked on the map. Maybe try creating a vector grid and joining you point attributes to it?


3

You can't edit the content of a WMS using OpenLayers. A WMS provides access to a data set (could be vector or raster data) as an image (through the GetMap request), and provides access to attribute properties for an image coordinate (through the GetFeatureInfo request). This information is read-only.


Only top voted, non community-wiki answers of a minimum length are eligible