I have a recordset being pulled from a database. I have put these
onto a map and managed to offset the centre, as the design required.
I am now outputting the same recordset to a side bar and would like to
goto the marker for one the location clicked on in the sidebar.
I've tried various things I found online but to no avail. Any
suggestions would be gratefully welcome.
if (GBrowserIsCompatible()) {
function createMarker(point,html) {
var marker = new GMarker(point, icon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
GMap2.prototype.setShiftedCenter = function (NW, z, sh) {
var proj = this.getCurrentMapType().getProjection();
var px = proj.fromLatLngToPixel(NW, z);
var sePx = new GPoint(px.x + sh.width, px.y + sh.height);
var seLatLng = proj.fromPixelToLatLng(sePx, z);
this.setCenter(seLatLng, z);
}
var map = new GMap2(document.getElementById("map"));
var mapTypeControl = new GSmallMapControl;
var bottomRight = new
GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5, 5));
map.addControl(mapTypeControl, bottomRight);
map.setCenter(new GLatLng(0,0),0);
var bounds = new GLatLngBounds();
var icon = new GIcon();
icon.image = "/images/bbn/icons/marker.png";
icon.shadow = "/images/bbn/icons/shadow.png";
icon.iconSize = new GSize(16, 30);
icon.shadowSize = new GSize(36, 32);
icon.iconAnchor = new GPoint(25, 35);
icon.infoWindowAnchor = new GPoint(5, 1);
<%=markers%>
var tiltSwitch = bounds.getCenter();
var shift = new GSize(-200, 0)
var zoom = map.getBoundsZoomLevel(bounds);
var zoom = zoom-1;
map.setShiftedCenter(tiltSwitch, zoom, shift);
map.setZoom(map.getBoundsZoomLevel(bounds)-1);
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.