[postgis-users] maps google problem with SRID

lisek lichu lisek.lichu at gmail.com
Wed Nov 26 16:23:16 PST 2008


Hello,

I'm new with this but try to read and understand as much as i can but I need
some basics informations.

I have few questions regarding last few e-mails about SRID 4326 and 900913

I also add an information to a spatial_ref_sys table about SRID 900913

*question 1:*

When I use maps.google API interface to get lat and lon coordinates in which
SRID i get them?

this is my example:
GEvent.addListener(map, 'click',
   function(overlay, point)
   {
      alert("lat = " + point.y + " lon = " + point.x);
   }
 );

*question 2:*

I always used SRID 4326 for storing data from maps.google (right now i need
an answer for question number 1)
But how can i count distance between two points i my database?

I read that i need to convert my projection to a meters projection so i
started to looking for some info and i found that google projection is
900913 and it is in meters so ok.
but...

I create some example in my database

select AsText(ST_Transform(GeomFromText('POINT(*90 0*)',4326),900913));

(point 90 0 is on equator)
and i get:

POINT(*10018754.1713946* -7.08115455161362e-010)

so we know that equator has 40075km and 360 degrees so after I multiply *
10018754.1713946*m by *4* I get *40075016.68*m so it is correct.

select AsText(ST_Transform(GeomFromText('POINT(*0 45*)',4326),900913));

i get

POINT(0 5621521.48619207)

we know that meridians have about *20 003*km (only 180 degrees) so if we
multiply *5621521.48619207*m by *4* we get *22486058.94*m hmmmmm so it is
too much. Why?


*question 3:*

What is the best solution to keep in PostgreSQL with PostGIS database data
from maps.google.com and what is the best solution to display them.

*question 4:*

last one, how we can measure distance between two points from our database
if we keep points in 4326 SRID?


I know that it is a lot but for good start I need (and i think also others)
these information.

Thanks a lot for detailed answering.

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081127/fd7fcc0e/attachment.html>


More information about the postgis-users mailing list