좌표 세트를 입력하고 Google지도에 위치를 표시하려면 어떻게해야합니까? 이 모든 자바 스크립트를 통해 수행 할 수 있습니다 : 어떤 도움에 감사드립니다위치 표시 위도/경도 좌표 사용 - Google지도
(즉, 어떤 사용자 인터페이스)
좌표 세트를 입력하고 Google지도에 위치를 표시하려면 어떻게해야합니까? 이 모든 자바 스크립트를 통해 수행 할 수 있습니다 : 어떤 도움에 감사드립니다위치 표시 위도/경도 좌표 사용 - Google지도
(즉, 어떤 사용자 인터페이스)
참고 : 이미 위도/경도가있는 경우 Alteveer’s answer을 참조하십시오.
위도/경도를 가져 오려면 Geolocation 서비스를 사용해야합니다. -> http://stackoverflow.com/questions/
<!-- Placeholder for the Google Map -->
<div id="map" style="height: 512px;">
<noscript>
<!-- http://code.google.com/apis/maps/documentation/staticmaps/ -->
<img src="http://maps.google.com/maps/api/staticmap?center=1%20infinite%20loop%20cupertino%20ca%2095014&zoom=16&size=512x512&maptype=roadmap&sensor=false" />
</noscript>
</div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
// Define the address we want to map.
var address = "1 infinite loop cupertino ca 95014";
// Create a new Geocoder
var geocoder = new google.maps.Geocoder();
// Locate the address using the Geocoder.
geocoder.geocode({ "address": address }, function(results, status) {
// If the Geocoding was successful
if (status == google.maps.GeocoderStatus.OK) {
// Create a Google Map at the latitude/longitude returned by the Geocoder.
var myOptions = {
zoom: 16,
center: results[0].geometry.location,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
// Add a marker at the address.
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
try {
console.error("Geocode was not successful for the following reason: " + status);
} catch(e) {}
}
});
</script>
묻는 것보다 다른 질문. 질문 사항 : LATITUDE/LONGITUDE가 주어지면지도 또는지도에 마커가 표시됩니다. 이 대답은 : 주소가 주어지면지도에 마커를 표시합니다. ** 이미 위도/경도가 ** 인 경우 마커를 표시하려면 '// 주소에서 마커 추가'아래의 행을 참조하십시오. 또는 새지도를 열려면 [Alteveer 's answer] (https://stackoverflow.com/a/7135770/199364)를 참조하십시오. – ToolmakerSteve
좋은 지적입니다, 스티브. (죄송합니다!)이 답변에 대한 메모를 추가했습니다. – Jim
당신은 위도와지도를 초기화 할 수 있어야한다/경도를 다음과 같이 https://developers.google.com/maps/documentation/javascript/tutorial#MapOptions
나는 같은 요청했습니다 그리고 그들은 대답 여기에 그것을 사용하는 방법의 예 http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
: Google지도 하나가 내장되어 8766116/how-can-i-get-xy-number-at-click-on-google-maps – SamekaTV
@SamekaTV -이 링크는 반대의 목표입니다 (지도를 클릭하고 경도/위도를 다시 얻음). 이 질문은 알려진 경도/위도, 해당 위치의지도 표시 방법을 제공합니다. (또는 어쩌면 shahmeer는 이미 열려있는지도에서 해당 위치에 마커를 표시하는 방법과 관련된 질문을하고있었습니다.) – ToolmakerSteve
자세한 블로그 : http://sforsuresh.in/display-google-map-locations-/위도 - 경도 위도/ –