Stave, you are right. Thank you very much! I add&nbsp;&nbsp; [shpxy&nbsp; precision=&quot;6&quot;] then the &#39;&#39;coordinates&quot; output correctely. <br><br><div class="gmail_quote">在 2012年4月18日 上午2:58,Lime, Steve D (DNR) <span dir="ltr">&lt;<a href="mailto:Steve.Lime@state.mn.us">Steve.Lime@state.mn.us</a>&gt;</span>写道:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So the problem with the coordinates is they are truncated or ??? Not having the spec handy what would the correct output be? There are<br>

several arguments to the shpxy tag that will probably be of help. For example you might add:<br>
<br>
 &nbsp;[shpxy precision=&quot;6&quot;]<br>
<br>
Steve<br>
<div><div class="h5"><br>
-----Original Message-----<br>
From: <a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>] On Behalf Of Li Quansheng<br>

Sent: Tuesday, April 17, 2012 11:18 AM<br>
To: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
Subject: [mapserver-users] mapserver 5.6 CGI output GeoJSON format<br>
<br>
hi guys,<br>
I installed FGS 5.6.3 on my VM to do some studying, these days I want to add WFS layer to my applyaction via openlayers, and I want to do some WFS query to output GeoJSON, I do my best, now,there is one problem I can&#39;t &nbsp;figure out.<br>

my mapfile: (mapserver 5.6)<br>
....<br>
&nbsp;OUTPUTFORMAT<br>
&nbsp; &nbsp;NAME &quot;geojson&quot;<br>
&nbsp; &nbsp;DRIVER &quot;TEMPLATE&quot;<br>
&nbsp; &nbsp;MIMETYPE &quot;application/json; subtype=geojson&quot;<br>
&nbsp; &nbsp;FORMATOPTION &quot;FILE=xj1JSON.tmpl&quot;<br>
&nbsp;END<br>
...<br>
&nbsp; &nbsp;METADATA<br>
&nbsp; &nbsp; &nbsp;&#39;ows_title&#39; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;XJ-MAP&#39; &nbsp; #OWS (OGC Web Services)<br>
&nbsp; &nbsp; &nbsp;&#39;ows_onlineresource&#39;<br>
&#39;<a href="http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map" target="_blank">http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map</a>&#39;<br>
&nbsp; &nbsp; &nbsp;&#39;ows_srs&#39; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;EPSG:4326&#39;<br>
&nbsp; &nbsp; &nbsp;&#39;wms_tile&#39; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;xjmap&#39;<br>
&nbsp;&#39;wms_onlineresource&#39;<br>
&#39;<a href="http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map" target="_blank">http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map</a>&#39;<br>
&nbsp;&#39;wms_srs&#39; &nbsp; &nbsp;&#39;EPSG:4326 EPSG:900913&#39;<br>
&nbsp;&quot;wfs_title&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;xjmap&quot;<br>
&nbsp; &nbsp; &nbsp;&quot;wfs_onlineresource&quot;<br>
&quot;<a href="http://192.168.207.100/cgin-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;" target="_blank">http://192.168.207.100/cgin-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;</a>&quot;<br>
&nbsp; &nbsp; &nbsp;&quot;wfs_srs&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;EPSG:4326 EPSG:900913&quot; ## Recommended<br>
&nbsp; &nbsp; &nbsp;&quot;wfs_abstract&quot; &nbsp; &nbsp; &nbsp; &quot;xjmap WFS service.&quot; ## Recommended<br>
&nbsp; &nbsp; &nbsp;&quot;wfs_enable_request&quot; &quot;*&quot; &nbsp;# necessary,&quot;*&quot; enables all requests<br>
&nbsp;&quot;wfs_encoding&quot; &nbsp; &quot;UTF-8&quot;<br>
&nbsp; &nbsp;END<br>
....<br>
&nbsp;LAYER<br>
&nbsp; &nbsp;NAME &#39;tielu&#39;<br>
&nbsp; &nbsp;TYPE LINE<br>
&nbsp; &nbsp;DUMP true<br>
&nbsp; &nbsp;TEMPLATE fooOnlyForWMSGetFeatureInfo<br>
&nbsp;EXTENT 70.409351 33.963843 99.420299 49.549665 CONNECTIONTYPE postgis<br>
&nbsp; &nbsp; &nbsp; &nbsp;CONNECTION &quot;host=localhost dbname=xj1 user=xxx password=xxx&quot;<br>
PROCESSING &quot;CLOSE_CONNECTION=DEFER&quot;<br>
DATA &quot;the_geom from tielu&quot;<br>
&nbsp; &nbsp;METADATA<br>
&nbsp; &nbsp; &nbsp;&#39;ows_title&#39; &#39;tielu&#39;<br>
&nbsp;&quot;wfs_title&quot; &nbsp; &nbsp; &nbsp; &nbsp; &quot;tielu&quot; ##REQUIRED<br>
&nbsp; &nbsp; &nbsp;&quot;wfs_srs&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;EPSG:4326&quot; ## REQUIRED<br>
&nbsp;&quot;wfs_featureid&quot; &nbsp; &nbsp; &quot;gid&quot;<br>
&nbsp;#&quot;wfs_getfeature_formatlist&quot; &quot;geojson&quot; # mapserver 6.0 support<br>
&nbsp; &nbsp; &nbsp;&quot;gml_include_items&quot; &quot;all&quot; ## Optional (serves all attributes for layer)<br>
&nbsp; &nbsp; &nbsp;&quot;gml_featureid&quot; &nbsp; &nbsp; &quot;gid&quot; ## REQUIRED<br>
&nbsp; &nbsp; &nbsp;&quot;wfs_enable_request&quot; &quot;*&quot;<br>
&nbsp; &nbsp;END<br>
&nbsp; &nbsp;STATUS OFF<br>
&nbsp; &nbsp;TRANSPARENCY 100<br>
&nbsp; &nbsp;PROJECTION<br>
&nbsp; &nbsp;&#39;proj=longlat&#39;<br>
&nbsp; &nbsp;&#39;datum=WGS84&#39;<br>
&nbsp; &nbsp;&#39;no_defs&#39;<br>
&nbsp; &nbsp;END<br>
&nbsp; &nbsp;CLASS<br>
&nbsp; &nbsp; &nbsp; NAME &#39;tielu&#39;<br>
&nbsp; &nbsp; &nbsp; STYLE<br>
&nbsp; &nbsp; &nbsp; &nbsp; WIDTH 0.91<br>
&nbsp; &nbsp; &nbsp; &nbsp; COLOR 164 229 51<br>
&nbsp; &nbsp; &nbsp; END<br>
&nbsp; &nbsp;END<br>
&nbsp;END<br>
....<br>
the GeoJson outputformat &nbsp;template file xj1JSON.tmpl // mapserver template [resultset layer=tielu] {<br>
&nbsp;&quot;type&quot;: &quot;FeatureCollection&quot;,<br>
&nbsp;&quot;features&quot;: [<br>
&nbsp; &nbsp;[feature limit=-1 feature trimlast=&quot;,&quot;]<br>
&nbsp; &nbsp;{<br>
&nbsp; &nbsp; &nbsp;&quot;type&quot;: &quot;Feature&quot;,<br>
&nbsp; &nbsp; &nbsp;&quot;id&quot;: &quot;[gid]&quot;,<br>
&nbsp; &nbsp; &nbsp;&quot;geometry&quot;: {<br>
&nbsp; &nbsp; &nbsp; &nbsp;&quot;type&quot;: &quot;MultiLineString&quot;,<br>
&nbsp; &nbsp; &nbsp; &nbsp;&quot;coordinates&quot;: [<br>
&quot;coordinates&quot;: [[[shpxy]]]<br>
&nbsp; &nbsp; &nbsp; &nbsp;]<br>
&nbsp; &nbsp; &nbsp;},<br>
&nbsp; &nbsp; &nbsp;&quot;properties&quot;: {<br>
&nbsp; &nbsp; &nbsp; &nbsp;&quot;gid&quot;: &quot;[gid]&quot;,<br>
&nbsp; &nbsp; &nbsp; &nbsp;&quot;type&quot;: &quot;[type]&quot;,<br>
&nbsp; &nbsp; &nbsp; &nbsp;&quot;name&quot;: &quot;[name]&quot;<br>
&nbsp; &nbsp; &nbsp;}<br>
&nbsp; &nbsp;},<br>
&nbsp; &nbsp;[/feature]<br>
&nbsp;]<br>
}<br>
[/resultset]<br>
<br>
I want to output the &quot;tielu&quot; multiline layer , I can success execute the http request, <a href="http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=nquery&amp;qformat=geojson" target="_blank">http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=nquery&amp;qformat=geojson</a><br>

, It seemed that all the GeoJSON output is perfect except &nbsp;the output coordinates of the colum the_geom.<br>
the output is as flowings:<br>
{<br>
 &nbsp;&quot;type&quot;: &quot;FeatureCollection&quot;,<br>
 &nbsp;&quot;features&quot;: [<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp;&quot;type&quot;: &quot;Feature&quot;,<br>
 &nbsp; &nbsp; &nbsp;&quot;id&quot;: &quot;1&quot;,<br>
 &nbsp; &nbsp; &nbsp;&quot;geometry&quot;: {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;type&quot;: &quot;MultiLineString&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;coordinates&quot;: [<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;coordinates&quot;: [[84,42 84,42 84,42 84,42 83,42 83,42 83,42 83,42<br>
83,42 83,42]] &nbsp; //there is sth wrong &nbsp;here!<br>
 &nbsp; &nbsp; &nbsp; &nbsp;]<br>
 &nbsp; &nbsp; &nbsp;},<br>
 &nbsp; &nbsp; &nbsp;&quot;properties&quot;: {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;gid&quot;: &quot;1&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;type&quot;: &quot;70&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;name&quot;: &quot;name111&quot;<br>
 &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp;},<br>
 &nbsp; &nbsp; &nbsp; &nbsp;....<br>
 &nbsp; &nbsp; &nbsp; &nbsp;]<br>
}<br>
I think sth wrong in my template file about &quot;coordinates&quot;:<br>
[[[shpxy]]], I do many google searching,try my best to correct the file,I try<br>
&nbsp;&quot;coordinates&quot;: &nbsp;[[LONG], [LAT]] etc,<br>
 &nbsp; , but I failed, Could anyone give me some advice, thank you very much!<br>
</div></div>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>
<br>
</blockquote></div><br>