It depends on the version of GeoTools you are using - prior to 20.x you
need a com.vividsolutions one after that an org.locationtech one. See
https://docs.geotools.org/stable/userguide/welcome/upgrade.html for more
information.

Ian

On Tue, 4 Feb 2020 at 06:35, <paul.m...@lfv.se> wrote:

> Just a one more question, please.
>
> What type of Point is centre, start and end,
> com.vividsolutions.jts.geom.point or org.locationtech.jts.geom.Point*.*
>
> Sorry but I know too little about the different libraries.
>
>
>
> *Från:* Ian Turton [mailto:ijtur...@gmail.com]
> *Skickat:* den 3 februari 2020 12:14
> *Till:* Malm, Paul (Operations AIM)
> *Kopia:* geotools-users
> *Ämne:* Re: [Geotools-gt2-users] Calculate points on an arc
>
>
>
> You can use the org.geotools.referencing.GeodeticCalculator to do this,
> something like:
>
>
>
> private void createPolygon(Point centre, Point start, Point end) {
>     ArrayList<Coordinate> coords = new ArrayList<>();
>     coords.add(start.getCoordinate());
>     CALC.setStartingGeographicPoint(centre.getX(), centre.getY());
>     CALC.setDestinationGeographicPoint(start.getX(), start.getY());
>     double bearing1 = CALC.getAzimuth();
>     double radius = CALC.getOrthodromicDistance();
>     CALC.setDestinationGeographicPoint(end.getX(), end.getY());
>     double bearing2 = CALC.getAzimuth();
>
>     double angle = bearing2 - bearing1;
>     int nSteps = 10;
>     double dStep = angle / nSteps;
>     coords.add(start.getCoordinate());
>     for (int i = 0; i < nSteps; i++) {
>       CALC.setDirection((bearing1 + (i * dStep)), radius);
>       Point2D p = CALC.getDestinationGeographicPoint();
>       coords.add(new Coordinate(p.getX(), p.getY()));
>     }
>     coords.add(end.getCoordinate());
>     LineString line = GF.createLineString(coords.toArray(new Coordinate[]
> {}));
>     WKTWriter writer = new WKTWriter();
>     System.out.println(writer.write(centre));
>     System.out.println(writer.write(start));
>     System.out.println(writer.write(end));
>     System.out.println(writer.write(line));
>   }
>
>
>
> Where CALC is a GeodeticCalculator and GF is a GeometryFactory will give
> you:
>
>
>
> [image: arc.png]
>
>
>
> Ian
>
>
>
> On Mon, 3 Feb 2020 at 09:21, <paul.m...@lfv.se> wrote:
>
> Hi list,
>
> I would like to draw a circle arc in WGS84 coordinates
>
> I have an arc start point (lat/lon in WGS84),
>
> an arc end point (lat/lon in WGS84),
>
> an arc center point (lat/lon in WGS84),
>
> a bearing from the center point to the start point
>
> the arc radius in meter.
>
> Now I would like to calculate several points (WGS84 lat/lon) on the arc.
>
> Is there a way to do it with Geotools, if so how?
>
>
>
> I appreciate your help,
>
> Paul
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
>
> --
>
> Ian Turton
>


-- 
Ian Turton
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to