Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Are there any methods to query several features by id other than one entry by a single url request?

The scenario is I store around 200 point layers in PostgreGIS. Each maintains 100k entries GPS points. My boss wants to let them "move" in the browser. Obviously it's impossible to query all entries at once. So I want to query like 1k entries for one layer in every query. So basically I want to query the features by their id, like "starID<=ID<=endID". But it seems like by WFS url query, it can only query one entry every time by the featureID=ID. I'm also thinking about using the ordinary Postgre other then PostgreGIS, but just in case there might be spatial queries in the future.

share|improve this question
add comment

migrated from stackoverflow.com Oct 2 '12 at 14:26

This question came from our site for professional and enthusiast programmers.

2 Answers

As of version 1.0.0 of the WFS, specification the request GetCapabilities had an optional attribute named maxFeatures that allows limiting the number or returned features.

Another optional attribute GetCapibilities had was featureId, which allows giving the list of desired features, identified by its id.

As said before, these attributes are optional. Thus, if you are planning using any of them, check before that your WFS server implements them.

share|improve this answer
    
Yes, Ii use geoserver and it supports these two parameters. I know about the maxFeatures and featureId. For maxFeatures, the problem is after each query, the pointer keeps going. Say if I make a simple query without sorting, I get two sets of different points by using maxFeatures twice. And for featureID, I actually doesn't know the ids. My scenario is I try to load 5000 gps points one time and the total points are up to 100,000. –  user1056824 Oct 5 '12 at 15:11
add comment

You can use a filter, where you provide the Query. This Answer will show you how to use a filter in the WFS query: http://gis.stackexchange.com/a/26298/442

The filter can be something like this:

<ogc:Filter>
  <ogc:PropertyIsBetween>
    <ogc:PropertyName>ID</ogc:PropertyName>
    <ogc:LowerBoundary>
      <ogc:Literal>25</ogc:Literal>
    </ogc:LowerBoundary>
    <ogc:UpperBoundary>
      <ogc:Literal>124</ogc:Literal>
    </ogc:UpperBoundary>
  </ogc:PropertyIsBetween>
</ogc:Filter>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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