ã¤ãã³ããµã¤ãçã§ä¼å ´ã®å°å³ãè¼ãã¾ãããã
ãããªæãè£ã®ã¡ã³ããã³ã¹ç»é¢ã§å°å³ã表示ããããã®æ å ±ãç»é²ããäºã«ãªãã¾ãããããã§ç·¯åº¦çµåº¦ãå ¥åãããããGoogleãããã§ä½æããiframeã¿ã°ãå ¥åãããã®ã¯ãããã«ãã£ãæªãã§ãã
ã¨ããããã§ãGoogle Maps JavaScript API v3ã使ç¨ãã¦ä½ç½®æ å ±ãåå¾ãã¾ãããã
æ¸ãã¦ãå 容ã¯å ¬å¼ãµã¤ãã®ãµã³ãã«ãã¡ããã£ã¨ããã£ãç¨åº¦ã§ããã©ãã
ç»é¢ãµã³ãã«
ã¯ãªãã¯ããå°ç¹ã®ç·¯åº¦ã¨çµåº¦ã®æ å ±ãããã¹ãã«è¡¨ç¤ºããã¾ãã
ã³ã¼ããµã³ãã«
ã³ã¼ãã«ã¤ãã¦ã¯ãããªæãã
@{ Layout = null; } <!DOCTYPE html> <html> <head> <title>ã¯ãªãã¯ãããä½ç½®ãåå¾ãã</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map-canvas { height: 500px; width: 500px; margin: 20px; padding: 20px; } </style> <script src="~/Scripts/jquery-1.10.2.js"></script> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> <script> $(function () { google.maps.event.addDomListener(window, 'load', initialize); function initialize() { var mapOptions = { zoom: 15, center: new google.maps.LatLng(Number($("#latitude").val()), Number($("#longitude").val())) }; var map = new google.maps.Map($("#map-canvas")[0], mapOptions); var marker = new google.maps.Marker({ position: map.getCenter(), map: map }); google.maps.event.addListener(map, 'click', function (e) { var loc = e.latLng; marker.setPosition(loc); $("#latitude").val(loc.lat()); $("#longitude").val(loc.lng()); }); } }); </script> </head> <body> <input id="latitude" type="text" value="33.8391574" /> <input id="longitude" type="text" value="132.76557520000006" /> <div id="map-canvas"></div> </body> </html>
ãã£ã¦ããã¨ã¯ã·ã³ãã«ã§ã
- å°å³ã緯度/çµåº¦ãæå®ãã¦åæåããå°å³ã®ä¸å¿ã«ãã¼ã«ã¼ãç½®ã
- å°å³ã®ã¯ãªãã¯ã¤ãã³ãã§ãã¼ã«ã¼ã®ä½ç½®ãã¯ãªãã¯ãããå°ç¹ã«ã»ããï¼ããã¹ãã«ç·¯åº¦çµåº¦æ å ±ã表示
ãã£ãããã ãã§ããã©ãJavaScriptã©ç´ 人ã«ã¯ãªããªãã»ã»ã»