<div dir="ltr">Hi,<div><br></div><div style>You have to cast the textual representation of the geometry into an actual geometry, in the st_setSRID function, to resolve the ambiguity:</div><div style><br></div><div style><span style="font-family:arial,sans-serif;font-size:13px">select state </span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px">from zipcode </span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">where st_DISTANCE(column2,</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">ST_SetSRID('POINT(33.911404 -116.768347)'::geometry, 2163)) < 8000</span>;</div><div style><br></div><div style>Nicolas</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 24 December 2012 13:32, nevillekb <span dir="ltr"><<a href="mailto:nevillekb@gmail.com" target="_blank">nevillekb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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 created<br>
to store the lat and long in 2 formats -SRID 4269 (Lat/Lon) and SRID 2163<br>
(US National Atlas – meters).<br>
<br>
Then i execute the following query to populate both the columns with the lat<br>
and lon data<br>
<br>
UPDATE zipcode SET column1 =<br>
ST_SetSRID(ST_MakePoint("longitude","latitude"),4269), column2 =<br>
ST_Transform(ST_SetSRID(ST_MakePoint("longitude","latitude"),4269), 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 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 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 query??<br>
<br>
Thanks<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://postgis.17.n6.nabble.com/Using-PostGIS-for-latitude-longitude-tp5002097p5002125.html" target="_blank">http://postgis.17.n6.nabble.com/Using-PostGIS-for-latitude-longitude-tp5002097p5002125.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the PostGIS - User mailing list archive at Nabble.com.<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>
</div></div></blockquote></div><br></div>