Gmap3 places pin in wrong place after refresh

613 Views Asked by At

I have a very strange problem.

Using Gmap3, I place the pin on the map and save its coordinates in a database. After a refresh, I give the same coordinates to Gmap3 to place the pin on the map. The problem here is that the pin is positioned on the same coordinates, but now these coordinates are in different position on the map.

Example: If I place the pin near Moscow, Russia, after a refresh, the pin is placed near Afghanistan...

First I`m loading pins from here http://bghelpmap.com/listPins.php

And i use this before add them to the map:

var bghMarkers = [];

            $.each(ttt, function(i, tmp){
                bghMarkers.push({
                    lat: tmp.lat,
                    lng: tmp.lng,
                    options: { icon:new google.maps.MarkerImage("http://www.bghelpmap.com/images/pin"+tmp.pinType+".png") },
                    data: tmp
                });
            });

After this i am useing setMyMarkers() from file http://bghelpmap.com/js/default.js The function is long, so i`m not posting it here.

Any suggestions?

1

There are 1 best solutions below

1
On BEST ANSWER

It looks like you might be switching latitudes and longitudes when you store/retrieve the coordinates in your database.

Moscow is at roughly (55.747, 37.628) http://maps.google.com/maps?q=55.747,%2037.628&z=5

(33.628, 55.747) is somewhere in the middle east. http://maps.google.com/maps?q=37.628,%2055.747&z=5