我目前正在使用geoXML3工具在Google地图上放置自定义标记。我对它的工作方式非常满意,并且可以轻松生成KML并在地图上显示标记。
由于我的标记是自定义的,因此每个标记的“原点”不一定相同。有没有办法用KML指定当标记放在地图上时用作原点的像素位置?
例如,我的所有自定义标记都是32x32 PNG。但是,实际可见的图像是8x24,以32x32区域为中心。我希望这个标记的原点是(16,28),这样我的可见图像的底部就会放在KML Placemark属性中指定的点上。
有什么想法吗?
答案 0 :(得分:3)
在KML中定义该方法的方法是使用hotspot tag
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction">
Specifies the position within the Icon that is "anchored" to the <Point> specified in the Placemark. The x and y values can be specified in three different ways: as pixels ("pixels"), as fractions of the icon ("fraction"), or as inset pixels ("insetPixels"), which is an offset in pixels from the upper right corner of the icon. The x and y positions can be specified in different ways—for example, x can be in pixels and y can be a fraction. The origin of the coordinate system is in the lower left corner of the icon.
x - Either the number of pixels, a fractional component of the icon, or a pixel inset indicating the x component of a point on the icon.
y - Either the number of pixels, a fractional component of the icon, or a pixel inset indicating the y component of a point on the icon.
xunits - Units in which the x value is specified. A value of fraction indicates the x value is a fraction of the icon. A value of pixels indicates the x value in pixels. A value of insetPixels indicates the indent from the right edge of the icon.
yunits - Units in which the y value is specified. A value of fraction indicates the y value is a fraction of the icon. A value of pixels indicates the y value in pixels. A value of insetPixels indicates the indent from the top edge of the icon.