Hot answers tagged

16

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


9

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


7

Just don't include the fields you don't want in your freemarker template. See http://docs.geoserver.org/trunk/en/user/tutorials/GetFeatureInfo/index.html#custom-templates


5

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


5

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


5

Doesn't look good (source): ... GetFeatureInfo [...] is a WMS request and WFS. [...] One difference in their behaviour is that Geoserver sends always all the attributes with GetFeatureInfo but with WFS the list of attributes can be given in the request. You could create a view that contains only the attributes your user wants to/should see and serve ...


4

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


4

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


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

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


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

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


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

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

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


3

You need to provide one filter for each layer (or a blank filter) each filter is separated by a ; - see ...


3

The WMS spec does not provide any direction on how a server should implement the GetFeatureInfo response. In some systems the "pixel tolerance" is a function of the client (web browser or desktop client) - a clicked point can be buffered and the resulting polygon is sent as the query geometry. However, GetFeatureInfo only accepts a point input so that's ...


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

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


3

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


2

So mostly for future readers of this question - when you are doing getFeatureInfo requests to a different server (which includes a difference in the port number) you need a proxy - see http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost for more discussion.


2

Now, We can add WMS service with google map api v3. You can access here https://code.google.com/p/google-maps-api-with-wms-overlay/source/browse/


2

I am looking at this also. My problem is different since I am not sure how to address the correct layer. I found this: http://www.azavea.com/blogs/labs/2011/06/using-the-cql_filter-parameter-with-openlayers-wms-layers/ But I think I understand your problem. You would have to make a function that grabs the search term (or static search) and sends the call ...


2

did you pass the CQL filter to the WMS GetFeatureInfo request too? If not then any record in the whole dataset at that location will be returned.


2

You can use request metod of WMSGetFeatureInfo control. Open this example and type in console: map.controls[4].request(new OpenLayers.Pixel(296,148)).


2

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


2

The default format of the WMSGetFeatureInfo plugin is html, which leverages server side templates for the output. If you want the grid format, you have to configure the plugin with the 'format' option set to 'grid': { ptype: 'gxp_wmsgetfeatureinfo', format: 'grid' } See ...


2

Option #1: Use a click Handler (EXAMPLE). and Inside click trigger build the infoWindow like so: ... trigger: function(e) { var feature = geojson_layer.getFeatureById(e.target._featureId); //<--feature being clicked on. map.addPopup(new OpenLayers.Popup.FramedCloud( "chicken", map.getLonLatFromPixel(e.xy), null, ...


2

This capability now exists in GeoServer 2.2.4. Here's how to request JSON output: http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getfeatureinfo



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