Javascript 如何通过传单js加载特定国家/地区的地图

Javascript 如何通过传单js加载特定国家/地区的地图,javascript,leaflet,Javascript,Leaflet,这里我得到了一个示例代码,显示了相同的情况,但我想知道从哪里为任何特定的国家或城市安排lat lang 这是伦敦的地图 var london = new L.LatLng(51.505, -0.09); map.setView(london, 13); 因此,如果有人知道特定国家的LatLng,那么这是可能的。但只要告诉我是否有来源告诉我任何国家或城市的拉特朗 下面是完整的示例代码 另一个代码 谢谢试试谷歌。如果你只想知道任何国家或城市的地址,你就可以通过它获得地址的LatLng。 例如,你

这里我得到了一个示例代码,显示了相同的情况,但我想知道从哪里为任何特定的国家或城市安排lat lang

这是伦敦的地图

var london = new L.LatLng(51.505, -0.09); 
map.setView(london, 13);
因此,如果有人知道特定国家的LatLng,那么这是可能的。但只要告诉我是否有来源告诉我任何国家或城市的拉特朗

下面是完整的示例代码 另一个代码
谢谢

试试谷歌。如果你只想知道任何国家或城市的地址,你就可以通过它获得地址的LatLng。

例如,你想知道澳大利亚的拉丁语,只需在谷歌上输入即可

澳大利亚像下面一样长


你的问题是什么?代码是什么?代码给出了如何加载特定于伦敦的地图,但如果我不知道任何特定于国家的latlang,那么我想知道是否有任何网站可以告诉我国家或任何城市的latlang?我去了那里,但不明白如何请求国家或城市名称方面的LatLng。你能提出一个样品要求吗?谢谢
<html>
<head>
   <title>Leaflet Events Example</title>

   <link rel="stylesheet" href="leaflet/leaflet.css" />
   <!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet.ie.css" /><![endif]-->

   <script src="leaflet/leaflet.js"></script>

   <script language="javascript">
      var map;
      var popup = L.popup();

      function init() {

         map = new L.Map('map');
         popup = new L.Popup();

         L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
            maxZoom: 18
         }).addTo(map);
         map.attributionControl.setPrefix(''); // Don't show the 'Powered by Leaflet' text.

         var london = new L.LatLng(51.505, -0.09); 
         map.setView(london, 13);


         map.on('click', onMapClick);
      }

      //Listener function taking an event object 
      function onMapClick(e) {
         //map click event object (e) has latlng property which is a location at which the click occured.
         popup
           .setLatLng(e.latlng)
           .setContent("You clicked the map at " + e.latlng.toString())
           .openOn(map);
      }

   </script>

</head>
<body onLoad="javascript:init();">
   <div id="map" style="height: 200px"></div> <!-- width equals available horizontal space by default -->

</body>                                                                                                                          
</html>
<html>
<head>
   <title>Leaflet marker array example</title>

   <link rel="stylesheet" href="leaflet/leaflet.css" />
   <!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet.ie.css" /><![endif]-->

   <script src="leaflet/leaflet.js"></script>

   <script language="javascript">
      function init() {
         var map = new L.Map('map');                       

         L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
            maxZoom: 18
         }).addTo(map);
         map.attributionControl.setPrefix(''); // Don't show the 'Powered by Leaflet' text.

         var london = new L.LatLng(51.5056,-0.1213); 
         map.setView(london, 13);

         // Define an array. This could be done in a seperate js file.
         // This tidy formatted section could even be generated by a server-side script
         // or fetched seperately as a jsonp request.
         var markers = [
            [ -0.1244324, 51.5006728, "Big Ben" ],
            [ -0.119623, 51.503308, "London Eye" ],
            [ -0.1279688, 51.5077286, "Nelson's Column<br><a href=\"https://en.wikipedia.org/wiki/Nelson's_Column\">wp</a>" ] 
         ];

         //Loop through the markers array
         for (var i=0; i<markers.length; i++) {

            var lon = markers[i][0];
            var lat = markers[i][1];
            var popupText = markers[i][2];

             var markerLocation = new L.LatLng(lat, lon);
             var marker = new L.Marker(markerLocation);
             map.addLayer(marker);

             marker.bindPopup(popupText);
         }
     }
   </script>
</head>
<body onLoad="javascript:init();">
   <div id="map" style="height: 200px"></div>

</body>                                                                            
</html>