[mapserver-users] OGR/GeoJSON WRITE_BBOX

Tom tom at nthsense.net
Mon Jun 30 10:51:52 PDT 2014


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
<http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=get
feature&typename=og:archsites&outputformat=application/json>
&version=1.0.0&request=getfeature&typename=og:archsites&outputformat=applica
tion/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/78ce0834/attachment.html>


More information about the mapserver-users mailing list