<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>
</p>
<div class="moz-text-plain" wrap="true" style="font-family:
-moz-fixed; font-size: 14px;" lang="x-unicode">
<pre class="moz-quote-pre" wrap="">Hi,
we found some unexpected results when doing spatial queries on very
large geography polygons. For example
SELECT ST_Distance(ST_SetSRID( ST_MakeBox2D(ST_Point(160,
60),ST_Point(-160,-60)), 4326)::geography,ST_SetSRID(ST_Point(0, 0),
4326)::geography)/1000
returns 13130km instead of 0 as the point 0,0 should be inside this polygon.
Queries on smaller search areas, or geometry queries return 0.
SELECT ST_Distance(ST_SetSRID( ST_MakeBox2D(ST_Point(60,
60),ST_Point(-60,-60)), 4326)::geography,ST_SetSRID(ST_Point(0,
0),4326)::geography)/1000
SELECT ST_Distance(ST_SetSRID( ST_MakeBox2D(ST_Point(160,
60),ST_Point(-160,-60)), 4326),ST_SetSRID(ST_Point(0, 0), 4326))/1000
It seems like PostGis switches inside/outside on geographies if they
exceed a certain size. Is this correct? Is there a way to control this
behaviour?
Greetings
Christian
</pre>
</div>
</body>
</html>