Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Serving and filtering #GeoJSON from #GeoServer

Posted by smathermather on July 19, 2012

The nice thing about setting up something like GeoServer, which is so feature rich, is when you need to pivot based on the demands of a new project, the technical infrastructure is already there, just waiting to be configured or turned on.

The case today: feature services.  Someone wants to use my existing infrastructure in a new application.  I typically serve tile services.  One checkbox to enable WFS; a couple clicks to see an example GeoJSON request, and

http://localhost:8080/geoserver/cm/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cm:parks&outputFormat=json

Ah.  That wasn’t so bad.  But wait, we need to filter the request!  GeoServer offers CQL and ECQL:

http://localhost:8080/geoserver/cm/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cm:parks&outputFormat=json&cql_filter=(res=’Mildreds Favorite Park”)

Oops, I also need it reprojected on the fly to Google Mercator:

http://localhost:8080/geoserver/cm/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cm:parks&outputFormat=json&cql_filter=(res=’Mildreds Favorite Park”)&srsName=EPSG:3857

Not too bad for a feature I hadn’t needed until today… .

About these ads

One Response to “Serving and filtering #GeoJSON from #GeoServer”

  1. [...] Serving and filtering #GeoJSON from #GeoServer (Smathermather) [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 715 other followers

%d bloggers like this: