<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>
<!--
@font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
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}
span.E-MailFormatvorlage17
{font-family:"Calibri","sans-serif";
color:windowtext}
span.E-MailFormatvorlage18
{font-family:"Calibri","sans-serif";
color:#1F497D}
.MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:70.85pt 70.85pt 2.0cm 70.85pt}
-->
</style><style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" lang="DE" link="blue" vlink="purple">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi,<br>
<br>
Have you tried to request geojson with its MIMETYPE as &format=<span lang="EN-US">application/json; subtype=geojson ?<br>
<br>
-Jukka Rahkonen-<br>
<br>
</span>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF729656"><font color="#000000" face="Tahoma" size="2">Jacob Mendt wrote:<br>
</font><br>
</div>
<div></div>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">> Hey List,</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">> i am right now trying to bring get my Mapserver (Version 6.0.0) WFS running with GeoJSON. But I always get back an empty response. I tried several approaches and my WFS runs with a GML response. So maybe somebody could
give me hint. Here is my mapfile:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">MAP</span></p>
<p class="MsoNormal"><span lang="EN-US"> …</span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">PROJECTION</span></p>
<p class="MsoNormal" style="margin-left:35.4pt; text-indent:35.4pt"><span lang="EN-US">"init=epsg:4314"</span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">END</span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">EXTENT 5.83333301544189 47.2000007629395 23.0000019073486 56</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">…</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># OUTPUTFORMAT</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># NAME "geojson"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># DRIVER "OGR/GEOJSON"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># MIMETYPE "application/json; subtype=geojson"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># FORMATOPTION "STORAGE=stream"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># FORMATOPTION "FORM=SIMPLE"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"># END</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US">OUTPUTFORMAT</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> NAME "geojson"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> DRIVER "TEMPLATE"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"> FORMATOPTION "FILE<span style="color:black">=/home/test</span>/messtischblatt.js"</p>
<p class="MsoNormal" style="margin-left:35.4pt"> <span lang="EN-US">MIMETYPE "application/json; subtype=geojson"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US">END</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US">WEB</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> METADATA</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> "wfs_srs" "epsg:900913 epsg:4314 EPSG:3857 EPSG:4326 EPSG:3978"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> "wfs_getfeature_formatlist" "geojson"</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US"> END</span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US">END # WEB</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> # geojson layer</span></p>
<p class="MsoNormal"><span lang="EN-US"> LAYER</span></p>
<p class="MsoNormal"><span lang="EN-US"> TEMPLATE "messtischblatt.js"</span></p>
<p class="MsoNormal"><span lang="EN-US"> STATUS ON</span></p>
<p class="MsoNormal"><span lang="EN-US"> NAME "test"</span></p>
<p class="MsoNormal"><span lang="EN-US"> TYPE POLYGON</span></p>
<p class="MsoNormal"><span lang="EN-US"> EXTENT 649304.652862922 6090078.57976033 2559975.30438738 7538210.86255982</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> DATA "boundingbox from (SELECT * FROM layer ORDER BY titel, time) as foo using unique id using srid=900913"</span></p>
<p class="MsoNormal"><span lang="EN-US"> CONNECTIONTYPE postgis</span></p>
<p class="MsoNormal"><span lang="EN-US"> CONNECTION "dbname=*** user=*** password=*** host=*** "</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> #DATA "messtischblatt"</span></p>
<p class="MsoNormal"><span lang="EN-US"> #CONNECTIONTYPE OGR</span></p>
<p class="MsoNormal"><span lang="EN-US"> #CONNECTION "PG: dbname=*** user=*** password=*** host=***"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> PROJECTION</span></p>
<p class="MsoNormal"><span lang="EN-US"> "init=epsg:900913"</span></p>
<p class="MsoNormal"><span lang="EN-US"> END</span></p>
<p class="MsoNormal"><span lang="EN-US"> METADATA</span></p>
<p class="MsoNormal"><span lang="EN-US"> "wfs_title" "Test WFS"</span></p>
<p class="MsoNormal"><span lang="EN-US"> "wfs_srs" "EPSG:4326 EPSG:4314 EPSG:900913 "</span></p>
<p class="MsoNormal"><span lang="EN-US"> "wfs_enable_request" "*"</span></p>
<p class="MsoNormal"><span lang="EN-US"> "wfs_getfeature_formatlist" "geojson"</span></p>
<p class="MsoNormal"><span lang="EN-US"> END</span></p>
<p class="MsoNormal"><span lang="EN-US"> END</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">END # MAP# Tile Index</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I test it with a couple of approaches. It tried both Outputformats and both ways of defining a postgis data source. But in any case I get back an empty response. With the template approach I used the following template:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">[resultset layer=test]</span></p>
<p class="MsoNormal"><span lang="EN-US">{</span></p>
<p class="MsoNormal"><span lang="EN-US"> “type”: “FeatureCollection”,</span></p>
<p class="MsoNormal"><span lang="EN-US"> “features”: [</span></p>
<p class="MsoNormal"><span lang="EN-US"> [feature trimlast=”,”]</span></p>
<p class="MsoNormal"><span lang="EN-US"> {</span></p>
<p class="MsoNormal"><span lang="EN-US"> “type”: “Feature”,</span></p>
<p class="MsoNormal"><span lang="EN-US"> “id”: “[id]”,</span></p>
<p class="MsoNormal"><span lang="EN-US"> …</span></p>
<p class="MsoNormal"><span lang="EN-US"> }</span></p>
<p class="MsoNormal"><span lang="EN-US"> [/feature]</span></p>
<p class="MsoNormal"><span lang="EN-US"> ]</span></p>
<p class="MsoNormal"><span lang="EN-US">}</span></p>
<p class="MsoNormal"><span lang="EN-US">[/resultset]</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I run my mapserver also with DEBUG level 5. I got the following log output:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">[Mon Jul 21 18:10:21 2014].528584 msFreeMap(): freeing map at 0x19447b0.</span></p>
<p class="MsoNormal"><span lang="EN-US">[Mon Jul 21 18:10:22 2014].387718 CGI Request 1 on process 4362</span></p>
<p class="MsoNormal"><span lang="EN-US">[Mon Jul 21 18:10:22 2014].521952 mapserv request processing time (msLoadMap not incl.): 0.134s</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">My test request is:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="http://localhost/cgi-bin/mtbows?map=./test.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=test&MAXFEATURES=100&srsname=EPSG:900913&bbox=1518929.826549386,6766016.954331277,2693002.5808462612,7384239.639015725&outputformat=geojson" target="_blank">http://localhost/cgi-bin/mtbows?map=./test.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=test&MAXFEATURES=100&srsname=EPSG:900913&bbox=1518929.826549386,6766016.954331277,2693002.5808462612,7384239.639015725&outputformat=geojson</a></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Could somebody give me an advice?</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Kind regards, </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">JM</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
</div>
</div>
</div>
</div>
</body>
</html>