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 ...


10

The WMSGetFeatureInfo doesn't work by requesting info on the feature being currently clicked as such. It works by formulating a WMS GetFeatureInfo request which passes a BBOX string to the WMS server. So, when you click on the map the location coordinates are captured and then sent to a WMS server as the request. You could see this in action by using ...


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 ...


6

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=...


5

This example should show you exactly what you need. http://openlayers.org/dev/examples/select-feature-multilayer.html


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

to avoid the cross origin policy that prevents evil sites from stealing your credit card details by accident. See http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#WhydoIneedaProxyHost for more details.


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....


4

you can check this example on openlayers. OpenLayers.ProxyHost = "proxy.cgi?url="; var map; function load() { map = new OpenLayers.Map('map', { maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573) }); var political = new OpenLayers.Layer.WMS("State Boundaries", "http://demo.opengeo....


4

I got maps like yours working and the only difference that I could spot is that I use OpenLayers.Layer.WMS instead of OpenLayers.Layer.MapServer. Since GetFeatureInfo is a WMS protocol operation OL correctly should not apply it to Mapserver layers (even though Mapserver is fully capable of speaking WMS). Try to create the layer as follows: var wmsmap = new ...


4

The queriable information is contained in the WMS capabilities document, the one that gets returned when you hit http://host:port/geoserver/ows?request=GetCapabilities&service=WMS OpenLayers has this class to parse it: http://dev.openlayers.org/docs/files/OpenLayers/Format/WMSCapabilities-js.html


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

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.


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

can you try adding proxyhost for getting information? i am not sure proxy host will solve this problem, but it is useful to try and dont forget adding defination of variables, sometimes they really being big problem... var info; and proxyhost: OpenLayers.ProxyHost = "proxy.cgi?url="; some information about proxyhost you can read this. i hope it helps ...


3

In that example you'll see some code like: infoControls = { click: new OpenLayers.Control.WMSGetFeatureInfo({ url: 'http://demo.opengeo.org/geoserver/wms', title: 'Identify features by clicking', layers: [water], queryVisible: true }), hover: new OpenLayers.Control....


3

GetFeatureInfo by default (per WMS standard) just returns one result, if you want more add FEATURE_COUNT to your request, e.g.: FEATURE_COUNT: 50


3

You need to provide one filter for each layer (or a blank filter) each filter is separated by a ; - see http://ian01.geog.psu.edu:80/geoserver/wms?request=GetMap&layers=tiger:poly_landmarks,tiger:tiger_roads&styles=,&bbox=-73.97,40.74,-73.93,40.78&Format=image/png&width=344&height=500&srs=EPSG:4326&cql_Filter=LANAME%20=%20%...


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

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


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