I went ahead and took out the code that gets the LAT LONG by address in the wagmp.cfm file I use.
Did not see any difference in load speed.
I will now look into loading the map first then the points.
My wagmp.cfm file is now this....
<cfquery name="qry_members" datasource="#application.dsn#" username="#application.dsnuser#" password="#application.password#">
SELECT [mem_id]
,[member_name]
,[street_address]
,[city]
,[postal_code]
,[phone_number]
,[website]
,[tblmemLatLon].[Lat]
,[tblmemLatLon].[Lon]
FROM [memberstbl] LEFT JOIN [tblmemLatLon]
ON [memberstbl].[mem_id] = [tblmemLatLon].[PK_ID]
WHERE memberstbl.delete_status <> 1
AND memberstbl.mem_id <> 171
ORDER BY memberstbl.member_name
</cfquery>
function WAMapRef(mapObj) {
this.obj = mapObj;
this.directions = false;
this.icons = [];
this.markers = [];
this.addresses = [];
this.points = [];
return this;
}
function WAMapPoint(theMarker, theAddress, theIcon) {
this.icon = theIcon;
this.marker = theMarker;
this.address = theAddress;
return this;
}
function wagmp_map_5() {
if(GBrowserIsCompatible()) {
if(!document.getElementById('wagmp_map_5')) return false;
var map = new GMap2(document.getElementById('wagmp_map_5'));
wagmp_map_5_obj = new WAMapRef(map);
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.addControl(new GLargeMapControl());
map.addControl(new GScaleControl());
map.addControl(new GMapTypeControl());
var geocoder = new GClientGeocoder();
var fromAddress = {
enabled: false,
street: '<cfoutput></cfoutput>',
city: '<cfoutput></cfoutput>',
state: '<cfoutput></cfoutput>',
zip: '<cfoutput></cfoutput>',
country: '<cfoutput></cfoutput>',
full: ''
};
var icon_0 = new GIcon();
icon_0.image = 'plugins/google_javascript/images/traditionalpillow_pacifica.png';
icon_0.shadow = 'google_javascript/images/traditionalpillow_shadow.png';
icon_0.iconSize = new GSize(34,35);
icon_0.shadowSize = new GSize(34,35);
icon_0.iconAnchor = new GPoint(9,33);
icon_0.infoWindowAnchor = new GPoint(19,0);
icon_0.printImage = 'plugins/google_javascript/images/traditionalpillow_pacifica.gif';
icon_0.mozPrintImage = 'plugins/google_javascript/images/traditionalpillow_pacifica_mozprint.png';
icon_0.printShadow = 'google_javascript/images/traditionalpillow_shadow.gif';
icon_0.transparent = 'google_javascript/images/traditionalpillow_pacifica_transparent.png';
var icon_1 = new GIcon;
icon_1.image = 'plugins/google_javascript/images/traditionalpillow_pacifica_gtha.png';
icon_1.shadow = 'google_javascript/images/traditionalpillow_shadow.png';
icon_1.iconSize = new GSize(34,35);
icon_1.shadowSize = new GSize(34,35);
icon_1.iconAnchor = new GPoint(9,33);
icon_1.infoWindowAnchor = new GPoint(19,0);
icon_1.printImage = 'plugins/google_javascript/images/traditionalpillow_pacifica_gtha.gif';
icon_1.mozPrintImage = 'plugins/google_javascript/images/traditionalpillow_pacifica_mozprint.png';
icon_1.printShadow = 'google_javascript/images/traditionalpillow_shadow.gif';
icon_1.transparent = 'google_javascript/images/traditionalpillow_pacifica_transparent.png';
<cfset qry_members_id=0>
<cfoutput query="qry_members">
var address_0_#qry_members_id# = {
street: '[Address]',
city: '',
state: '',
zip: '',
country: '',
infowindow: '<cfoutput><a href="http://#qry_members.website#">#qry_members.member_name#</a></cfoutput>',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;">#Replace("<strong>" & ToString(qry_members.member_name) & "</strong><br />" & ToString(qry_members.street_address) & "<br />" & ToString(qry_members.city) & "<br />" & ToString(qry_members.postal_code) & "<br />" & ToString(qry_members.phone_number) & "", "'", "\'")#</span>',
full: '<cfoutput>#Replace("" & ToString(qry_members.Lat) & "", "'", "\'")#</cfoutput>,#Replace("" & ToString(qry_members.Lon) & "", "'", "\'")#',
isdefault: true,
addressType: 'coordinates',
loop: 'qry_members',
latitude: '#Replace("" & ToString(qry_members.Lat) & "", "'", "\'")#',
longitude: '#Replace("" & ToString(qry_members.Lon) & "", "'", "\'")#',
markerStyle: 'Google Traditional (pillow)',
markerColor: 'Pacifica'
};
if (address_0_#qry_members_id#.addressType == "coordinates") {
var cacheReturn = '';
}
if (cacheReturn != "" || (address_0_#qry_members_id#.addressType == "coordinates")) {
if(address_0_#qry_members_id#.addressType == "coordinates") {
var latitude = address_0_#qry_members_id#.latitude;
var longitude = address_0_#qry_members_id#.longitude;
}
var point = new GLatLng(latitude, longitude);
if (point && !isNaN(latitude)) {
wagmp_map_5_obj.addressFailed = false;
var marker_0_#qry_members_id# = new GMarker(point, icon_0);
GEvent.addListener(marker_0_#qry_members_id#, 'click', function() {
marker_0_#qry_members_id#.openInfoWindowHtml(address_0_#qry_members_id#.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_#qry_members_id#' != 'address_0_0') {
if('address_0_#qry_members_id#' == 'address_0_0')
map.setCenter(new GLatLng(43.6573215, -79.3734778), 10);
map.addOverlay(marker_0_#qry_members_id#);
}
wagmp_map_5_obj.addressFailed = true;
}
}
<cfset qry_members_id=qry_members_id+1>
</cfoutput>
var gthalatlon = new GLatLng(43.639057,-79.380834);
var marker_gtha = new GMarker(gthalatlon, icon_1);
GEvent.addListener(marker_gtha, 'click', function() {
marker_gtha.openInfoWindowHtml('<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><br /><strong>Greater Toronto Hotel Association</strong><br />Phone: 416-351-1276<br />Fax: 416-351-7749</span>');
});
map.addOverlay(marker_gtha);
}
}
This is the smallest I have done yet!
I see other maps around that load faster, what is different with this method?
For those of you that use ColdFusion, yes, for some reason I needed to put my query at the top of this page even though the code generated did not.
Regards, eric