Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>All you need to do is to set the <code>clickable: false</code> option in the <code>GPolygon</code> constructor of your circle. The following is an example that I used to answer <a href="https://stackoverflow.com/questions/2488192/how-do-i-detect-a-click-event-on-a-google-map-through-an-overlay">another similar question on Stack Overflow</a>: </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"/&gt; &lt;title&gt;Google Maps Clicking Inside a Polygon&lt;/title&gt; &lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=false" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body onunload="GUnload()"&gt; &lt;div id="map" style="width: 450px; height: 300px"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); GEvent.addListener(map, "click", function(overlay, latlng) { var lat = latlng.lat(); var lon = latlng.lng(); var latOffset = 0.01; var lonOffset = 0.01; var polygon = new GPolygon([ new GLatLng(lat, lon - lonOffset), new GLatLng(lat + latOffset, lon), new GLatLng(lat, lon + lonOffset), new GLatLng(lat - latOffset, lon), new GLatLng(lat, lon - lonOffset) ], "#f33f00", 5, 1, "#ff0000", 0.2, { clickable: false }); map.addOverlay(polygon); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Screenshot of the above example:</p> <p><img src="https://i.imgur.com/e9z1CJW.png" alt="Google Maps Clicking Inside a Polygon"></p> <p>I used diamonds instead of circles, because they are easier to draw in the v2 API. Note that the <code>latlng</code> parameter of the <code>click</code> listener would have been null if the polygons were not created with the <code>clickable: false</code> option.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload