Hi Ben

 

I have tried this library and it works like a bomb!

 

Thanks a lot.

 

Riaan

 


From: [email protected] [mailto:[email protected]] On Behalf Of Ben van der Merwe
Sent: Monday, January 30, 2006 4:03 PM
To: [email protected]
Subject: [CTJUG Forum] Re: Creating a polygon

 

Riaan,

Have a look at JTS:
http://www.vividsolutions.com/JTS/jts_frame.htm

"The JTS Topology Suite is an API of 2D spatial predicates and functions."
"JTS provides a complete, consistent, robust implementation of fundamental 2D spatial algorithms"

Implemented in Java (there is also a C# port) and licensed under the LGPL, so easily usable.


JTS implements a PointLocator class, which includes a intersects method:

intersects

public boolean intersects(Coordinate p,
                          Geometry geom)

Convenience method to test a point for intersection with a Geometry

Parameters:

p - the coordinate to test

geom - the Geometry to test

Returns:

true if the point is in the interior or boundary of the Geometry

Cheers,
Ben


GMail wrote:


Mike Morris wrote :



Riaan Koegelenberg wrote:


Have anyone ever done something like this?  I need to
determine whether this polygon then contain a specific
point (coordinates also in lat/long).


This is really, /really/! hard to do if you need any sort of acccuracy. The Earth is a spheroid, not flat, so any 2D-based solutions are wrong.

Best is to search for Great Circle navigation code, or ask Mr Ulrich Schultz in the Hydrographer's office - I don't think too many other people in the country know the math involved.


Anybody who's done a surveyor's degree would have done the math - whether they still remember it is another matter, but they should have the books still. There used to be someone on the CLUG mailing list who worked with GIS's - you might try posting there and see if he answers.

The difficulty of the problem depends on the size of your polygons, if they are small (say plot sized) then you just need to transform lat & long. to grid co-ordinates and use standard plane geometry. If they are large (say country sized) then the earth's curvature is significant and straight sides are no longer a good approximation so you need to work in spherical geometry.

Fritz Meissner




-- 
Ben van der Merwe
[EMAIL PROTECTED]

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006

Reply via email to