[postgis-users] Problem with SRIDs

Aurélien FILEZ kinju59 at gmail.com
Mon Aug 22 03:43:41 PDT 2011


Hi all,

I've imported geographic data of a region between France, Spain and Andorra.
The SRID is 900913 and the coords looks like that :

"POINT(159254.030883177 5404632.29913214)"

I can retreive the lati/longi by transforming this geometry like this :

SELECT St_AsText(St_Transform(myPoint, 4326));

Which give me the point :

"POINT(1.4306033 43.6057492)"

With shp2pgsql, I've imported world borders (with SRID 900913). France
contains some polygons like this :

"POLYGON((-3.576667 48.803886,-3.582222 48.803886,-3.582778
48.80722,-3.579722 48.809715,-3.575556 48.812492,-3.570834
48.812775,-3.565278 48.811661,-3.563334 48.808609,-3.566112
48.805832,-3.576667 48.803886))"

And when I transform it to SRID 4326, I obtain this :

"POLYGON((-3.21297463230592e-005 0.000438412767172082,-3.2179647737092e-005
0.000438412767172082,-3.21846423700717e-005
0.000438442717005185,-3.2157189854989e-005
0.000438465129979636,-3.21197660402526e-005
0.000438490076189558,-3.20773475925365e-005
0.000438492618419637,-3.20274371953508e-005
0.000438482611185999,-3.20099739462275e-005
0.000438455194601089,-3.20349291448203e-005
0.000438430248391167,-3.21297463230592e-005 0.000438412767172082))"

Why the france borders coords at SRID 900913 does not have the same type of
numbers than the data coords ? I mean for the +/- the same geographic zone
and with the same SRID, I have my data which have a longitude of about
159254 and in the borders -3.576667..

The goal is to know in which country is a point. I made a query like this :
SELECT country_name FROM world_borders b WHERE St_Contains(geom, myPoint) =
TRUE;
This does not work (no result).

I tried another query :
SELECT country_name FROM world_borders b WHERE
St_Contains(St_Transform(geom, 4326), St_Transform(myPoint, 4326)) = TRUE
Thos works but take a very long time to execute.

Why it does not work with both SRID 900913 but it works with both SRID 4326
?

Thank you very much :)
Kin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110822/14387729/attachment.html>


More information about the postgis-users mailing list