On May 14, 9:33 am, nimrod <[email protected]> wrote:
> Hi Larry,
>
> Thank you for the reply.
>
> I changed the function to the below but it does not show the
> markers...
>
>     function processMyData(data) {
>     var xml = GXml.parse(data);
>     var markersXml = xml.documentElement.getElementsByTagName
> ("marker");
>     var markersXml = [];

Why are you emptying the markersXml array that you just created?  The
above line makes markersXml.length always 0.


>              for (var i = 0; i < markersXml.length; ++i) {
>               var name = markersXml[i].getAttribute("id");
>                                 var point = new 
> GLatLng(parseFloat(markersXml[i].getAttribute
> ("lat")), parseFloat(markersXml[i].getAttribute("lng")));
>                                 var markerOnMap = createMarker(point);
>                         markersXml.push(markerOnMap);
>                         markerCluster = new MarkerClusterer(map, markersXml);
>           }
>   }
>
> Any ideas why?

Not without looking at your page again

>
> About the MarkerManager...do I need that one when I use the
> MarkerClusterer?

typo, I meant MarkerClusterer

>
> Many thanks,
>
> /Nimrod
>
> On May 14, 3:45 pm, "[email protected]" <[email protected]>
> wrote:
>
>
>
> > On May 14, 6:29 am,nimrod<[email protected]> wrote:
>
> > > Great, now I have truely learned something today :-) thank you!
>
> > > I made
> > >   var map;
> > >   var markerCluster;
> > > into global variables as you suggested and have the
> > > markerCluster = new MarkerClusterer(map, markers);
> > > in the processMyData-function.
>
> > > Belive it or not but I do not get any erros in FF right now. On the
> > > downside is that I get no markers on the map either... :-((
>
> > > From the bottom and up...
>
> > > 1. XML is ok:
> > >   <?xml version="1.0" ?>
> > > - <markers>
> > >   <marker id="95" address="" lat="98.3307" lng="7.98431" type="" />
> > >   <marker id="96" address="" lat="28.4198" lng="-81.5802" type="" />
> > >   <marker id="97" address="" lat="56.6375" lng="16.4998" type="" />
> > >   <marker id="98" address="Sea World, Orlando, FL 32821, USA"
> > > lat="28.4116" lng="-81.4591" type="" />
> > >   <marker id="99" address="Tract C, Virgin Islands" lat="18.3166"
> > > lng="-64.9564" type="" />
> > >   <marker id="100" address="78-100 Tract F, Virgin Islands"
> > > lat="18.3217" lng="-64.9527" type="" />
> > >   <marker id="102" address="Tract C, Virgin Islands" lat="18.3167"
> > > lng="-64.9568" type="" />
> > >   </markers>
>
> > > 2. The XML is passed into processMyData-function which iterates
> > > through it with a for-loop.
>
> > > 3. For each marker in the for-loop the createMarker-function is called
> > > and creates marker.
>
> > but first you set the markers array to empty
> >     var markers = [];
> > leaving nothing to process.
> > I would suggest naming the array of html elements that you get from
> > your xml and the array of GMarkers with different names.
>
> > Then this rather important line is commented out...
> > //var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
> > parseFloat(markers[i].getAttribute("lng")));
>
> > You don't include the MarkerCluster "library" in your page, so
> > MarkerManager is undefined.
>
> >   -- Larry
>
> > > 4. The marker is returned and allocated to the "var marker"
>
> > > 5. markers.push(marker);
>
> > > 6. markerCluster = new MarkerClusterer(map, markers);
>
> > > Shouldn't this work...?
>
> > > How do I go from here?
>
> > > /Nimrod
>
> > > On May 14, 2:28 pm, Andrew Leach <[email protected]>
> > > wrote:
>
> > > > On May 14, 1:17 pm,nimrod<[email protected]> wrote:
>
> > > > > The GDownloadUrl(url,processMyData) gets the data from the specific
> > > > > URL. It "send" it to the processMyData-function. That functions
> > > > > process the data and should display the markers on the map.
>
> > > > > Is that correct?
>
> > > > Yes.
>
> > > > > I've progressed one step and FF is not liking that var markerCluster
> > > > > not is defined. I have markerCluster in the processMyData-function but
> > > > > the map-argument is defined in the initialize()-function. Is that why
> > > > > FF is complaining about markerCluster?
>
> > > > Yes. Or nearly, anyway.
>
> > > > I would suggest adding these lines outside ANY function:
> > > >   var map;
> > > >   var markerCluster;
> > > > then move your existing lines which start like that inside the
> > > > intialize() function but remove the "var" keyword.
> > > >   map = new GMap2(document.getElementById('map'));
> > > >   markerCluster = new MarkerClusterer(map, markers);
>
> > > > What that does is make "map" and "markerCluster" into global
> > > > variables, which are available to any function. They are then assigned
> > > > values in the initialize() function.
>
> > > > Andrew- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to