1

I have a materialized VIEW in PostgreSQL/PostGIS that contains observations for thousands of species. I am currently serving this view as a single WMS/WFS layer using Geoserver, and this works fine for our web applications. We just use a CQL filter in the application to limit to the species selected by the user. But, I am not sure of the best way to get the data to end users in a GIS client (ArcMap mostly, but also QGIS), who will almost always want to view observations for a single species at a time. Although SQL filters can be applied to a WFS layer in QGIS, I am not sure about ArcMap. Also, it might be too much to ask to suggest that end users form and apply these queries in their GIS client, since most end users will be biologists, rather than GIS or database specialists. The options I can think of that might be viable are:

1) Serve the data as-is, and ask end users to filter by species on their end.

2) Programmatically create a separate layer for each species, possibly as layer groups, in Geoserver, grouped by major taxonomic groupings (e.g., Birds, Mammals, etc.). This is problematic because the data change on a daily basis, so views/layers would have to be regenerated frequently.

Are there other options I might be missing?

  • 1
    The standardized way for filtering is to use XML filters as specified in the OGC Filter encoding standard. You can use stored queries with WFS 2.0 for making frequently used queries more user-friedly. – user30184 Jun 8 '17 at 17:05
  • I understand how to filter these service types in a web application framework, but I am looking for a painless way to deliver these to users working within ArcMap or QGIS, with a minimum of required SQL knowledge. – user13706 Jun 8 '17 at 19:39
  • I would just create a view for each layer you want with the SQL built in. Views are dynamic so will automatically update the features when the 'master' layer is updated. You can then serve these views as wfs/wms. Just be careful with wfs and arcMap. I haven't used it for a while, but last time I checked, the user needs to have the interoperability extension to use them – firefly-orange Jun 9 '17 at 14:15
  • @firefly-orange, that is the simplest option, in some ways, but would require us to maintain 7,000 views (one for each species). We could obviously find a way to generate them in a reasonable way, but if something changed (e.g., if we wanted to alter the schema of the tables we're delivering), it would require regenerating them all. It's also lots of clutter in the database, though I know they don't take up much physical space. – user13706 Jun 9 '17 at 20:27
  • You can use custom SLD with WMS, on a single layer. – nmtoken Jun 13 '17 at 4:49
1

The responses to another question on Stack gave me the answer I was looking for. I was able to make use of the custom parameters (see linked question for samples) on the WMS layer in ArcMap to filter to a particular species. In short, with ArcMap 10.4 and up, you can specify custom parameters by double-clicking the name of the WMS service (note that you must click the service name, not the individual layer name), and specifying a CQL_FILTER in the Parameters tab. Note that no validation is performed by ArcMap, because it doesn't even understand the parameter you're asking it to pass -- it just passes the parameter to the map server, and if nothing is returned, so be it. One thing that tripped me up is the formatting of the CQL_FILTER. The filter should look like the following:

comname = 'Northern Pintail'

Sample CQL_FILTER specification in ArcMap

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.