<div dir="ltr">Hello<div><br></div><div>Considering your geometric column is named geom:</div><div><br></div><div>select geom </div><div>from polys </div><div>where st_contains(geom, st_setSRID(st_makePoint(lon, lat), 4326));</div>

<div><br></div><div>(if several polygons contain this point, they will all be returned. Adding LIMIT 1 at the end of the query will force to get only one result.</div><div><br></div><div>Nicolas</div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On 8 August 2014 17:24, Newcomb, Doug <span dir="ltr"><<a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Joseph,<div>I don't see a geometry or geography field in your table listing.</div><div><br></div><div>Doug </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 8, 2014 at 11:12 AM, Joseph Spenner <span dir="ltr"><<a href="mailto:joseph85750@yahoo.com" target="_blank">joseph85750@yahoo.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:garamond,new york,times,serif;font-size:14pt">Hello, I've just got postgresql93-server installed, with postgis21-postgresql93 on a CentOS system.<br>



<br>I then used shp2pgsql to load in some shape files using this procedure:<br><br><a href="http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/shp2pgsql.html" target="_blank">http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/shp2pgsql.html</a><br>



<br>The shapefiles were obtained from NWS:<br><a href="http://www.nws.noaa.gov/geodata/catalog/wsom/html/pubzone.htm" target="_blank">http://www.nws.noaa.gov/geodata/catalog/wsom/html/pubzone.htm</a><br><br>Everything appears to have been written to the database properly:<br>



<br>polydata=# select state,time_zone,zone,name,lon,lat from polys where state='CO' limit 10;<br> state | time_zone | zone |               name               |      lon       |      lat      <br>-------+-----------+------+----------------------------------+----------------+---------------<br>



 CO    | M         | 048  | Logan County                     | -103.110114271 | 40.<a href="tel:7246902558" value="+17246902558" target="_blank">7246902558</a><br> CO    | M         |
 044  | Morgan County                    | -103.809823690 | 40.<a href="tel:2627093692" value="+12627093692" target="_blank">2627093692</a><br> CO    | M         | 050  | Sedgwick County                  | -102.351810279 | 40.8758426210<br>

 CO    | M         | 049  | Washington County                | -103.201287262 | 39.9710250432<br>

 CO    | M         | 090  | Yuma County                      | -102.424258955 |
 40.0029195574<br> CO    | M         | 099  | Springfield Vicinity/Baca County | -102.560453567 | 37.<a href="tel:3192132374" value="+13192132374" target="_blank">3192132374</a><br> CO    | M         | 097  | Las Animas Vicinity/Bent County  | -103.071690129 | 37.9551177349<br>

 CO    | M         | 092  | Cheyenne County                  | -102.603398004 | 38.8279341557<br>

 CO    | M         | 089  | Crowley County                   | -103.784878922 | 38.3266440954<br> CO    |
 M         | 091  | Kit Carson County                | -102.602884309 | 39.<a href="tel:3054124576" value="+13054124576" target="_blank">3054124576</a><br>(10 rows)<br><br>polydata=#<br><br>My goal is to construct a query providing lat/lon such that the result returned is the single row poly containing that point.<br>



<br>Does anyone know how I would construct this query?<br><div>
<br>Thanks!<br><br>Regards,<br>Joseph Spenner<br><br></div></div></div><br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote>

</div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>

Doug Newcomb</div><div>USFWS</div><div>Raleigh, NC</div><div><a href="tel:919-856-4520%20ext.%2014" value="+19198564520" target="_blank">919-856-4520 ext. 14</a> <a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a></div>

<div>---------------------------------------------------------------------------------------------------------</div>

<div>The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior.   Life is too short for undocumented, proprietary data formats.</div>




</font></span></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>