나는 집 (top view, 3d 모델처럼 보임)의 단순한 이미지를 가지고 있으며이 집이 서있는 장소 (로드맵)에이 집 그림을 배치하고 싶습니다. This is an example of what I want. 하지만 위치에 큰 문제가 있습니다. 이미지를 올바르게 놓을 수 없습니다. 찢어 지거나 떨어져 있습니다 (an example of what I got). 오버레이에 대한 모든 문서를 읽었지만이 작업을 수행하는 방법을 모르겠다. 어쩌면 누군가가 나에게 지시하거나 방향을 제시 할 방법을 말해 줄 수있을 것이다. 코드의Api v3를 사용하여 Google Map에 이미지를 넣는 방법은 무엇입니까?
예 :
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Ground Overlays</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var Overlay;
function initialize() {
var house = new google.maps.LatLng(55.734907, 37.571526);
var imageBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(55.734603,37.571374),
new google.maps.LatLng(55.734944,37.572097),
new google.maps.LatLng(55.735032,37.571221),
new google.maps.LatLng(55.735201,37.570343),
new google.maps.LatLng(55.735218,37.570840),
new google.maps.LatLng(55.735238,37.571670),
new google.maps.LatLng(55.735423,37.571147),
new google.maps.LatLng(55.735551,37.570891)
);
var mapOptions = {
zoom: 17,
center: house,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
Overlay = new google.maps.GroundOverlay(
'file:///home/map_top.png',
imageBounds);
Overlay.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
문제가 귀하의 범위 일 수 있습니다. SouthWest와 사각형의 NorthEst 모서리 두 점만 사용하십시오. 'LatLngBounds (sw? : LatLng, ne : LatLng) ' 올바른 위치에 도달 할 때까지이 점 (sw) 중 하나를 변경해보세요. – sabotero
좋아요, 답장을 보내 주셔서 감사합니다. 그러나 제가 원하는 것에 다 다른 방법이 있습니까? 이런 흥미로운 것을 만든 사람들 (첫 번째 예)이 다른 방법을 사용했을 수도 있습니까? – user2596615
_map_top.png_ 이미지를 업로드하여 무언가를 시도하십시오 – sabotero