views:

223

answers:

2

Our VB.NET project is using a Java library from Vivid Solutoins (com.vividsolutions.jts.geom.Geometry) to do Geometry calculations. The help is here: http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html

What I can't figure out are the units specifically for the Buffer property, or any other distance for that matter. My program is dealing with Nautical Miles, and the documentation gives no indication if the units are degrees, miles, Nautical Miles, Kilometers, inches, etc.

Has anyone used this library who knows the answer? Thanks in advance.

A: 

First of all, I don't know this API, I've just browsed the link you've given.

Judging by the Javadocs for Coordinate, it says:

[Coordinate is a] lightweight class used to store coordinates on the 2-dimensional Cartesian plane. It is distinct from Point, which is a subclass of Geometry. Unlike objects of type Point (which contain additional information such as an envelope, a precision model, and spatial reference system information)

So it would seem that Geometry has no units as such, but Point, its subclass, does, and you can specify them.

I wouldn't be surprised if the Geometry class doesn't have any units as such, and just represents the concept of a point in space in any particular coordinate system.

Rich
Looks to me like it represents the concept of a point in space in a **2-D Cartesian** coordinate system. That will be fine, so long as Andy's program deals only in quite small distances in nautical miles. Otherwise the round nature of the Earth is going to upset the calculations.
MarkJ
Rich - this doesn't answer the fact that the buffer() method takes a Double as a parameter - that is a number, but I can't see what units to specify the number in.MarkJ - I agree, and unfortunatley I do need to handle both large distances and areas near the poles.
Andy Jacobs
+1  A: 

This is an old post, but here is the answer for anyone else who is looking, since incredibly the java docs do not state the units returned by the method. The distance returned is in central angle degrees. You can then use any number of formulas to convert to your required unit of measure. The simplest is to convert to radians. 1 radian = 180 degrees divided by pi (rad=180deg/pi). From there, you can multiply radians by the average radius of the earth in your choice of units (6371 km for instance) to get distance between two points. More accurate methods are also available, but you can look them up on the net.

Tim Green
Thanks Tim. Can you clarify one thing I was concerned with. Assuming the earth is a perfect sphere (I know it actually isn't), would the angle to distance formula work for any location on earth? Or would the angles near the poles (in East-West orientations) correspond to smaller distances as the same angles at the equator? I'm assuming the "central angle degrees" means the former - and that the angles are number of degrees appart the points are on the great circle they both intersect. It would be great if you could confirm this. Thanks.
Andy Jacobs
If we are assuming the earth is a perfect sphere, then the angle to distance formula works for any point on earth. The central angle is the angle from the cetner of a great circle to each point on the circle. Therefore the central angle is consistent across the sphere. From there we are simply using standard geometry to calculate the length of the arc. I've been working with the JTS tools under the assumption that the central angle is presented from a spherical model, and so far the results I have achieved have been consistent with this.
Tim Green
Since the earth is an ellipse, simplifying to a sphere does introduce errors using the method described above. Practically, the earth is not too far from a sphere. The largest and smallest radius of the earth is 6378 at the equator and 6356 at the poles. Small central angles will produce relatively small discrepancies. Larger angles can produce more error, depending on the great circle being measured. For more accuracy, I'd suggest using something like the Vincenty formula: http://www.movable-type.co.uk/scripts/latlong-vincenty.html
Tim Green