谷歌地图API:标记形象定位 [英] Google maps API: Marker image positioning
本文介绍了谷歌地图API:标记形象定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我变了,我用了标记
谷歌地图的图像。新的图像比旧的更广泛的,我已经注意到,该标记与经纬度
和 LNG对齐
使标志在于它的水平中点在经纬度
和 LNG
。这不是我想要的,我想有经纬度
和 LNG
与左侧的标记对齐 - 我想约80px到右侧,以抵消标记
从默认位置。
I have changed the image that I use for a marker
on Google maps. The new image is much wider than the old one and I have noticed that the marker is aligned with the lat
and lng
so that the marker rests with it's horizontal midpoint over the lat
and lng
. This is not what I want, I want to have the lat
and lng
aligned with the markers left hand side - I want to offset the marker
from the default position by about 80px to the right.
推荐答案
试试这个关于大小。
var markerImage = new google.maps.MarkerImage('/img/icon/here.png',
new google.maps.Size(80, 80), //size
new google.maps.Point(0, 0), //origin point
new google.maps.Point(0, 80)); // offset point
marker[stamp] = new google.maps.Marker({
position: loc, // loc is a variable with my lngLat object
title: params.name,
map: window.gMaps[params.map],
icon: markerImage
});
这篇关于谷歌地图API:标记形象定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文