<div dir="ltr"><div>Hi list,<br><br><table><tbody><tr><td class=""><br></td>
<td class=""><br></td></tr></tbody></table>I would like to get a geojson feature with properties from PostGIS. I have found <a href="http://www.postgresonline.com/journal/archives/267-Creating-GeoJSON-Feature-Collections-with-JSON-and-PostGIS-functions.html">an example</a> to have a feature collection but I can't make it works for just a feature.<br>
<br>so far I modified the feature collection query but the output is not valid:<br><br> "SELECT row_to_json(fc) \<br> FROM (SELECT 'Feature' As type \<br> , ST_AsGeoJSON(%s)::json As geometry \<br>
, row_to_json((id_relat,id)) As properties \<br> FROM shapefile_feature WHERE id=%s)As fc;" % (geometryField, <a href="http://feature.pk">feature.pk</a>)<br>
<br>invalid output:<br><br> {<br> u'geometry':{<br> u'type':u'MultiPolygon',<br> u'coordinates':[<br> [<br> [<br> [<br>
-309443.24253826,<br> 388111.579584133<br> ],<br> [<br> -239422.232645415,<br> 395845.012821243<br> ],<br>
[<br> -136320.430677211,<br> 389768.695489968<br> ]<br> ]<br> ]<br> ]<br> },<br> u'type':u'Feature',<br>
u'properties':{<br> u'f1':0,<br> u'f2':489445<br> }<br> }<br><br></div>Anyone can help here?<br clear="all"><div><div><br>-- <br><div dir="ltr"><div><div><div>Stack Overflow: <a href="http://stackoverflow.com/users/1914034/burton449" target="_blank">http://stackoverflow.com/users/1914034/burton449</a><br>
</div></div>GIS Overflow: <a href="http://gis.stackexchange.com/users/14426/burton449" target="_blank">http://gis.stackexchange.com/users/14426/burton449</a><br></div>LastFm: <a href="http://www.lastfm.fr/user/burton449" target="_blank">http://www.lastfm.fr/user/burton449</a><br>
</div>
</div></div></div>