如何在网站上显示地图上的多个纬度和经度 [英] How to show multiple latitudes and longitudes on map in website

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

问题描述

我有一个要求,就像我有超过300个纬度和经度。我需要的是将这些纬度和经度指向地图。任何人都可以帮助我解决这个问题。



到目前为止,我已经搜索谷歌和SO,但一切都在PHP,Python和其他,但我需要它在jQuery或C#或XSLT。任何帮助都将是可观的。



请不要downvote,我是新的工作在地图..

解决方案

查看 jVectorMap jQuery Mapael 。或者,如果您真的想使用Google地图,请尝试以下JSFiddle: http://jsfiddle.net/yV6xv/2987 。代码应该如下所示:

 < html> 
< head>
< link rel =stylesheettype =text / csshref =mystyle.css>
< title =Hello>< / title>
< script type =text / javascriptsrc =http://maps.googleapis.com/maps/api/js?sensor=false>< / script>
< script type =text / javascript>
函数initialize(){

var locations = [
[1.37265,103.893658],
[1.400617,103.907833],
[1.346002,103.825436] ,
[1.352051,103.849125],
[1.251226,103.830757]
];

var map = new google.maps.Map(document.getElementById('map'),{
zoom:11,
center:new google.maps.LatLng(1.37265 ,103.893658),
mapTypeId:google.maps.MapTypeId.ROADMAP
});

var infowindow = new google.maps.InfoWindow();

var marker,i;

(i = 0; i< locations.length; i ++){
marker = new google.maps.Marker({
position:new google.maps.LatLng (位置[i] [0],位置[i] [1]),
map:map
});
}
}
google.maps.event.addDomListener(window,'load',initialize);
< / script>
< / head>
< body>
<! - CHECK ELEMENT ID也会更新CSS - >
< div id =map>< / div>
< / body>
< / html>


I have a requirement like I have more than 300 latitudes and longitudes.All i need is to point these latitudes and longitudes in map.Can anybody out there help me fix this.

So far i have searched google and SO,but everything is in php,python and others, but i need it in jquery or c# or xslt. Any help would be appreciable.

Please dont downvote, I am new to work in maps..

解决方案

Have a look at jVectorMap or jQuery Mapael. Or if you would really like to use Google Maps, try this JSFiddle: http://jsfiddle.net/yV6xv/2987. The code should look like this:

   <html>
    <head>
        <link rel="stylesheet" type="text/css" href="mystyle.css">
        <title="Hello"></title>
        <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript">
        function initialize() {

            var locations = [
                [1.37265, 103.893658],
                [1.400617, 103.907833],
                [1.346002, 103.825436],
                [1.352051, 103.849125],
                [1.251226, 103.830757]
                ];

            var map = new google.maps.Map(document.getElementById('map'), {
                zoom: 11,
                center: new google.maps.LatLng(1.37265, 103.893658),
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });

            var infowindow = new google.maps.InfoWindow();

            var marker, i;

            for (i = 0; i < locations.length; i++) {
                marker = new google.maps.Marker({
                    position: new google.maps.LatLng(locations[i][0], locations[i][1]),
                    map: map
                });
            }                                                            
        }
        google.maps.event.addDomListener(window, 'load', initialize);
    </script>
    </head>
    <body>
        <!-- CHECK ELEMENT ID also UPDATE CSS -->
        <div id="map"></div>
    </body>
</html>

这篇关于如何在网站上显示地图上的多个纬度和经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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