Har*_*M V 1 google-maps google-maps-api-3 google-maps-markers
我在Google地图中插入自定义标记,但未在地图上准确指向.我认为这主要是因为标记的指向边缘的设计.
是否有关于如何制作自定义标记的指南?
我使用以下lib:http://hpneo.github.com/gmaps/

// JavaScript Document
$(document).ready(function () {
var map = new GMaps({
div: '#map',
lat: 13.00487,
lng: 77.576729,
zoom: 13,
});
map.addControl({
position: 'top_right',
text: 'Geolocate',
style: {
margin: '5px',
padding: '1px 6px',
border: 'solid 1px #717B87',
background: '#fff'
},
events: {
click: function () {
GMaps.geolocate({
success: function (position) {
map.setCenter(position.coords.latitude, position.coords.longitude);
},
error: function (error) {
alert('Geolocation failed: ' + error.message);
},
not_supported: function () {
alert("Your browser does not support geolocation");
}
});
}
}
});
map.addMarker({
lat: 13.00487,
lng: 77.576729,
title: 'Lima',
icon: "http://i.imgur.com/3YJ8z.png",
infoWindow: {
content: '<p>HTML Content</p>'
}
});
});
Run Code Online (Sandbox Code Playgroud)
你可能想要的是这样的:
var image = new google.maps.MarkerImage(
'http://i.imgur.com/3YJ8z.png',
new google.maps.Size(19,25), // size of the image
new google.maps.Point(0,0), // origin, in this case top-left corner
new google.maps.Point(9, 25) // anchor, i.e. the point half-way along the bottom of the image
);
map.addMarker({
lat: 13.00487,
lng: 77.576729,
title: 'Lima',
icon: image,
infoWindow: {
content: '<p>HTML Content</p>'
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17867 次 |
| 最近记录: |