[Proj] Coordinate within an area ?
Martin Raspaud
martin.raspaud at smhi.se
Wed Mar 31 01:21:37 EST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thanks for the great feedback guys !
I will try the angles approach, since it seems to fit my purpose.
As for the antipodes problem, this is not a issue at the moment, but I keep my
ears and eyes open.
Regards,
Martin
` ` skrev:
> This may be more complicated than is desired, but this algorithm is one
> I will keep in my tool box for ascertaining if a point is in a polygon:
> http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/
> I modified this to be a function in a php object, but the concept is great.
>
> -Daniel
>
> ------------------------------------------------------------------------
> Date: Tue, 30 Mar 2010 13:39:24 -0700
> From: strebe at aol.com
> To: proj at lists.maptools.org
> Subject: Re: [Proj] Coordinate within an area ?
>
>
> On Mar 30, 2010, at 9:49:39 AM, "Karl Swartz" <karl at kls2.com> wrote:
>
> For the azimuth calculations, you can use Vincenty or similar if you
> want high accuracy, or but you said small errors are acceptable so
> basic spherical geometry may suffice.
>
> The accuracy is not important, since the value of the azimuth does not
> matter; only its relative geometry does. The geometry is the same on the
> sphere and the ellipsoid except when the polygon include antipodes. If
> the polygon is that large then you need to consider more. You need to
> consider the very definition of "inside", since this is a closed surface
> we're talking about. None of the responses so far have addressed this
> problem.
>
> Regards,
> — daan Strebe
>
>
> On Mar 30, 2010, at 9:49:39 AM, "Karl Swartz" <karl at kls2.com> wrote:
>
> From: "Karl Swartz" <karl at kls2.com>
> Subject: Re: [Proj] Coordinate within an area ?
> Date: March 30, 2010 9:49:39 AM PDT
> To: "PROJ.4 and general Projections Discussions"
> <proj at lists.maptools.org>
>
> > > My next questions would be: (1) how accurate does it need to be?
> and (2)
> > > If it is done everywhere in the world, what projection to use to
> reduce
> > > error?
>
> > 2/ We use global data, so it is everywhere in the world. I thought
> > about using Lambert azimuthal equal-area projection.
>
> If you're working with lat/lon coordinates why would you be using a
> projection at all?
>
> For a point and a simple polygon that's not enormous, I'd calculate
> paths and compare angles. Consider triangle ABC as the polygon and
> you want to determine if point P is inside the triangle. Compute the
> initial azimuth paths AB, AC, and AP. Then, determine if P lies within
> angle A:
>
> if azim(AB) < azim(AC)
> within(B) = azim(AP) > azim(AB) && azim(AP) < azim(AC)
> else
> within(B) = azim(AP) > azim(AC) && azim(AP) < azim(AB)
>
> Repeat from angles B and C and if P is within all three angles then P
> is within the triangle, otherwise it is not.
>
> Note that the comparisons I used treat the boundaries of the triangle
> as "not within" -- change the "within" comparisons to >= and <= to
> include the boundaries of the polygon.
>
> This algorithm can be trivially generalized to any convex n-sided
> polygon.
>
> For the azimuth calculations, you can use Vincenty or similar if you
> want high accuracy, or but you said small errors are acceptable so
> basic spherical geometry may suffice.
>
> -- Karl
>
>
> ------------------------------------------------------------------------
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign
> up now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJLsunwAAoJEBdvyODiyJI42Y0H/0C/klIbyZrw50UdNf/z1yKz
UsDejo7+I1HsQA+KPBR0WRDMpSRGcVjbRqoeA2QRVxjWPla1Ijn+46U+7La1YrS7
pD809rIwNekmO8GDkyJxfh1FH/SZPWtdo/qKYJh2XzFdq0jK3oQ2AMYsCjl/Gv0S
MwG52XsW4TP9FJYVDgHXLatNqHiF4dx5QLMlyer4fE6r6l7fpKwReYn02+0k+QSm
N2CxwIKVTKo5lenv6fTRwNL57EXeXFJuvz2pMTV7HTIzfbIxQ9X4Gyi21iJtgYmf
DmAyNfhPCtcROLTOcx21CPPTESn0ieeV69IvnfembMgE1ZpbRk8T4QYg4Ys4DtU=
=6Uet
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin_raspaud.vcf
Type: text/x-vcard
Size: 259 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/proj/attachments/20100331/216f4c12/attachment-0001.vcf
More information about the Proj
mailing list