Found this simple javascript by Bill Chadwick. Just load LatLng into an array and go to the original arguments in the function here. Douglas Peucker Line Simplification Procedure
it will output an array with fewer points for the polygon.
var ArrayforPolygontoUse= GDouglasPeucker(theArrayofLatLng,2000) var polygon=new google.maps.Polygon({ path:ArrayforPolygontoUse, geodesic:true, strokeColor:"#0000FF", strokeOpacity:0.8, strokeWeight:2, fillColor:"#0000FF", fillOpacity:0.4, editable:true });
theArrayofLatLng is the latlng array that you compiled using the google maps api. The value 2000 is the bend in meters. My assumption is that the higher the value, the more points will be deleted as an output.
For real beginners: Before using, make sure you declare a js file on your html page. :)
<script type="text/javascript" src="js/GDouglasPeucker.js"></script>
Quchie
source share