<div dir="ltr">Hi Aaron,<div><br></div><div>SRID is used to set a consistent coordinate system to the data. It refers to an EPSG Coordinate Reference System (CRS). For instance, EPSG:2600: (<a href="http://spatialreference.org/ref/epsg/2600/">http://spatialreference.org/ref/epsg/2600/</a>) is a metric CRS.</div><div><br></div><div>Coordinates <span style="font-size:12.8000001907349px">(146.0, 138.19) are not valid in SRID 2600 (nor in lat/long coordinates).</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">You would use st_setSRID when the coordinates are already in the correct CRS, and st_transform() to reproject coordinates from one CRS to another:</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><font face="monospace, monospace">-- Search inside a 100m circle for a point already in SRID=2600:</font></span></div><font face="monospace, monospace"><span style="font-size:12.8000001907349px">SELECT * FROM users</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">WHERE ST_DWithin (users.location, st_setsrid(st_makepoint (508560, 6155116), 2600), 100); </span></font><div><span style="font-size:12.8000001907349px"><font face="monospace, monospace"><br></font></span></div><div><span style="font-size:12.8000001907349px"><font face="monospace, monospace">-- Search inside a 100m circle for a point in longitude/latitude, projected into SRID=2600:</font></span></div><div><font face="monospace, monospace"><span style="font-size:12.8000001907349px">SELECT * FROM users</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">WHERE ST_DWithin (users.location, st_transform(st_setsrid(st_makepoint (24.1 55.5), 4326), 2600), 100); </span></font></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">(users.location SRID should be 2600 in these examples)</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Nicolas <br></span><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 March 2015 at 12:09, Aaron Lewis <span dir="ltr"><<a href="mailto:the.warl0ck.1989@gmail.com" target="_blank">the.warl0ck.1989@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>
I've been searching online for days. Trying to understand why SRID is<br>
required. So I picked some random value.<br>
<br>
Now I'm need to retrieve POINTs within a circle range, e.g a circle at<br>
(146.0, 138.19) with radius of 100 meters:<br>
<br>
SELECT * FROM users<br>
WHERE ST_DWithin (users.location, st_setsrid(st_makepoint (146.0,<br>
138.19), 2600), 100);<br>
<br>
It's very simple, but the result seems wrong. I have a record contains<br>
a POINT(55 43) that matches this query.<br>
<br>
Anyone know what's wrong with it?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Best Regards,<br>
Aaron Lewis - PGP: 0x13714D33 - <a href="http://pgp.mit.edu/" target="_blank">http://pgp.mit.edu/</a><br>
Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33<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>
</font></span></blockquote></div><br></div>