I found a script to simplify polygons in Google Maps, basically to reduce the number of nodes the polygon is build up from. It does that by some sort of smoothing algorithm, with a distance parameter. Anything under that distance is smoothed out (read: deleted). It’s a Google Maps V2 script, but I modified it to work with V3.
This is the original: Stack-based Douglas Peucker line simplification routine by Dr. Gary J. Robinson. Let me know if you need the V3 script, but it shouldn’t be a problem to do the modifications yourself.
When I set the tolerance (kink as it’s called in the script) to 10 (meter), my polygons have a node drop from almost 600 to about 30, and still look about the same as what was drawn. I can still optimize the query a little to only use 7 decimal digits on the lats/longs, but for now that’s not needed.
Come to think of it, the amount of smoothing should be linked to the zoomlevel the map is at when drawing the polygon.
Update 18-Aug-2016: The V3 file is this one.
I would love to get the v3 script if possible. Working on a mobile app for real estate. Much appreciated.
Where can I send it?
Please send it to kguy@floridainvestor.net
Much appreciated!
Done.
Just writing to say thank you very much! I needed something like this to simplify my polygons. You saved me lots of time and headaches!
HI, is it possible to still request the v3 script?
I’ll see if I still have it. Then I’ll send it to you.
I’ve included the modified version in the post now. So anyone can download/use it without asking.
Thank you very much! Appreciated!