Just a little up, please :-)

Maybe I haven't been clear enough about what I'd like to achieve ?

Thanks

On 29 déc 2009, 23:58, Brice <[email protected]> wrote:
> On 29 déc, 17:23, "[email protected]" <[email protected]> wrote:> On 
> Dec 29, 10:30 am, Brice <[email protected]> wrote:
>
> > > Thanks the debug output is very usefull.
>
> > > If I have well understood, I need to use GXmlHttp() the way it's
> > > described by Mike William and just like I did for the drawing of the
> > > polygons (Mike William's code in fact). In that way I'll be able to
> > > use the gmarkers array outside the callback routine ?
>
> > GDownloadUrl uses GXmlHttp (so you are using it).
>
> Yes I forgot that the drawing of the polygons takes place in the
> GXmlHttp routine in Mike William's code (line 154).
>
>
>
> > > Or maybe I don't need GXmlHttp() but only XmlHttpRequest ? what do you
> > > think ?
>
> > GXmlHttp is a cross-browser wrapper for XmlHttpRequest.
>
> > Why do you think you need to add the GMarkers array to the
> > MarkerManager outside of the callback routine?
>
> > Maybe if you tell us what you think you can accomplish by doing that
> > we may be able to help.
>
> Ok. I would like to distinguish the markers depending on the state
> (département in French) they are attached. Now, I only search for
> locations crossing two xml files and display them. I'd like to do
> something more complex :
> - on load, show all the markers (only at a certain zoom level -->
> that's why I use GMarkerManager)
> - when a click event is detected on one of the three polygons (each
> polygon matching a state), an infoWindow appears and a zoom in happens
> (lines 167 and 168).
> - I'd like to display only the markers of that state ; in order to do
> that, I've added an attribute "dep" in my villesIMG.xml (I don't feel
> comfortable dealing with regular expressions to use the two first
> numbers of the cp attribute) wich takes one of three possibilities.
> If a click event happens on polygon 0 (polys[0] corresponding to the
> state of Corrèze then display only the markers of Corrèze (atribute
> dep ="19") and hide the markers of the others states.
> So I figured I need to add a conditional loop in my request on
> villesIMG.xml to create an array of markers for each state and then
> decide what markers I use.
>
> I'm not sure if I'm clear about my intentions here. If you need more
> explanations, don't hesitate.
> Thanks a lot again for your help.
>
> >   -- Larry
>
> > > Thanks a lot.
>
> > > On 29 déc, 01:10, "[email protected]" <[email protected]> wrote:
>
> > > > On Dec 28, 5:55 pm, "[email protected]" <[email protected]>
> > > > wrote:
>
> > > > > On Dec 28, 5:12 pm, Brice <[email protected]> wrote:
>
> > > > > > I followed your advice but I couldn't figure it out so I went again 
> > > > > > onhttp://econym.org.uk/gmap/andfindanothertoreaddata from a xml
> > > > > > file (http://econym.org.uk/gmap/basic3.htm).
>
> > > > > > Here is the result 
> > > > > > :http://boucard.brice.perso.neuf.fr/geoculture/geoloc/polymarkersIMG.html
>
> > > > > > But I have another problem concerning the way to display markers
> > > > > > through a MarkerManager. As you can see in this page, the call to
> > > > > > display is "inside the xml parsing" (mm.addMarkers(gmarkers,9); on
> > > > > > line 250)
> > > > > > But here 
> > > > > > :http://boucard.brice.perso.neuf.fr/geoculture/geoloc/polymarkersDEPIM...
> > > > > > I've put that instruction "outside", at line 258 and it doesn't 
> > > > > > work.
> > > > > > Yet I've declared the gmarkers array at line 42 and I fill this 
> > > > > > array
> > > > > > with the markers I create with gmarkers.push(marker); on line 248
>
> > > > > The GXml call is asynchronous:
> > > > > From Mike Williams' tutorial, Javascript Concept
> > > > > Part 2 Asynchronous I/Ohttp://econym.org.uk/gmap/async.htm
>
> > > > > You _have_ to use the data in the call back routine (as you
> > > > > discovered).  The code that doesn't work sends the request for the
> > > > > data to the server then adds the empty array to the MarkerManager.
> > > > > Later the data arrives and populates the array, but never adds the
> > > > > newly populated array to the MarkerManager.
>
> > > > Here is a copy of your page to which I have added debug 
> > > > output:http://www.geocodezip.com/polymarkersDEPIMG_c.html
> > > > Notice that the mm.addMarkers call happens before the xml is
> > > > processed.
>
> > > >    -- Larry
>
> > > > > > I think it's a problem with the loops I use but as you have seen and
> > > > > > can see with my code (there is probably a much better way to do what
> > > > > > I'm tryong to do), I'm not a javascript familiar :/
>
> > > > > > Thanks for your help.
>
> > > > > > On 24 déc, 16:17, Rossko <[email protected]> wrote:
>
> > > > > > > > GEvent.addListener(vmarker, "click", function() {
> > > > > > > >                 for (var i=0; i<vmarkers.lenght; i++) {
> > > > > > > >                         
> > > > > > > > vmarker.openInfoWindowHtml("Représentations de"+vlabels[i]);
> > > > > > > >                         }
> > > > > > > >                 });
>
> > > > > > > What that looks like its intended to do is - upon a click on ANY
> > > > > > > marker, step through the whole array of vmarker and open each ones
> > > > > > > infowindow.  What you would see is just the last one, as there is 
> > > > > > > only
> > > > > > > one infowindow (opening it on another marker closes the previous 
> > > > > > > one)
>
> > > > > > > The loop wouldn't actually work though as vmarkers.lenght would be
> > > > > > > undefined (spelling?).
>
> > > > > > > It is important that you put the listener code in the code where 
> > > > > > > you
> > > > > > > build each marker (processing the villes XML)
>
> > > > > > > In the code currently on your test page, it says
> > > > > > >     GEvent.addListener(vmarkers, ...
> > > > > > > that won't work, vmarkers is a javascript array and never gets
> > > > > > > clicked.
> > > > > > > You want to attach the listener to each marker object, best to do 
> > > > > > > this
> > > > > > > where you create it
>
> > > > > > > Outline -
> > > > > > > Loop through XML reading 'ville' marker data
> > > > > > >      create individual marker
> > > > > > >      add listener to marker
> > > > > > >      push marker onto array
> > > > > > > end loop
> > > > > > > add array to markermanager

--

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