Draw Polygons in Google Maps and Determine whether an Address is in Polygons

Draw Polygons in Google Maps and Determine whether an Address is in Polygons

This sample source code uses Google Maps Javascript API V3 to draw polygons in Google Maps.
(Refer https://google-developers.appspot.com/maps/documentation/javascript/examples/drawing-tools)

The address auto-complete uses Google Places Javascript library.
(Refer https://developers.google.com/maps/documentation/javascript/places#places_autocomplete)

The server-side code will retrieve address’ latitude and longitude using Google Gecoding API.
(Refer https://developers.google.com/maps/documentation/geocoding/)

Using “Point-In-Polygon” Algorithm, the server-side code will determine whether address’ coordinate is inside of polygons or outside.
(Refer http://alienryderflex.com/polygon/)

===== How To Use =====

First, draw polygons
Second, search address and click “Check Inside/Outside Polygons” submit button

===== For Your Information =====
If you need client-side Javascript to determine whether an address is in/out polygons,
you can use google.maps.geometry.poly.containsLocation function in Google Maps API.
(Refer https://developers.google.com/maps/documentation/javascript/reference#poly)

The address auto-complete (Google Places Library) returns address information including coordinate.

Preview Sample

Download Sample Source Code