[Featureserver] Problem serializing/de-serializing a group of features

Christopher Schmidt crschmidt at metacarta.com
Thu Oct 23 10:39:33 EDT 2008


On Thu, Oct 23, 2008 at 03:10:03PM +0200, Frederik Ramm wrote:
> Hi,
> 
> On 23.10.2008, at 14:31, Frederik Ramm wrote:
> > 1. Featureserver has stored all members of the collection I uploaded
> > individually. I can now access them with individual GET requests
> > as .../1, .../2 etc., but I cannot retrieve the group as uploaded. Is
> > this the correct behaviour, and what coud I do to group the objects
> > on the server?

> Maybe my whole approach is broken. What I'm doing is: I have a front- 
> end that computes directions (how to get from A to B) using various  
> services, and dispalys them using OpenLayers. I now want users to be  
> able to comment on the results by placing markers on  the map and  
> adding comments ("... service A takes a bad decision at this  
> intersection, service B does it better..."), and then what I want is  
> to save the whole parcel - start point, end point, vectors describing  
> the various results, and markers (i.e. point features) - to  
> Featureserver. However these Features are not meant to be accessed  
> indiviually out of context - the marker with user annotation is not  
> worth anything without the linestrings.

I would say then that what I would do is assign each user session a
unique ID -- generated randomly, or by querying a database for the next
ina sequence of these IDs, or some such -- and with each feature that is
created within OpenLayers, store this as an attribute of the feature.
When you serialize this to GeoJSON, you'll have a 'feedback_id'
attribute in your feature, which will go into the feedback_id column in
the database.

Then, you can do a query to FeatureServer based on feedback_id and get
back all of the items that went 'together' by doing:

  ?queryable=feedback_id&feedback_id=17

You would have to build some custom (non-FeatureServer) service which
would give you the feedback ID list, but that's relatively simple
against most of these databases.  

> Ultimately I want to display a simplified overview map where at first  
> you only get dots labelled "route from X to Y, 4 comments", and then  
> I want to be able to select one of these and load the "parcel" and  
> display it.

Right, the building of the former part would be a custom job, the latter
part could be done with FeatureServer/OL.

> Maybe I should just dump Featureserver and simply store the  
> OpenLayers-generated GeoJSON strings for a full "parcel" in a plain  
> MySQL or PostGIS database? My use case is probably on the fringe of  
> what Featureserver was intended to do, so maybe I'm buying more  
> trouble than I'm saving time here.

I think that the serialization of the JSON such that it's queryable
later may have some value, but you're right that it is on the fringe of
what FeatureServer intends to do. It seems to me like you could do all
of the saving (writes to the DB) through FS and just write a small
custom frontend for doing the other half, but it will be development
work either way. 

Best of luck,
-- 
Christopher Schmidt
MetaCarta



More information about the Featureserver mailing list