Search in sources :

Example 1 with NodeLocation

use of org.openstreetmap.osmosis.pgsimple.common.NodeLocation in project voltdb by VoltDB.

the class WayPolygonGeometryBuilder method createRing.

public LinearRing createRing(Way way) {
    List<Point> points = new ArrayList<Point>();
    for (WayNode wayNode : way.getWayNodes()) {
        NodeLocation nodeLocation;
        double longitude;
        double latitude;
        nodeLocation = locationStore.getNodeLocation(wayNode.getNodeId());
        longitude = nodeLocation.getLongitude();
        latitude = nodeLocation.getLatitude();
        if (nodeLocation.isValid()) {
            Point point = new Point(longitude, latitude);
            points.add(point);
        }
    }
    return new LinearRing(points.toArray(new Point[0]));
}
Also used : WayNode(org.openstreetmap.osmosis.core.domain.v0_6.WayNode) NodeLocation(org.openstreetmap.osmosis.pgsimple.common.NodeLocation) ArrayList(java.util.ArrayList) Point(org.postgis.Point) LinearRing(org.postgis.LinearRing)

Aggregations

ArrayList (java.util.ArrayList)1 WayNode (org.openstreetmap.osmosis.core.domain.v0_6.WayNode)1 NodeLocation (org.openstreetmap.osmosis.pgsimple.common.NodeLocation)1 LinearRing (org.postgis.LinearRing)1 Point (org.postgis.Point)1