On Sep 9, 6:01 am, Jaro <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am just a beginner to gmaps api, so maybe this is a trivial
> question, but I would be really grateful if someone could help me and
> point to the solution.
>
> I have a polygon defined by KML and I need to place a marker over this
> polygon (and take its coordinates). However, it seems that I am able
> to place markers only outside the polygon:
>
> http://www.geomodel.sk/temp/test.html
>
> Is there any solution to this problem? How can I place markers over
> the polygon?
When you click on the polygon, you get the "overlay" returned, not
point. You should use the third parameter overlaylatlng if you want
the coordinates of the clicked point on the overlay.
Something like:
GEvent.addListener(map, "click", function(overlay,point,
overlaylatlng) {
if (point) {
var marker = new GMarker(latlng);
map.addOverlay(latlng);
} else if (overlaylatlng)
var marker = new GMarker(overlaylatlng);
map.addOverlay(overlaylatlng);
}
});
-- Larry
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---