All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.client.model.Place Maven / Gradle / Ivy

There is a newer version: 0.1.9
Show newest version
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