Monday, 7 December 2015

GeoServer Point Stacker: does identify work on non-clustered points?



I'm a newbie to use GeoServer and SLDs so, sorry in advance if my question is stupid.


I'm trying to use the Point Stacker rendering transfomation for to cluster my point layer. I've a POSTGIS point layer with more than 514.000 points (all the OSM addresses in Italy ....), and so I can't to render them with a simple "red point" in my map and I can't render them using a clustering in the browser using Leaflet, OpenLayers, ecc ...


The structure of my POSTGIS layer is the following


enter image description here


If I try to use a default point symbol to render my layer the visualization is obviously slow but it works right and I can also to identify my point as I can show to you here


enter image description here


The field I'm interested on is "field_4"


I've tried to use the SLD that I've found here http://suite.opengeo.org/opengeo-docs/cartography/rt/pointstacker.html for clustering server side and it's working for mapping my layer as clustered points as I can show to you


enter image description here


I shoud add more classes in my SLD style and I'll do it, but at the moment the issue is that, using cluster, I can't identify points, not when they'are clustered (I don't want this ....), but when they are rappresented as single point. Here you are the case trying to identify the lowest triangle in the picture



enter image description here


The error is "internal error occurred Property 'count' could not be found in osm_civici": I haven't that field in my layer but I've seen that is a "field" used in the SLD style ....


NOTE: I'm using the SLD style found in OpenGeo Suite documentation at http://suite.opengeo.org/opengeo-docs/cartography/rt/pointstacker.html "as-is" and probably there is something to change but I don't know what ....


I'm using OpenGeoSuite Version 4.0.2 on Windows 7 (GeoServer 2.4-SNAPSHOT Git Revision f295d37d70c3b1f0e51942e8b031253e4d75459 Build Date 20-Jan-2014 22:29)



Answer



Your problem is related to Geoserver issue https://jira.codehaus.org/browse/GEOS-5228. See also discussion http://comments.gmane.org/gmane.comp.gis.geoserver.user/39166.


I understood that you want to get feature info only when user has zoomed in so much that points are not stacked together but a symbol marks exactly one point in the original data. In that case the symbol is in the same place than if you have a layer without the pointstacker SLD. Perhaps not exactly because the rendering machine can move the symbols a bit but close anyhow. In that case you should be able to use simple workaround: make your application to send GetFeatureInfo with &STYLES= pointing to a non-stacked style which may be "point" in your case. The following example shows how a GetFeatureInfo request looks like and you can see where to do the change.


http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&format=jpeg&info_format=text/plain&request=GetFeatureInfo&layers=topp:states&query_layers=topp:states&width=550&height=250&x=170&y=160

Another workaround could be to to make a second layer "osm_civici_postgis_query" and use that only for GetFeatureRequests so that when your user clicks on the map the &layers and &query_layers parametes would automatically changed from "osm_civici_postgis" into "osm_civice_postgis_query". Because these two layer may not have the symbols exactly in the same place it might be good to add some tolerance with the "buffer" vendor option http://docs.geoserver.org/latest/en/user/services/wms/vendor.html. A large buffer may find more than one feature sometimes so I would also add for example &feature_count=10 to make the query to return more hits in such case. The default value is 1 and then user would get only one feature and that is not necessarily the closest feature from the clicked point because Geoserver does not sort the GetFeatureInfo results by the distance.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...