Hi,
The attached code is used to add a marker on the client side on a google map overlay
I have the projection set up correctly at the server side for the google maps and at the server side if I add a marker at the server side its positioning fine
How do I set the marker to a decimal degrees lat long location i,e, 53.2, -2 .2222 at the client side.
I have tried this but it doesn't give me whats expected
var point = new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat);
var srcProj = new OpenLayers.Projection('EPSG:900913');
var desProj = new OpenLayers.Projection('EPSG:4326');
var newPoint = OpenLayers.Projection.transform(point, srcProj, desProj);
Liam
var markerURL = 'localhost/sample.UI/i/lift_map.png';
var markerWidth = 16;
var markerHeight = 16;
var markerOffsetX = -20;
var markerOffsetY = -20;
var cloneLiftClientMarker = false;
var markerClientLayer = null;
function showMarkerOnMap(id, lat, long) {
var vehMap = Map1.GetOpenLayersMap();
if (markerClientLayer == null) {
markerClientLayer = new OpenLayers.Layer.Markers('Markers');
markerClientLayer.Id = 'Markers';
vehMap.addLayer(markerClientLayer);
}
var size = new OpenLayers.Size(markerWidth, markerHeight);
var offset = new OpenLayers.Pixel(markerOffsetX, markerOffsetY);
var icon = new OpenLayers.Icon(markerURL, size, offset);
// Move the map to the new marker to hightlight it
Map1.PanToWorldCoordinate(long, lat)
var newMarker = new OpenLayers.Marker(new OpenLayers.LonLat(long, lat));
newMarker.Id = id;
newMarker.icon = icon;
if (cloneLiftClientMarker == false) {
markerClientLayer.addMarker(newMarker, icon);
}
else {
markerClientLayer.addMarker(newMarker, icon.clone());
}
}