I've been working on a polygon drawing app and I've gotten the basics
of it down, but now I've gotten myself all mixed up trying to support
polygon exclusions. I swear that I got a proof of concept working at
one point, but now I can't seem to figure out the proper syntax.
I've put up an example of what I'm working on at:
http://arclyte.netdojo.com/geo/edit_poly.php
Some of the functionality is missing or doesn't work in this example,
but it should at least give you an idea of what I'm talking about.
The blue polygon in this example is for zip code 10022. It has a
square exclusion in it that I'm currently loading as a separate
polygon.
Here's the trick... When you click on the colored squares at the
bottom of the page next to the polygon name, it should load the
markers for that particular polygon's points so that you can edit it.
So, I have to have a separate array of those points (I believe)
outside of the polygon description that separates the polygon proper
from its exclusions so I can edit either. But I also want the polygon
to load with those exclusions included into the polygon so that they
will load as a proper "hole".
And the next rabbit I'm trying to pull out of my hat is to actually
inject new "holes" into an already defined polygon so that an
exclusion can be added to it. Any assistance you can give in this
regard would be greatly appreciated. Just a few hints on the
formatting of such a thing would help me out a lot.
I've tried doing something like this, with no luck (untested example
only):
points[0][0] = [[lat1, lng1]...[latn, lngn]];
points[0][1] = [[lat1, lng1]...[latn, lngn]];
path[0] = new google.maps.MVCArray([points[0]]);
poly = new google.maps.Polygon();
poly.setPaths(new google.maps.MVCArray([path[0]]));
That gives me an invalid constructor parameter error, saying path[0]
is an object...