Google Map经纬度 [英] Google Map longitude and latitude

查看:203
本文介绍了Google Map经纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Google地图中的某个地方留下痕迹。
但是我觉得Google Map的标记并不准确。例如,让我们尝试在Google Map中使用Marker的白宫。
基于Google地球,白宫位于38°53'51.54N和77°2'8.40W。

我将其转换为北纬38.535154和经度-77.2840



所以我创建了这段代码:

  var company = new google.maps.LatLng(38.535154,-77.2840); 
var marker;
var map;

函数initialize(){
var latlng = new google.maps.LatLng(38.535154,-77.2840);
var myOptions = {
zoom:8,
center:latlng,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById(map_canvas),
myOptions);

marker = new google.maps.Marker({
map:map,
draggable:true,
animation:google.maps.Animation.DROP,
职位:公司
});
google.maps.event.addListener(标记,'click',toggleBounce);


$ / code>

然而,在我打开我的浏览器之后,我的标记位于华盛顿西南部。



所以我的问题是:


  1. Google地图是否有纬度&经度有点偏离(不与
    谷歌地球同步),或者我的转换或我的
    代码有什么问题吗?


  2. 如果让Google Earth Long& Lat是错误的,是否有
    的方式可以直接从Google Map中获取经度和纬度?

  3. >解决方案

您的转换不正确。一度是60分钟,一分钟是60秒。所以38°53'51.54N是38°+ 53/60 + 51.54°/ 3600°,结果是38,89765°,而不是38.535154°。经度也一样。

I'm trying to give a mark over a certain place in Google Map. However I feel that the marker of the Google Map is not accurate.

For example, let's try put White House using Marker in Google Map. Based on Google Earth, White House is in 38°53'51.54"N and 77° 2'8.40"W.

I convert it to latitude 38.535154 and longitude -77.2840

So I created this code:

var company = new google.maps.LatLng(38.535154,  -77.2840);
  var marker;
  var map;

  function initialize() {
    var latlng = new google.maps.LatLng(38.535154,  -77.2840);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);

    marker = new google.maps.Marker({
        map:map,
        draggable:true,
        animation: google.maps.Animation.DROP,
        position: company
      });
      google.maps.event.addListener(marker, 'click', toggleBounce);

  }

However, after I open my browser, my marker is in South West of Washington.

So my questions are :

  1. Is Google Maps latitude & longitude is a bit off ( not in sync with Google Earth ) or is there anything wrong with my conversion or my code ?

  2. If let say the Google Earth Long & Lat is the wrong one, is there a way to know longitude and latitude directly from Google Map?

解决方案

Your convertion is not right. One degree is 60 minutes and one minute is 60 seconds. So 38°53'51.54"N is 38 degrees + 53/60 + 51.54/3600 degrees. And the result is 38,89765°, not 38.535154° The same applies to the longitude.

这篇关于Google Map经纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆