[Featureserver] Problem serializing/de-serializing a group of
features
Frederik Ramm
frederik at remote.org
Thu Oct 23 08:31:41 EDT 2008
Hi,
I have another problem with OpenLayers/Featureserver (not the SVN
version but willing to switch if this is deemed helpful).
I have created an array of OpenLayers.Feature objects, some of which
are lines and some are points. I serialize this using the
geojson_format, and this is what I get:
{"type":"FeatureCollection","features":
[{"type":"Feature","id":"OpenLayers.Feature.Vector_741","properties":
{"name":"test"},"geometry":{"type":"LineString","coordinates":
[[945178.1739570623,6276911.365012558],
[945265.0031598689,6277036.95892723],
[945566.6789798767,6277391.686957826],[945555.547030799,6277525.77463751
[...] (5 more features in the collection)
I can de-serialize this string without problems. I then send it to
the Featureserver for storing, using a POST request to crate.geojson
with the exact string from above as the message body. The data is
stored successfully. I ran the above against an empty database and
then retrieved object #1 using a GET request. What I get back is this:
{"crs": {"type": "none", "properties": {"info": "No CRS information
has been provided with this data."}}, "type": "FeatureCollection",
"features": [{"geometry": {"type": "LineString", "coordinates":
[[945178.1739570623,6276911.365012558],
[945265.0031598689,6277036.95892723],
[945566.6789798767,6277391.686957826],
[945555.547030799,6277525.77463751 ... "type": "Feature" ...
[...] (no more features in the collection)
Two things are unexpected about this:
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?
2. For some reason, the GeoJSON I get back from Featureserver cannot
be parsed - geojson_format.read() applied on the string simply
returns null, whereas I would expect it to return an array containing
one Feature.
I get no error messages however. I'll try to isolate this and narrow
it down to a mini string that is not parseable but before I do that I
wanted to ask whether this is maybe a known problem - anything to do
with the "crs" stuff added by Featureserver perhaps?
Bye
Frederik
--
Frederik Ramm ## eMail frederik at remote.org ## N49°00'09" E008°23'33"
More information about the Featureserver
mailing list