简体   繁体   中英

Need a way in JTS library to find new Lat Long coordinates at X length in given angle from starting lat long

I am trying my hands on locationtech JTS library. I wanted to find any built methods from JTS that can help me get a new coordinate given that I have following data with me:

  1. Originating Point
  2. Distance to the new coordinate
  3. Bearing angle direction for finding the new coordinate

Also are there any resources apart from Javadocs of JTS library for easier comprehension?

To do that you simply set the start point, distance and direction in the GeodeticCalculator .

DefaultGeographicCRS crs = DefaultGeographicCRS.WGS84;
GeodeticCalculator calc = new GeodeticCalculator(crs);
GeometryFactory geomFactory = new GeometryFactory();
Point point = geomFactory.createPoint(new Coordinate(0.0, 50.0));

calc.setStartingGeographicPoint(point.getX(), point.getY());
// azimuth in degrees -180 - 180
double azimuth = 90.0;
// distance in metres
double distance = 50;
calc.setDirection(azimuth, distance);
Point2D p = calc.getDestinationGeographicPoint();

System.out.println(p);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM