Updated version of Matt Williamson's Point in Poly, to work with Gmaps API V3
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 3 commits ahead, 19 commits behind mattwilliamson:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
index.html
maps.google.polygon.containsLatLng.js

README

This is a Javascript Google Maps extension for the GPolygon class to detect whether or not a point resides within it. Included is a sample HTML page that makes use of it to demonstrate usage.

<http://appdelegateinc.com/blog/2010/05/16/point-in-polygon-checking/>

Simplest Usage:

var coordinate = new google.maps.LatLng(40, -90);
var polygon = new google.maps.Polygon([..paths..], "#000000", 1, 1, "#336699", 0.3);
var isWithinPolygon = polygon.containsLatLng(coordinate);

Or if you have a Marker


var isWithinPolygon = polygon.containsLatLng(marker.getPosition());