<html><body><div style="color:#000; background-color:#fff; font-family:garamond, new york, times, serif;font-size:14px"><div id="yui_3_16_0_1_1420642633324_16677"><span></span></div><div id="yui_3_16_0_1_1420642633324_16680"><div id="yui_3_16_0_1_1420642633324_16799" dir="ltr"> Hugues:</div><div id="yui_3_16_0_1_1420642633324_16800" dir="ltr">  Thanks for the info!  I saw the link you posted a few days ago, but was still having trouble making it work.</div><div id="yui_3_16_0_1_1420642633324_16801" dir="ltr">The goal is to take what I have, which uses the "ST_Intersects(ST_GeomFromText", and modify my existing query to use a similar query with "ST_Intersects(ST_GeomFromGeoJSON" instead.</div><div id="yui_3_16_0_1_1420642633324_16815" dir="ltr">The original query takes in a polygon as a string of points (ie: -102.87 43.71, -101.48 43.17, -101.7 42.04, -104.19 41.32, -104.95 42.53) and returns all stored polygons which the input polygon intersects (or contains, etc, anything in common).</div><div id="yui_3_16_0_1_1420642633324_17028" dir="ltr">My goal is to do the same thing, but use a GeoJSON string as the input instead, and return all stored polys which intersect.</div><div id="yui_3_16_0_1_1420642633324_17302" dir="ltr"><br></div><div id="yui_3_16_0_1_1420642633324_16802"><br><div id="yui_3_16_0_1_1420642633324_17304" dir="ltr">Is this possible?</div><div dir="ltr"><br></div><div id="yui_3_16_0_1_1420642633324_17305" dir="ltr">Thanks!</div><div dir="ltr"><br></div><div id="yui_3_16_0_1_1420642633324_17306" dir="ltr">Regards,</div><div dir="ltr">Joseph Spenner</div><div id="yui_3_16_0_1_1420642633324_17307" dir="ltr"><br>
</div></div></div><br>  <div id="yui_3_16_0_1_1420642633324_16805" style="font-family: garamond, new york, times, serif; font-size: 14px;"> <div id="yui_3_16_0_1_1420642633324_16804" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1420642633324_16803" dir="ltr"> <hr id="yui_3_16_0_1_1420642633324_17026" size="1">  <font id="yui_3_16_0_1_1420642633324_16806" size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Hugues François <hugues.francois@irstea.fr><br> <b><span style="font-weight: bold;">To:</span></b> Joseph Spenner <joseph85750@yahoo.com>; PostGIS Users Discussion <postgis-users@lists.osgeo.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, January 7, 2015 1:17 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] ST_Intersects ST_GeomFromGeoJSON syntax<br> </font> </div> <div id="yui_3_16_0_1_1420642633324_16807" class="y_msg_container"><br>Hello,<br><br>I'm not very familiar with the use of ST_GeomFromGeoJSON() but looking at the doc, it only accepts a single json string so you'd better remove all the ST_GeomFromText stuff: ST_GeomFromGeoJSON($jsonPolys). There are some examples at the bottom of the page http://www.postgis.org/docs/ST_GeomFromGeoJSON.html.<br><br>HTH<br><br>Hugues.<br><br><br>-------- Message d'origine--------<br>De: <a id="yui_3_16_0_1_1420642633324_16811" ymailto="mailto:postgis-users-bounces@lists.osgeo.org" href="mailto:postgis-users-bounces@lists.osgeo.org">postgis-users-bounces@lists.osgeo.org</a> de la part de Joseph Spenner<br>Date: mar. 06/01/2015 20:31<br>À: PostGIS Users Discussion<br>Objet : [postgis-users] ST_Intersects ST_GeomFromGeoJSON syntax<br> <br>Hello,I currently have a select which works correctly:<br>$sth = $dbh->prepare("select ST_Asgeojson( geom ) from polys where ST_Intersects(ST_GeomFromText('POLYGON(($textPoly, $closingLon $closingLat))', 4269), geom)=TRUE");<br><br><br>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:<br>$sth = $dbh->prepare("select ST_Asgeojson( geom ) from polys where ST_Intersects(ST_GeomFromGeoJSON('POLYGON(($jsonPolys))', 4269), geom)=TRUE");<br><br> 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.<br>Any ideas?<br>Thanks!<br>Regards,Joseph Spenner<br><br><br></div> </div> </div>  </div></body></html>