For the following request, how would I produce a single PNG image highlighting just one feature? For example GMUID=84
Here is the base map image
Here is the highlighted feature
-
I'd like to produce something like the following static.huntscore.com/images/blog/co-biggame-unit-84.pngSean Hudson– Sean Hudson2015年12月15日 17:01:33 +00:00Commented Dec 15, 2015 at 17:01
2 Answers 2
There is a WFS service available, too, which allows you to access the underlying data that you see in the WMS response. You can browse all of these here in the Geoserver interface:
https://maps.huntscore.com/geoserver/web/?wicket:bookmarkablePage=:org.geoserver.web.demo.MapPreviewPage
Then you can make a request just for the feature you want, which is well covered by this question's answers: Passing Filter Parameters to GeoServer WFS via URL?
The query you want is something like this (this one returns GeoJSON):
https://maps.huntscore.com/geoserver/ows?service=wfs&version=1.0.0&request=getfeature&typename=colorado:BigGameGMUBoundaries12092014&CQL_FILTER=GMUID=84&outputFormat=application/json
You will need to apply your own styling once you have the features you are after. Perhaps the best thing to do is to continue requesting the WMS image as you are already doing, but also overlay the result of the WFS request on top in the client, and style that as you see fit.
EDIT: to stay within WMS, what you want to do is specify multiple layers (well, the same layer twice), and apply two filters, and two styles:
http://maps.huntscore.com:8080/geoserver/colorado/wms?service=WMS&version=1.1.0&request=GetMap&layers=colorado:BigGameGMUBoundaries12092014,BigGameGMUBoundaries12092014&cql_filter=GMUID%3E0;GMUID=84&styles=MiniMap_Outlines,MiniMap_Polygon&bbox=139992.54690000042,4094064.75,763240.4375,4546735.0&width=768&height=557&srs=EPSG:26913&format=image%2Fpng
-
Thanks for your explanation. That helped me highlight the feature, but I still can't figure out how to get both into a single image.Sean Hudson– Sean Hudson2015年12月15日 16:54:37 +00:00Commented Dec 15, 2015 at 16:54
-
I updated my original post using WMS to show the highlighted feature as well as the base map. I guess I don't understand part of your response where you said "also overlay the result of the WFS request on top in the client."Sean Hudson– Sean Hudson2015年12月15日 17:06:43 +00:00Commented Dec 15, 2015 at 17:06
-
Do you just want an image, or are you showing this in a web map?alphabetasoup– alphabetasoup2015年12月15日 18:58:47 +00:00Commented Dec 15, 2015 at 18:58
-
My assumption is that you are creating a web map, although this would work in a desktop GIS environment just as well. The way I would approach it is to request the non-filtered WMS as a base layer, and then request either the WFS or WMS again with the filter applied, and display that on top of the base layer. Using WFS in the second step is better IMO because you can choose the style yourself with complete control.alphabetasoup– alphabetasoup2015年12月15日 20:03:23 +00:00Commented Dec 15, 2015 at 20:03
-
I just want an image. I have done it before within a web map, but that will not work here.Sean Hudson– Sean Hudson2015年12月15日 21:40:11 +00:00Commented Dec 15, 2015 at 21:40
If the WMS service supports SLD, you could make a GetMap request that provided an SLD style using SLD_BODY or SLD parameters, that coloured the map image according to some unique aspect of the polygon in question.