
org.opentripplanner.client.model.Place Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp-client Show documentation
Show all versions of otp-client Show documentation
Java client for the OpenTripPlanner GraphQL API
package org.opentripplanner.client.model;
import java.util.Optional;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.PrecisionModel;
public record Place(
String name,
float lon,
float lat,
Optional stop,
Optional vehicleRentalStation,
Optional rentalVehicle,
Optional vehicleParking) {
private static final int DEFAULT_SRID = 4326;
/** create a JTS Geometry */
public Coordinate coordinate() {
return new Coordinate(lon, lat);
}
/**
* Return the geometry as JTF Point which defaults to SRID as defined in GTFSdoc .
*/
public Point point() {
return point(DEFAULT_SRID);
}
/** creates a JTS Point by a passed SRID */
public Point point(int SRID) {
GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), SRID);
return geometryFactory.createPoint(coordinate());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy