[postgis-users] ST_Intersects ST_GeomFromGeoJSON syntax

Joseph Spenner joseph85750 at yahoo.com
Tue Jan 6 11:31:46 PST 2015


Hello,I currently have a select which works correctly:
$sth = $dbh->prepare("select ST_Asgeojson( geom ) from polys where ST_Intersects(ST_GeomFromText('POLYGON(($textPoly, $closingLon $closingLat))', 4269), geom)=TRUE");


I'm trying to do the same thing, using FromGeoJSON instead of Text.  Below is my attempt, but it's not working.  This is my statement, where $jsonPolys contains the JSON:
$sth = $dbh->prepare("select ST_Asgeojson( geom ) from polys where ST_Intersects(ST_GeomFromGeoJSON('POLYGON(($jsonPolys))', 4269), geom)=TRUE");

 I think the problem has something to do with the POLYGON text, since it may not be necessary.  But I can't get the syntax right.
Any ideas?
Thanks!
Regards,Joseph Spenner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150106/261b3b68/attachment.html>


More information about the postgis-users mailing list