longitude latitude

280 views
Skip to first unread message

stickleback

unread,
Sep 7, 2010, 6:08:18 AM9/7/10
to google-earth-...@googlegroups.com
Hello - Noob here!

I have managed to add the code to my website to display a sat image in a div - all well and good I thought.

I went into Google Earth and set a placemark on the location I want to direct people to and took the long/lat coordinates - they are 36º 30' 23,49"N and 4º 54' 33,30 W

Then I went back into my website and added the following locator code:

map.setCenter(new GLatLng(36.302349, 4.543330), 13);

but when I open the page I go to somewhere in the ocean! I'm close to where I should be - but maybe 500km off!

Can someone suggest where I've gone wrong - it looked to simple (I suspect it has something to do with the N and W settings on the long/lat coordinates, but don't know exactly what....

Thanks in advance for any hep you can give....
Message has been deleted

Nymor

unread,
Sep 7, 2010, 12:23:48 PM9/7/10
to KML Developer Support - Google Earth Plug-in
Hi,

Would look to me like your conversion from DegMinSec to Decimal
Degrees is not right.

36º 30' 23,49"N != 36.302349 &
4º 54' 33,30 W != 4.543330

To get the correct conversion either use a site like
http://www.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html or
alternatively save a placemark in GE with your options set to Degrees,
Minutes and Seconds (Tools Options, 3D View, Show Lat/Long) and either
save the kml and view in a text editor (kml is always saved as Decimal
Degrees) or switch your Show Lat/Long settings to Decimal Degrees and
edit the placemark again to see the converted numbers.

36º 30' 23,49"N = 36.506525 &
4º 54' 33,30 W = 4.90925

Hope that helps.
Nymor

stickleback

unread,
Sep 9, 2010, 7:48:35 AM9/9/10
to KML Developer Support - Google Earth Plug-in
Hi Nymor,

Thanks for the reply. I thought that was it - but I'm still not at the
right place

here's what I have in my source code:

  //  function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("googearth"));
        map.setCenter(new GLatLng(36.506452, 4.909171), 13);
map.setMapType(G_SATELLITE_MAP);
        map.setUIToDefault();
//

and here's the text from the kml file:

<LookAt>
<longitude>-4.909171219131276</longitude>
<latitude>36.50645211256087</latitude>
<altitude>0</altitude>
<range>42.38275985081645</range>
<tilt>14.40940560661057</tilt>
<heading>-0.01268262848747473</heading>
<altitudeMode>relativeToGround</altitudeMode>
<gx:altitudeMode>relativeToSeaFloor</

but the web page is still going to a place in north africa instrad of
southern Spain

I can't see where I'm going wrong - apologies.....

Grok Lobster

unread,
Sep 9, 2010, 10:40:09 AM9/9/10
to google-earth-...@googlegroups.com
Try -4.909171

stickleback

unread,
Sep 9, 2010, 11:42:08 AM9/9/10
to KML Developer Support - Google Earth Plug-in
Thank you so much - I feel really stupid - there is was right in front
of my eyes! Now working perfectly....

But hey - it's not the first time and I know it's not going to be the
last....

On Sep 9, 4:40 pm, Grok Lobster wrote:
> Try -4.909171

Nymor

unread,
Sep 9, 2010, 6:11:44 PM9/9/10
to KML Developer Support - Google Earth Plug-in
> Thank you so much - I feel really stupid - there is was right in front
> of my eyes! Now working perfectly....

It's always the way - glad you got it sorted :)

Nymor
Reply all
Reply to author
Forward
0 new messages