[mapserver-users] OGR/GeoJSON WRITE_BBOX
Rahkonen Jukka (Tike)
jukka.rahkonen at mmmtike.fi
Mon Jun 30 11:48:03 PDT 2014
Hi,
Perhaps it is your GDAL version that does not write the BBOX for the collection? This gets GML from Mapserver WFS and converts it into geojson
ogr2ogr -f geojson test_ms.json -lco WRITE_BBOX=YES "http://hip.latuviitta.org/cgi-bin/mapserver_wfs?service=wfs&version=1.0.0&request=getfeature&typename=municipalities&maxfeatures=10"
Result begins
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3067" } },
"bbox": [ 349631.3148, 7066945.4181, 673079.7106, 7776424.2258 ],
"features": [
-Jukka-
________________________________
Tom wrote:
Thanks, Jukka. I see that Geoserver is including the FeatureCollection bbox, but my GeoJSON from Mapserver is not. If I take the json from my WFS call and run it through ogr2ogr as you suggested, the output is an exact copy of the original. I still get bbox for the individual features, but not the feature collection. I tried GDAL 1.9 and 2.0-dev. Perhaps there is something missing from my layer configuration, or could it be that Geoserver has this capability but Mapserver does not?
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Rahkonen Jukka (Tike)
Sent: Monday, June 30, 2014 12:47 PM
To: Tom; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] OGR/GeoJSON WRITE_BBOX
Hi,
About how to test if it is an OGR issue, make a test with OGR. Capture some data for example from some Geoserver WFS and convert it into geojson with ogr2ogr
ogr2ogr -f geojson test.json -lco WRITE_BBOX=YES "http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=og:archsites&outputformat=application/json"
See the beginning of the result
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::26713" } },
"bbox": [ 589860.0, 4914479.0, 608355.0, 4926490.0 ],
"features": [
Conclusion: ogr2ogr can do it. My version is GDAL 2.0-dev.
-Jukka Rahkonen-
________________________________
Tom wrote:
Hi folks,
I’m trying to use OGR to output GeoJSON from my WFS service. I’d like to include the BBOX (equivalent of gml:boundedBy) at the FeatureCollection level. From the documentation, it looks like I should be able to set it up this way:
OUTPUTFORMAT
NAME "GEOJSON"
DRIVER "OGR/GeoJSON"
MIMETYPE "application/json; subtype=geojson"
FORMATOPTION "STORAGE=memory"
FORMATOPTION "FORM=SIMPLE"
FORMATOPTION "LCO:WRITE_BBOX=YES"
END
According to http://www.gdal.org/drv_geojson.html, WRITE_BBOX is exactly what I need. According to the docs, it should create a bbox at the FeatureCollection and the Feature level. For me, it generates a bbox for every feature, but not one for the top-level FeatureCollection, which OGR claims to support.
Does anyone have experience with this? Any idea how I could determine if this would be a Mapserver issue, or an OGR issue?
Thanks,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140630/b5bdf62d/attachment.htm>
More information about the MapServer-users
mailing list