<p>Merry Xmas everyone.</p>
<p>I believe you can also use ST_GeomFromText('POINT(123, 456)', 2163) to get back a geometry.</p>
<p>Regards,<br>
Tim</p>
<div class="gmail_quote">On Dec 25, 2012 10:30 AM, "Stephen Woodbridge" <<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also, be aware that PostGIS expects coordinates in X-Y order which means for need to enter lat, lon as (long, lat) to correspond to (X, Y).<br>
<br>
-Steve<br>
<br>
PS: Merry Christmas Brent and everyone else!<br>
<br>
On 12/24/2012 3:54 PM, <a href="mailto:pcreso@pcreso.com" target="_blank">pcreso@pcreso.com</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Neville,<br>
<br>
Merry Christmas (it already is here in NZ :-)<br>
<br>
You are passing a string - 'POINT(33.911404 -116.768347)' - not a<br>
geometry in your query hence the error message that ST_SetSRID() doesn't<br>
know what the first parameter is<br>
<br>
Instead of:<br>
<br>
select state from zipcode where DISTANCE(column2,<br>
ST_SetSRID('POINT(33.911404 -116.768347)', 2163)) < 8000;<br>
<br>
try:<br>
<br>
select state from zipcode where DISTANCE(column2,<br>
ST_SetSRID(ST_MAKEPOINT(33.<u></u>911404 -116.768347), 2163)) < 8000;<br>
<br>
<br>
Cheers,<br>
<br>
   Brent<br>
<br>
<br>
--- On *Tue, 12/25/12, nevillekb /<<a href="mailto:nevillekb@gmail.com" target="_blank">nevillekb@gmail.com</a>>/* wrote:<br>
<br>
<br>
    From: nevillekb <<a href="mailto:nevillekb@gmail.com" target="_blank">nevillekb@gmail.com</a>><br>
    Subject: Re: [postgis-users] Using PostGIS for latitude & longitude<br>
    To: <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br>
    Date: Tuesday, December 25, 2012, 1:32 AM<br>
<br>
    Hi,<br>
<br>
    So i created a table named zipcode with the following columns<br>
<br>
    Id<br>
    State<br>
    Zip<br>
    Latitude<br>
    Longitude<br>
    column1<br>
    column2<br>
<br>
    columns named column1 and column2 are the 2 geometry columns i have<br>
    created<br>
    to store the lat and long in 2 formats -SRID 4269 (Lat/Lon) and SRID<br>
    2163<br>
    (US National Atlas – meters).<br>
<br>
    Then i execute the following query to populate both the columns with<br>
    the lat<br>
    and lon data<br>
<br>
    UPDATE zipcode SET column1 =<br>
    ST_SetSRID(ST_MakePoint("<u></u>longitude","latitude"),4269), column2 =<br>
    ST_Transform(ST_SetSRID(ST_<u></u>MakePoint("longitude","<u></u>latitude"),4269),<br>
    2163);<br>
<br>
    Everything has worked fine till now, but now when i try to execute the<br>
    following query to show all records that are within 5 miles of a<br>
    given point<br>
    i get an error.<br>
<br>
    Query:<br>
<br>
    select state from zipcode where DISTANCE(column2,<br>
    ST_SetSRID('POINT(33.911404 -116.768347)', 2163)) < 8000;<br>
<br>
    Error Generated:<br>
<br>
    WARNING  ] select state from zipcode where DISTANCE(column2,<br>
    ST_SetSRID('POINT(33.911404 -116.768347)', 2163)) < 8000<br>
                 ERROR:  function st_setsrid(unknown, integer) is not unique<br>
                 LINE 1: select state from zipcode where DISTANCE(column2,<br>
    ST_SetSRID...<br>
                                           ^<br>
                 HINT:  Could not choose a best candidate function. You<br>
    might<br>
    need to add explicit type casts.<br>
<br>
    Can someone help me out as to where am i going wrong in the above<br>
    query??<br>
<br>
    Thanks<br>
<br>
<br>
<br>
    --<br>
    View this message in context:<br>
    <a href="http://postgis.17.n6.nabble.com/Using-PostGIS-for-latitude-longitude-tp5002097p5002125.html" target="_blank">http://postgis.17.n6.nabble.<u></u>com/Using-PostGIS-for-<u></u>latitude-longitude-<u></u>tp5002097p5002125.html</a><br>

    Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
    ______________________________<u></u>_________________<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-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
<br>
<br>
<br>
______________________________<u></u>_________________<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-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<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-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
</blockquote></div>