Search code examples
jquerygoogle-maps-api-3kmljquery-ui-map

Add a marker and find it's overlay name


I am using jquery-ui map plugin to manipulate some maps

I am using overlays from a kml file and afterwards I am adding a marker, my goal is to see in which overlay's territory the marker was added Any ideas? My code can be found here

http://jsfiddle.net/theodore/twGHC/268/


Solution

  • Proof of concept

    Uses:

    • geoxml3 to parse the (your) KML and add it to the map as native Google Maps API v3 objects
    • the geocoder to place a marker (for convenience), you didn't specify your method
    • the Google Maps API v3 geometry library to determine which polygon contains the marker

    Based off of this Google Maps API v2 example, which was ported to the Google Maps API v3.