[OpenLayers-Dev] Vector layer marker drifting with Google base map
Sean Gillies
sgillies at frii.com
Wed Sep 17 22:41:42 EDT 2008
Hi all,
I'm trying to overlay a point vector layer symbolized with drop shadow
markers over a base Google layer. Things look fine, the marker is where
I expect it, until I pan and then the position of the marker begins to
drift approximately half height of the marker in the panning direction.
I'm using the javascript served from openlayers.org/api/OpenLayers.js.
Known bug? Programmer error? Script below:
<script type="text/javascript">
var map, base, marker, coords;
var SHADOW_Z_INDEX = 10;
var MARKER_Z_INDEX = 11;
function init() {
map = new OpenLayers.Map('map');
base = new OpenLayers.Layer.Google(
"Base", {
isBaseLayer: true,
type: G_PHYSICAL_MAP,
}
);
marker = new OpenLayers.Layer.Vector(
"Marker",
{
styleMap: new OpenLayers.StyleMap({
externalGraphic:
"http://openlayers.org/dev/img/marker-gold.png",
backgroundGraphic:
"http://openlayers.org/dev/examples/marker_shadow.png",
backgroundXOffset: 0,
backgroundYOffset: -7,
graphicZIndex: MARKER_Z_INDEX,
backgroundGraphicZIndex: SHADOW_Z_INDEX,
pointRadius: 10
}),
reproject: true,
isBaseLayer: false,
projection
rendererOptions: {yOrdering: true}
}
);
coords = pleiades_oljs.centroid.coordinates;
map.addLayers([base, marker]);
map.setCenter(new OpenLayers.LonLat(coords[0], coords[1]), 5);
marker.features.push(
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(coords[0], coords[1])
)
);
}
</script>
I'm grateful for any suggestions.
Sean
More information about the Dev
mailing list