<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
@font-face
{font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif"}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif"}
span.BalloonTextChar
{font-family:"Tahoma","sans-serif"}
span.emailstyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
span.balloontextchar0
{font-family:"Tahoma","sans-serif"}
span.EmailStyle22
{font-family:"Calibri","sans-serif";
color:#1F497D}
.MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
-->
</style><style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" lang="EN-US" link="blue" vlink="purple">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi,<br>
<br>
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<br>
<br>
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"<br>
<br>
Result begins<br>
<br>
{<br>
"type": "FeatureCollection",<br>
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3067" } },<br>
"bbox": [ 349631.3148, 7066945.4181, 673079.7106, 7776424.2258 ],<br>
"features": [<br>
<br>
-Jukka-<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF110078"><font color="#000000" face="Tahoma" size="2"> Tom wrote:<br>
</font><br>
</div>
<div></div>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">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?</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> mapserver-users-bounces@lists.osgeo.org [mailto:mapserver-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Rahkonen Jukka (Tike)<br>
<b>Sent:</b> Monday, June 30, 2014 12:47 PM<br>
<b>To:</b> Tom; mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] OGR/GeoJSON WRITE_BBOX</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"; color:black">Hi,<br>
<br>
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<br>
<br>
ogr2ogr -f geojson test.json -lco WRITE_BBOX=YES "<a href="http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=og:archsites&outputformat=application/json" target="_blank">http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=og:archsites&outputformat=application/json</a>"<br>
<br>
See the beginning of the result<br>
<br>
{<br>
"type": "FeatureCollection",<br>
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::26713" } },<br>
"bbox": [ 589860.0, 4914479.0, 608355.0, 4926490.0 ],<br>
"features": [<br>
<br>
Conclusion: ogr2ogr can do it. My version is GDAL 2.0-dev.<br>
<br>
-Jukka Rahkonen-</span></p>
<div>
<div class="MsoNormal" style="text-align:center" align="center"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"; color:black">
<hr align="center" size="2" width="100%">
</span></div>
<div id="divRpF485086">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"; color:black">Tom wrote:</span><span style="font-size:12.0pt; font-family:"Times New Roman","serif"; color:black"></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:#1F497D">Hi folks,</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">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:</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">OUTPUTFORMAT</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> NAME "GEOJSON"</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> DRIVER "OGR/GeoJSON"</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> MIMETYPE "application/json; subtype=geojson"</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> FORMATOPTION "STORAGE=memory"</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> FORMATOPTION "FORM=SIMPLE"</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> FORMATOPTION "LCO:WRITE_BBOX=YES"</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">END</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">According to <a href="http://www.gdal.org/drv_geojson.html" target="_blank">
http://www.gdal.org/drv_geojson.html</a>, 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.</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Does anyone have experience with this? Any idea how I could determine if this would be a Mapserver issue, or an OGR issue?</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks,</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Tom</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:black"> </span></p>
<p class="MsoNormal"><span style="color:black"> </span></p>
<p class="MsoNormal"><span style="color:black"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>