I don't really understand what you are saying... but I think I don't
have to use GGeoXml or EGeoXML for what I want to do. Actually, after
another visit to http://econym.org.uk/gmap/inside.htm I have found
what I need I think.
The only things I had to do : modify my kml file to a simple xml file,
removing some informations we don't especially need ; I shamelessly
copy the code he uses for an example (http://econym.org.uk/gmap/
example_states.htm) and modify what needed to be.
Here is the result :
http://boucard.brice.perso.neuf.fr/geoculture/geoloc/polytest.html
But I have a problem : I don't really understand this part of the code
except the first line and map.openWindow...
GEvent.addListener(map, "click", function(overlay,point) {
if (!overlay) {
for (var i=0; i<polys.length; i++) {
if (polys[i].Contains(point)) {
map.openInfoWindowHtml(point,"You clicked on "+labels
[i]);
//i = 999; // Jump out of loop
}
}
}
});
In fact I have tried to modify this part of the code to have a similar
result on a marker (in my code : visite) dragend event but it doesn't
work. I don't understand how the coordinates of the click point are
returned and then compared to the points inside the polygon.
Maybe it would be better if I open a new post ?
Thanks again for your help.
On 23 déc, 17:11, Garthan <[email protected]> wrote:
> To override a method (which has an option to override)
> just copy the code in the original
> EGeoXml (put it in your own function) and pass that
> function to the EGeoXml constructor... then you
> make changes on that copy.
>
> On Dec 23, 7:11 am, Brice <[email protected]> wrote:
>
> > On 23 déc, 11:14, Rossko <[email protected]> wrote:
>
> > > > A quick look on the link you gave and if I understand it right, it is
> > > > possible to get the name of one polygon and an id. How do you get
> > > > these informations ?
>
> > > GGeoXml makes up its own id, which you can grab by the intercept
> > > technique.
>
> > > > Once you have the name or the id of the polygon,
> > > > is it possible to apply an event on that polygon ?
>
> > > Once you have some kind of handle to the javascript object
> > > representing the individual overlay, you can apply event listeners.
> > > That's the part GGeoXml usually hides from you and needs to be dug
> > > out.
>
> > > > Or, maybe a better way of doing it is to use EGeoXML and then try to
> > > > determine if the click is in a polygon using EPolys. But it's quite
> > > > complicated
>
> > > Yep, whichever way you go about it. Personally I would use EGeoXml
> > > because you have full access to the objects it creates, and there is
> > > no risk of 'interception' going wrong if GGeoXml changes in future.
>
> > > > ... and maye it wouldn't be really effective since I've gote
> > > > three different polygons based on three different kml files.
>
> > > That's not much of an issue really ; whichever parser you use you can
> > > maintain three distinct collections of overlays.
> > > var groupA = GGeoXml(...);
> > > var groupB = GGeoXml(...);
>
> > Thanks for these infomations.
>
> > But I have some difficulties using EGeoXML, more particulary
> > undestanding the use of the constructors that are listed
> > inhttp://econym.org.uk/gmap/egeoxml.htm
> > I've understood that we can use our own polygon definition and options
> > with {createpolygon: ... } and {polygonoptions:{ ... }} but I don't
> > see how to use the GPolygon class : to create a polygon we need
> > coordinates but my coordinates come from my xml/kml file.
>
> > Could you give me a quick example ?
>
> > Thanks a lot.
--
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.