public class StreetLayer extends Object implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
static EnumSet<EdgeStore.EdgeFlag> |
ALL_PERMISSIONS |
StreetLayer |
baseStreetLayer
Some StreetLayers are created by applying a scenario to an existing StreetLayer.
|
gnu.trove.map.TIntObjectMap<BikeRentalStation> |
bikeRentalStationMap |
boolean |
bikeSharing |
EdgeStore |
edgeStore |
com.vividsolutions.jts.geom.Envelope |
envelope
Envelope of this street layer, in decimal degrees (floating, not fixed-point)
|
List<gnu.trove.list.TIntList> |
incomingEdges |
static int |
INITIAL_LINK_RADIUS_METERS
Searching for streets takes a fair amount of computation, and the number of streets examined grows roughly as
the square of the radius.
|
static double |
LINK_RADIUS_METERS
The radius of a circle in meters within which to search for nearby streets.
|
static int |
MIN_SUBGRAPH_SIZE
Minimum allowable size (in number of vertices) for a disconnected subgraph; subgraphs smaller than these will be removed.
|
List<gnu.trove.list.TIntList> |
outgoingEdges |
TransportNetwork |
parentNetwork
The TransportNetwork containing this StreetLayer.
|
gnu.trove.map.TIntObjectMap<ParkRideParking> |
parkRideLocationsMap |
String |
scenarioId
A string uniquely identifying the contents of this StreetLayer among all StreetLayers.
|
IntHashGrid |
spatialIndex
A spatial index of all street network edges, using fixed-point WGS84 coordinates.
|
List<TurnRestriction> |
turnRestrictions
Turn restrictions can potentially affect (include) several edges, so they are stored here and referenced
by index within all edges that are affected by them.
|
VertexStore |
vertexStore |
IndexedPolygonCollection |
waitTimePolygons
This set of polygons specifies a spatially varying wait time to use a ride hailing service.
|
Constructor and Description |
---|
StreetLayer(TNBuilderConfig tnBuilderConfig) |
Modifier and Type | Method and Description |
---|---|
void |
associateBikeSharing(TNBuilderConfig tnBuilderConfig)
Creates vertices to represent each bike rental station.
|
void |
associateStops(TransitLayer transitLayer)
For every stop in a TransitLayer, find or create a nearby vertex in the street layer and record the connection
between the two.
|
void |
buildEdgeLists()
The edge lists (which edges go out of and come into each vertex) are derived from the edges in the EdgeStore.
|
StreetLayer |
clone() |
int |
createAndLinkVertex(double lat,
double lon)
Create a street-layer vertex representing a transit stop, and connect that new vertex to the street network if
possible.
|
List<BikeRentalStation> |
findBikeSharesInEnvelope(com.vividsolutions.jts.geom.Envelope env)
Finds all the bike share stations in given envelope.
|
gnu.trove.set.TIntSet |
findEdgesInEnvelope(com.vividsolutions.jts.geom.Envelope envelope)
Rather than querying the spatial index directly, going through this method will ensure that any temporary edges
not in the index are also visible.
|
List<ParkRideParking> |
findParkRidesInEnvelope(com.vividsolutions.jts.geom.Envelope env)
Finds all the P+R stations in given envelope.
|
Split |
findSplit(double lat,
double lon,
double radiusMeters,
StreetMode streetMode)
Find a location on an existing street near the given point, without actually creating any vertices or edges.
|
com.vividsolutions.jts.geom.Envelope |
getEnvelope() |
String |
getNameEdgeIdx(int edgeIdx,
Locale locale)
Gets way name from OSM name tag
It uses OSM Mapdb
Uses
getName(long, Locale) |
int |
getOrCreateVertexNear(double lat,
double lon,
StreetMode streetMode)
Find an existing street vertex near the supplied coordinates, or create a new one if there are no vertices
near enough.
|
int |
getVertexCount() |
int |
getWaitTime(double lat,
double lon) |
String |
getWayTags(EdgeStore.Edge edge)
Gets all the OSM tags of specified OSM way
Tags are returned as tag=value separated with ;
AKA same format that
OSMEntity.setTagsFromString(String) accepts |
void |
indexStreets() |
boolean |
isScenarioCopy() |
void |
loadFromOsm(com.conveyal.osmlib.OSM osm)
Load street layer from an OSM-lib OSM DB
|
static void |
logFixedPointGeometry(String label,
com.vividsolutions.jts.geom.Geometry fixedPointGeometry)
Given a JTS Geometry in fixed-point latitude and longitude, log it as floating-point GeoJSON.
|
void |
openOSM(File file)
TODO Javadoc.
|
StreetLayer |
scenarioCopy(TransportNetwork newScenarioNetwork,
boolean willBeModified)
We intentionally avoid using clone() on EdgeStore and VertexStore so all field copying is explicit and we can
clearly see whether we are accidentally shallow-copying any collections or data structures from the base graph.
|
com.vividsolutions.jts.geom.Geometry |
scenarioEdgesBoundingGeometry(int radiusMeters)
Create a geometry in FIXED POINT DEGREES containing all the points on all edges created or removed by the
scenario that produced this StreetLayer, buffered by radiusMeters.
|
int |
splitEdge(Split split)
Perform destructive splitting of edges
FIXME: currently used only in P+R.
|
String |
toString() |
public static final int MIN_SUBGRAPH_SIZE
public static final double LINK_RADIUS_METERS
public static final int INITIAL_LINK_RADIUS_METERS
public transient List<gnu.trove.list.TIntList> outgoingEdges
public transient List<gnu.trove.list.TIntList> incomingEdges
public transient IntHashGrid spatialIndex
public gnu.trove.map.TIntObjectMap<BikeRentalStation> bikeRentalStationMap
public gnu.trove.map.TIntObjectMap<ParkRideParking> parkRideLocationsMap
public com.vividsolutions.jts.geom.Envelope envelope
public VertexStore vertexStore
public EdgeStore edgeStore
public List<TurnRestriction> turnRestrictions
public TransportNetwork parentNetwork
public String scenarioId
public StreetLayer baseStreetLayer
public IndexedPolygonCollection waitTimePolygons
public static final EnumSet<EdgeStore.EdgeFlag> ALL_PERMISSIONS
public boolean bikeSharing
public StreetLayer(TNBuilderConfig tnBuilderConfig)
public void loadFromOsm(com.conveyal.osmlib.OSM osm)
public void openOSM(File file)
public String getNameEdgeIdx(int edgeIdx, Locale locale)
getName(long, Locale)
edgeIdx
- edgeStore EdgeIDXlocale
- which locale to usepublic String getWayTags(EdgeStore.Edge edge)
OSMEntity.setTagsFromString(String)
acceptsedge
- for which to get tagspublic void indexStreets()
public gnu.trove.set.TIntSet findEdgesInEnvelope(com.vividsolutions.jts.geom.Envelope envelope)
public void buildEdgeLists()
public int getOrCreateVertexNear(double lat, double lon, StreetMode streetMode)
findSplit(double, double, double, StreetMode)
and Split
which require the spatial
index to already be built. In other works indexStreets()
needs to be called before this is used.
TODO potential refactor: rename this method Split.perform(), and store a ref to streetLayer in Split.lat
- latitude in floating point geographic (not fixed point) degrees.lon
- longitude in floating point geographic (not fixed point) degrees.streetMode
- Link to edges which have permission for StreetModepublic int splitEdge(Split split)
public int createAndLinkVertex(double lat, double lon)
public Split findSplit(double lat, double lon, double radiusMeters, StreetMode streetMode)
lat
- latitude in floating point geographic coordinates (not fixed point int coordinates)lon
- longitude in floating point geographic coordinates (not fixed point int coordinates)streetMode
- a mode of travel that the street must allowpublic void associateStops(TransitLayer transitLayer)
public int getVertexCount()
public com.vividsolutions.jts.geom.Envelope getEnvelope()
public StreetLayer scenarioCopy(TransportNetwork newScenarioNetwork, boolean willBeModified)
willBeModified
- must be true if the scenario to be applied will make any changes to the new StreetLayer
copy. This allows some optimizations (the lists in the StreetLayer will not be wrapped).public void associateBikeSharing(TNBuilderConfig tnBuilderConfig)
public StreetLayer clone()
public boolean isScenarioCopy()
public com.vividsolutions.jts.geom.Geometry scenarioEdgesBoundingGeometry(int radiusMeters)
public static void logFixedPointGeometry(String label, com.vividsolutions.jts.geom.Geometry fixedPointGeometry)
public List<ParkRideParking> findParkRidesInEnvelope(com.vividsolutions.jts.geom.Envelope env)
env
- Envelope in float degreespublic List<BikeRentalStation> findBikeSharesInEnvelope(com.vividsolutions.jts.geom.Envelope env)
env
- Envelope in float degreespublic int getWaitTime(double lat, double lon)
lat
- latitude of the starting point in floating point degreeslon
- longitude the starting point in floating point degreesCopyright © 2019. All rights reserved.