Package org.onebusaway.geospatial.services

Examples of org.onebusaway.geospatial.services.UTMProjection


    int zone = UTMLibrary.getUTMZoneForLongitude(latlon.getLon());
    return forward(latlon, zone);
  }

  public static ProjectedPoint forward(CoordinatePoint latlon, int zone) {
    UTMProjection projection = new UTMProjection(zone);
    XYPoint point = projection.forward(latlon);
    return new ProjectedPoint(latlon.getLat(), latlon.getLon(), point.getX(),
        point.getY(), zone);
  }
View Full Code Here


      return point;
    return forward(point.toCoordinatePoint(), srid);
  }

  public static ProjectedPoint reverse(double x, double y, int srid) {
    UTMProjection projection = new UTMProjection(srid);
    XYPoint p = new XYPoint(x, y);
    CoordinatePoint latlon = projection.reverse(p);
    return new ProjectedPoint(latlon.getLat(), latlon.getLon(), x, y, srid);
  }
View Full Code Here

      List<StopTimeEntryImpl> stopTimes)
      throws DistanceAlongShapeException {

    PointAndIndex[] stopTimePoints = new PointAndIndex[stopTimes.size()];

    UTMProjection projection = UTMLibrary.getProjectionForPoint(
        shapePoints.getLats()[0], shapePoints.getLons()[0]);

    List<XYPoint> projectedShapePoints = _shapePointsLibrary.getProjectedShapePoints(
        shapePoints, projection);

    double[] shapePointsDistTraveled = shapePoints.getDistTraveled();

    List<List<PointAndIndex>> possibleAssignments = computePotentialAssignments(
        projection, projectedShapePoints, shapePointsDistTraveled, stopTimes);

    pruneUnnecessaryAssignments(possibleAssignments);
    assignmentSanityCheck(shapePoints, stopTimes, possibleAssignments);

    double maxDistanceTraveled = shapePointsDistTraveled[shapePointsDistTraveled.length - 1];

    List<PointAndIndex> bestAssignment = computeBestAssignment(shapePoints,
        stopTimes, possibleAssignments, projection, projectedShapePoints);

    for (int i = 0; i < stopTimePoints.length; i++) {
      PointAndIndex pindex = bestAssignment.get(i);
      if (pindex.distanceAlongShape > maxDistanceTraveled) {
        int index = projectedShapePoints.size() - 1;
        XYPoint point = projectedShapePoints.get(index);
        StopEntryImpl stop = stopTimes.get(i).getStop();
        XYPoint stopPoint = projection.forward(stop.getStopLocation());
        double d = stopPoint.getDistance(point);
        pindex = new PointAndIndex(point, index, d, maxDistanceTraveled);
      }
      stopTimePoints[i] = pindex;
    }
View Full Code Here

    factory.addPoint(47.66851509562011, -122.29019398384474);
    factory.addPoint(47.66486634286269, -122.29014033966445);
    factory.addPoint(47.66486634286269, -122.29560131721877);
    ShapePoints shapePoints = factory.create();

    UTMProjection projection = UTMLibrary.getProjectionForPoint(
        shapePoints.getLatForIndex(0), shapePoints.getLonForIndex(0));

    ShapePointsLibrary spl = new ShapePointsLibrary();
    List<XYPoint> projectedShapePoints = spl.getProjectedShapePoints(
        shapePoints, projection);

    XYPoint stopPoint = projection.forward(new CoordinatePoint(
        47.664922340500475, -122.29066873484038));

    double[] distanceAlongShape = {0.0, 405.7, 814.0};
    List<PointAndIndex> assignments = spl.computePotentialAssignments(
        projectedShapePoints, distanceAlongShape, stopPoint, 0, 3);
View Full Code Here

    ShapePoints shapePoints = _shapePointService.getShapePointsForShapeIds(shapeIds);

    if (shapePoints == null || shapePoints.isEmpty())
      return null;

    UTMProjection projection = new UTMProjection(utmZoneId);

    List<XYPoint> projected = _shapePointsLibrary.getProjectedShapePoints(
        shapePoints, projection);

    return Tuples.tuple(projected, shapePoints.getDistTraveled());
View Full Code Here

  private void handleOutputAsOSMPolygon(PrintWriter out,
      StopToPolygonEntityHandler handler) throws IOException {

    Geometry geometry = handler.getGeometry();
    UTMProjection proj = handler.getProjection();

    out.println("polygon");
    AtomicInteger index = new AtomicInteger();
    printGeometry(out, geometry, proj, index, false);
    out.println("END");
View Full Code Here

  private void handleOutputAsText(PrintWriter out,
      StopToPolygonEntityHandler handler) {

    Geometry geometry = handler.getGeometry();
    UTMProjection proj = handler.getProjection();

    out.println("polygon");
    AtomicInteger index = new AtomicInteger();
    printGeometry(out, geometry, proj, index, true);
    out.println("END");
View Full Code Here

      Stop stop = (Stop) bean;

      if (_projection == null) {
        int zone = UTMLibrary.getUTMZoneForLongitude(stop.getLon());
        _projection = new UTMProjection(zone);
      }

      XYPoint point = _projection.forward(new CoordinatePoint(stop.getLat(),
          stop.getLon()));
View Full Code Here

TOP

Related Classes of org.onebusaway.geospatial.services.UTMProjection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.