<div dir="ltr"><div>Hi all,<br><br></div><div>I am new to postgis and I am interested in finding all the points that are located at x metres or less of a polygon that are stored in my postgres database.<br></div><div>As I am working with data located all over the world and want to work with distances in metres I decided to use the geography type.<br><br></div><div>I am trying to understand why the following query returns 0 when the point is clearly not included in the polygon:<br><span class="gmail-message_body">SELECT 
ST_Distance(ST_GeographyFromText('SRID=4326;POINT(0. 
-82.)'),ST_GeographyFromText('SRID=4326;POLYGON((-90 -80, 90 -80, 90 10,
 -90 10, -90 -80))'));<br><br></span></div><div><span class="gmail-message_body">I suspect this has something to do with the polygon crossing the equator as <br></span><span class="gmail-message_body"><span class="gmail-message_body">SELECT 
ST_Distance(ST_GeographyFromText('SRID=4326;POINT(0. 
-82.)'),ST_GeographyFromText('SRID=4326;POLYGON((-90 -80, 90 -80, 90 
-10, -90 -10, -90 -80))'));</span></span></div><div>returns a plausible distance.<br><br></div><div>Would anybody know whether my polygon is violating some assumption or whether there is any other reason that I am getting those results?<br><br></div><div>Thanks<br><br></div><div>Sebastien<br></div><div><br></div><div><br></div><div><br></div><div><div><br><br clear="all"><br></div></div></div>