On Dec 4, 10:03 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Greetings, > > I am having a problem with an application and I can't figure out why > my code isn't working. If I uncomment the alert in the createMarker > function, the code places all of the markers. Function initialize is > called at body on load
Part 2 Asynchronous I/O http://econym.org.uk/gmap/async.htm > > I will include my javascript and the current firebug output and a url > to the site so you can see it. > > http://207.114.33.247/default.asp is the url of my problem code. > > http://207.114.33.247/butscher.aspdoes work and it is placing 20 > markers where as the other code is attempting to place 3 markers. > > Thanks for taking the time to look this over > > Firebug has this to say: > this.Q is null > > Here is my code: > > <script type="text/javascript"> > //<![CDATA[ > var mapCenter = "911 Crosswind Pl 21030"; > var mapCenterInfo = "<b>Your > location:</b><br>911 Crosswind Pl > 21030"; > var geocoder; > var map; > var storeAddress; > var storeAddressToMap; > var storeName; > var mapInfoText; > var counter = 0; > var point; > var gPoint; > var gAddress; > var gStore; > var gMarker; > var gCityStateZip; > var gCounter; > > var bounds = new GLatLngBounds(); > > // Create a base icon for all of our markers > that specifies the > // shadow, icon dimensions, etc. > var baseIcon = new GIcon(); > baseIcon.shadow = > "http://www.google.com/mapfiles/shadow50.png"; > baseIcon.iconSize = new GSize(20, 34); > baseIcon.shadowSize = new GSize(37, 34); > baseIcon.iconAnchor = new GPoint(9, 34); > baseIcon.infoWindowAnchor = new GPoint(9, 2); > baseIcon.infoShadowAnchor = new GPoint(18, > 25); > > function initialize() > { > map = new > GMap2(document.getElementById("map_canvas")); > map.addControl(new GScaleControl()); > map.addControl(new > GSmallMapControl()); > > geocoder = new GClientGeocoder(); > > if (geocoder) { > geocoder.getLatLng( > mapCenter, > function(point) { > if (!point) { > alert(mapCenter + " > not found"); > } else { > > map.setCenter(point, 10); > // map.setCenter(new > GLatLng(0,0),0); > var markerStart = > new GMarker(point); > > GEvent.addListener(markerStart, "click", function(){ > > markerStart.openInfoWindowHtml(mapCenterInfo); > } > ); > > map.addOverlay(markerStart); > > bounds.extend(markerStart.getPoint()); > }// if not point > }//function point > );//geocoder.getlatlng > }//if geocoder > > > GDownloadUrl("scratch/1057755457.xml", function(data) { > var xml = GXml.parse(data); > var markers = > xml.documentElement.getElementsByTagName("marker"); > for (var i = 0; i < markers.length; i++) > { > > gStore = markers[i].getAttribute > ("store"); > gAddress = markers[i].getAttribute > ("address"); > gCityStateZip = markers > [i].getAttribute("city") + " " + markers[i].getAttribute("state") + " > " + markers[i].getAttribute("zip"); > > gPoint = new GLatLng(parseFloat > (markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute > ("lng"))); > > marker = createMarker > (gPoint,gStore,gAddress,i,gCityStateZip); > //geocoder.getLocations > (storeAddressToMap, callBack); > map.addOverlay(marker); > bounds.extend(marker.getPoint()); > > map.setZoom(map.getBoundsZoomLevel(bounds) - 1); > > map.setCenter(bounds.getCenter()); > } > }); > } > > function createMarker > (point,storeName,address,counter,cityStateZip) > { > > var letter = > String.fromCharCode("A".charCodeAt(0) + counter); > var letteredIcon = new > GIcon(baseIcon); > letteredIcon.image = > "http://www.google.com/mapfiles/marker" + > letter + ".png"; > markerOptions = { icon:letteredIcon }; > var marker = new GMarker(point, > markerOptions); > var html = "<b>" + storeName + "</b><br>" + > address + "<br>" + cityStateZip; > //alert("Placing " + storeName + " on the map."); > GEvent.addListener(marker, "click", > function(){ > > marker.openInfoWindowHtml(html); > } > ); > > return marker; > } > > //]]> > > </script> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
