<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
p.msochpdefault, li.msochpdefault, div.msochpdefault
        {mso-style-name:msochpdefault;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Times New Roman","serif";}
span.balloontextchar0
        {mso-style-name:balloontextchar;
        font-family:"Tahoma","sans-serif";}
span.emailstyle17
        {mso-style-name:emailstyle17;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.balloontextchar00
        {mso-style-name:balloontextchar0;
        font-family:"Tahoma","sans-serif";}
span.emailstyle22
        {mso-style-name:emailstyle22;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hi Jukka,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>That service you are fetching from returns the gml:boundedBy element, which would correspond directly to the bbox of the FeatureCollection.  If I use GML which already has the boundedBy element in it, ogr2ogr does in fact return a bbox at the FeatureCollection level.  When I request my layer as GML, it returns a boundedBy element.  When I request it as GeoJSON, the bbox is not there.  I think this points to a Mapserver issue.  Do you agree?<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Tom<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></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 2:48 PM<br><b>To:</b> Tom; mapserver-users@lists.osgeo.org<br><b>Subject:</b> Re: [mapserver-users] OGR/GeoJSON WRITE_BBOX<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'>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 "<a href="http://hip.latuviitta.org/cgi-bin/mapserver_wfs?service=wfs&version=1.0.0&request=getfeature&typename=municipalities&maxfeatures=10">http://hip.latuviitta.org/cgi-bin/mapserver_wfs?service=wfs&version=1.0.0&request=getfeature&typename=municipalities&maxfeatures=10</a>"<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-<o:p></o:p></span></p><div><div class=MsoNormal align=center style='text-align:center'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:black'><hr size=2 width="100%" align=center></span></div><div id=divRpF110078><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'><o:p></o:p></span></p></div><div><div><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><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></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";color:black'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'> <a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> [<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mailto:mapserver-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Rahkonen Jukka (Tike)<br><b>Sent:</b> Monday, June 30, 2014 12:47 PM<br><b>To:</b> Tom; <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><b>Subject:</b> Re: [mapserver-users] OGR/GeoJSON WRITE_BBOX</span><span style='color:black'><o:p></o:p></span></p></div></div><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></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><span style='color:black'><o:p></o:p></span></p><div><div class=MsoNormal align=center style='text-align:center'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:black'><hr size=2 width="100%" align=center></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='color:black'><o:p></o:p></span></p></div><div><div><p class=MsoNormal><span style='color:#1F497D'>Hi folks,</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>OUTPUTFORMAT</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>                  NAME "GEOJSON"</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>                  DRIVER "OGR/GeoJSON"</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>                  MIMETYPE "application/json; subtype=geojson"</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>                  FORMATOPTION "STORAGE=memory"</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>                  FORMATOPTION "FORM=SIMPLE"</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>                FORMATOPTION "LCO:WRITE_BBOX=YES"</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>END</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thanks,</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Tom</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p></div></div></div></div></div></div></div></div></div></body></html>