Hi

Thanks for your comments.  I have an initial work around developed
using the eploy contains functionality.

I take each line of the polygon and get the mid point of the line and
then keep getting segment mid points until I have 7 + the two end
points (9 pts per line) and then see if they are inside another
polygon.  This is still not 100% accurate but as this gets most of the
polygons I draw an happy as a good start and the ones it doesn't won't
affect the outcome of my next step.  Still I want to get 100%
accuracy!

Andrew - I like your idea of the simultaneous equations and am going
to have a look at getting an equation set that will do this for me and
save having to do a lot of processing of midpoints (this could get
slow for a large number of polygons).

Cheers,

Stephen

On Apr 28, 6:01 am, Andrew Leach <[email protected]>
wrote:
> On Apr 27, 5:00 am, teradactyal <[email protected]> wrote:
>
> > Thanks John
>
> > This is a standalone JS app and I am tending to agree that Server Side
> > might be the only way to do this accurately, short of breaking up each
> > edge to a number of lines and then breaking up each line to a number
> > of points and testing these (which may take some time and still won't
> > be 100%).
>
> Client-side is not trivial, but it's probably doable.
>
> Consider two polygons A and B. You can discount any possibility of
> intersection if the two bounding boxes do not intersect -- that's a
> fairly trivial comparison of max and min latitude and longitude.
>
> If there is the possibility of intersection, then they intersect if
> there is a vertex of A inside polygon B or if a vertex of B exists
> inside polygon A. You can use Mike's EPoly extension to do that, but
> it involves testing each vertex of both polygons until success.
>
> You could dispense with that stage, but in most cases it will yield a
> result faster than going straight into stage three:
>
> I contend that if the boundaries coincide at any point, you can infer
> that there is an intersection (even if it's just a point). You then
> need to test every straight-line segment of poly A against every
> straight-line segment of poly B and see if they cross. That means
> solving simultaneous equations (I think) to see if the equation of the
> A segment and the equation of the B segment have a common solution. If
> they do, they meet at that point and the polygons can be said to
> intersect. But that's the difficult bit.
>
> That particular test can be speeded up by discounting segments whose
> bounding box does not intersect the bounding box of the subject
> segment in the other polygon, like the very first stage.
>
> It's not a trivial method. If you need to do it client-side, I wish
> you good luck!
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to