I have start point , end point , center point, angle, radius of arc. I want to create a arc from these data. I tried to Use JTS library to create arc. but when I checked its source code I am confused about arc creation mechanisum also. for arc creation JTS required.

GeometricShapeFactory gsf = new GeometricShapeFactory();
gsf.setSize(10); // radius
gsf.setNumPoints(28); // no of points array required
gsf.setCentre(new Coordinate(43, 144));

LineString lineString = gsf.createArc(?, ??);

I am confused with these 2 parameters that required to pass. how to calculate

I have data as start point : 43 145 end point : 43 144 arc center point : 43 144 sweep angle in deg : 60 radius : 20 nm

  • Why did you tag this with arcgis-10.0? – Vince Feb 12 '15 at 16:25
  • I want to try out with other library like arcgis. I have searched for this but I didn't find satisfactory information. – user1598010 Feb 13 '15 at 10:31

The documentation is sparse indeed, http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/util/GeometricShapeFactory.html#createArc%28double,%20double%29 just says:

public LineString createArc(double startAng, double endAng)

Creates a elliptical arc, as a LineString.

"Ang" suggests "angle". The best way to find out is playing with it. I started with createArc(0,1) and went from there to find out that createArc(0, Math.PI) will give me half a circle in counter-clockwise direction. Here I made one with diameter 10 around the point 0, 0.

example image

So, the answer is: You have to pass the start and end angles of the arc in Radians, just like in pretty much all programs.

However: Be aware that JTS only supports linear cartesian 2D geometries and operations. You might want to use software that knows about geographical coordinates, the curvature of the earth etc.

Also mind the nautical miles of the radius. As you did not specify more, a full answer can only be guessed and I don't want to do your homework. ;)

PS: .setSize() is not the radius but the extends of the whole envelope of the geometry, in this case the diameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.