地图上特定地点的经度和纬度 [英] latitude and longitude of particular place on map

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

问题描述

大家好...
我想在Google地图上显示特定地点的纬度和经度...
表示当我单击位置A时,纬度和经度将显示在infoWindow中...
当我单击位置B时,纬度和经度将显示在infoWindow中...
请帮我...我该怎么做...

寻求帮助!!!!

解决方案

http://stackoverflow.com/questions/3151450/google-geolocation-api-use-longitude-and-latitude-get-address [ http://stackoverflow. com/questions/3490622/get-latitude-and-longitude-based-on-location-name-google-maps-api?lq = 1 [ < html > ; < 头部 > < 脚本 =" https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" 类型 文本/javascript" < > < 脚本 =" 文本/javascript" src http ://maps.googleapis.com/maps/api/js?sensor = true" < ; /script > < 脚本 语言 JavaScript" src http://j.maxmind.com/app/geoip.js"> < /script > < 脚本 =" 文本/javascript"


('#latitude').val(items [0] .geometry.location.lat().toString() .substr(0,12));


hello all...
i want to show latitude and longitude of particular place on google map...
mean when i click on place A ,latitude and longitude will be shown in infoWindow...
and when i click on place B ,latitude and longitude will be shown in infoWindow...
plz help me...how i can do this...

Thnks for help !!!!

解决方案

http://www.brighthub.com/internet/web-development/articles/5874.aspx[^]
http://stackoverflow.com/questions/3151450/google-geolocation-api-use-longitude-and-latitude-to-get-address[^]
http://stackoverflow.com/questions/3490622/get-latitude-and-longitude-based-on-location-name-google-maps-api?lq=1[^]


Try..

<html>
<head>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
 <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
<script type="text/javascript">

  var  geocoder = new google.maps.Geocoder();
 var infowindow = new google.maps.InfoWindow();
var latlang=new google.maps.LatLng(geoip_latitude(), geoip_longitude());
  function initialize()
  {
      var myOptions = {
      center: latlang,
      zoom: 5,
      mapTypeId: google.maps.MapTypeId.ROADMAP

    };
    var map = new google.maps.Map(document.getElementById("map"), myOptions);
 geocoder.geocode({ 'latLng': latlang }, function (items, status) {

                    if (status == google.maps.GeocoderStatus.OK) {

                        map.setZoom(8);

                       var marker = new google.maps.Marker({
                            position: latlang ,
                            map: map
                        });

                     infowindow.setContent(items[1].formatted_address);
                         google.maps.event.addListener(marker, 'click', function () {


                infowindow.open(map, this);
                map.setZoom(8);
            });
                    }

                });
google.maps.event.addListener(map, 'click', function (event) {

                geocoder.geocode({ 'latLng': event.latLng }, function (items, status) {

                    if (status == google.maps.GeocoderStatus.OK) {


('#latitude').val(items[0].geometry.location.lat().toString().substr(0, 12));


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

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