Eric. Thank You! After some fiddling, i got it.
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
// ==== It is necessary to make a setCenter call of some description
before adding markers ====
// ==== At this point we dont know the real values ====
// map.setCenter(new GLatLng(0,0),0);
// ===== Start with an empty GLatLngBounds object =====
var bounds = new GLatLngBounds();
var startIcon = new GIcon();
startIcon.image =
"http://maps.gstatic.com/intl/en_us/mapfiles/ms/micons/red.png";
startIcon.shadow =
"http://maps.gstatic.com/intl/en_us/mapfiles/ms/micons/msmarker.shadow.png";
startIcon.iconSize = new GSize(32, 32);
startIcon.shadowSize = new GSize(59, 32);
startIcon.iconAnchor = new GPoint(32, 32);
startIcon.infoWindowAnchor = new GPoint(5, 1);
var partnerIcon = new GIcon();
partnerIcon.image =
"http://maps.gstatic.com/intl/en_us/mapfiles/ms/micons/green-dot.png";
partnerIcon.shadow =
"http://maps.gstatic.com/intl/en_us/mapfiles/ms/micons/msmarker.shadow.png";
partnerIcon.iconSize = new GSize(32, 32);
partnerIcon.shadowSize = new GSize(59, 32);
partnerIcon.iconAnchor = new GPoint(32, 32);
partnerIcon.infoWindowAnchor = new GPoint(16, 1);
// ===== Creates a marker at the given point with the given info
window onclick =====
function createMarker(point, html) {
var marker = new GMarker(point,
partnerIcon);
GEvent.addListener(marker, "click",
function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var map = new GMap2(document.getElementById("map"));
map.setCenter(new
GLatLng(<cfoutput>#fRez.latitude#,#fRez.longitude#</cfoutput>));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
// ===== This is the enterd address ======
var icon1 = new GIcon(startIcon);
var point = new GLatLng(<cfoutput>#fRez.latitude#,#fRez.longitude#</cfoutput>);
map.addOverlay(new GMarker(point, icon1));
// ===== This is the results found within the radius passed. ======
<cfoutput query="g_dis">
var myhtml = '<b>#g_dis.partner_name#</b> - <cfif Len(g_dis.distance)>
(#round(g_dis.distance)# miles)</cfif>';
var point = new GLatLng(#g_dis.latitude#,#g_dis.longitude#);
map.addOverlay(createMarker(point, (myhtml)));
// ==== Each time a point is found, extent the bounds auto include it =====
bounds.extend(point);
</cfoutput>
// ===== When all points are made - Set Bounds: =====
// ===== determine the zoom level from the bounds =====
map.setZoom(map.getBoundsZoomLevel(bounds));
// ===== determine the centre from the bounds ======
map.setCenter(bounds.getCenter());
}
}
//]]>
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330748
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4