Our application finds a property and generates a "detail" page. On the
detail page we have a Google Map that places a marker at the lat / lng
of the property. I'm looking for the code that will center and zoom
the icon on the map at a certain zoom level. The code I'm currently
using uses a fixed zoom level and fixed center point. Our current code
is below:
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map2"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(41.263305, -96.052976), 9);
var minpriceList ="<?php echo "$minpriceList"; ?>";
var maxpriceList ="<?php echo "$maxpriceList"; ?>";
var bedList ="<?php echo "$bedList"; ?>";
var bathList ="<?php echo "$bathList"; ?>";
var garageList ="<?php echo "$garageList"; ?>";
var recordID ="<?php echo "$recordID"; ?>";
//GDownloadUrl("genxml-12-simple.php?bedList='"+bedList
+"'&bathList='"+bathList+"'&garageList='"+garageList
+"'&minpriceList='"+minpriceList+"'&maxpriceList='"+maxpriceList+"'",
function(data) {
GDownloadUrl("details-map.php?bedList="+bedList+"&bathList="+bathList
+"&garageList="+garageList+"&minpriceList="+minpriceList
+"&maxpriceList="+maxpriceList+"&recordID="+recordID+"",
function(data) {
var xml = GXml.parse(data);
var markers =
xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var mls_num = markers[i].getAttribute("mls_num");
var addr_num = markers[i].getAttribute("addr_num");
// var open_date_begin =
markers[i].getAttribute("open_date_begin");
var addr_dir = markers[i].getAttribute("addr_dir");
var addr_st = markers[i].getAttribute("addr_st");
var status = markers[i].getAttribute("status");
var list_price = markers[i].getAttribute("list_price");
var bed = markers[i].getAttribute("bed");
var bath = markers[i].getAttribute("bath");
var garage = markers[i].getAttribute("garage");
// var im_location =
markers[i].getAttribute("im_location");
var point = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, mls_num, addr_num,
addr_dir, addr_st, status, list_price, bed, bath, garage);
map.addOverlay(marker);
}
});
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---