Class OsmNetworkReader
- java.lang.Object
-
- org.goplanit.osm.converter.network.OsmNetworkReader
-
- All Implemented Interfaces:
ConverterEntity
,ConverterReader<TransportLayerNetwork<?,?>>
,NetworkReader
public class OsmNetworkReader extends Object implements NetworkReader
Parse OSM input in either *.osm or *.osm.pbf format and return PLANit network instance- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
OsmNetworkReader(String countryName, PlanitOsmNetwork osmNetwork)
Constructorprotected
OsmNetworkReader(URL inputSource, String countryName, PlanitOsmNetwork osmNetwork)
Constructorprotected
OsmNetworkReader(OsmNetworkReaderSettings settings)
Constructorprotected
OsmNetworkReader(PlanitOsmNetwork osmNetwork)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OsmNetworkToZoningReaderData
createNetworkToZoningReaderData()
Factory method to create bridging data required for an OSM zoning reader to successfully parse the Pt zones based on the osm network parsed by this network reader.protected OsmNetworkReaderData
getNetworkReaderData()
Collect the network data gatheredOsmNetworkReaderSettings
getSettings()
Collect the settings which can be used to configure the readervoid
initialiseBeforeParsing()
Call this BEFORE we parse the OSM network to initialise the handler(s) properlyMacroscopicNetwork
read()
Parse a local *.osm or *.osm.pbf file and convert it into a Macroscopic network given the configuration options that have been setprotected void
removeDanglingSubNetworks()
Remove dangling subnetworks when settings dictate itvoid
removeDanglingSubNetworks(Zoning zoning)
remove dangling subnetworks when settings dictate it.void
reset()
reset the reader to allow for marking unnecessary resources for garbage collection-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.converter.network.NetworkReader
getTypeDescription
-
-
-
-
Constructor Detail
-
OsmNetworkReader
protected OsmNetworkReader(PlanitOsmNetwork osmNetwork) throws PlanItException
Constructor- Parameters:
osmNetwork
- network to populate- Throws:
PlanItException
- thrown if error
-
OsmNetworkReader
protected OsmNetworkReader(String countryName, PlanitOsmNetwork osmNetwork) throws PlanItException
Constructor- Parameters:
countryName
- to useosmNetwork
- network to populate- Throws:
PlanItException
- thrown if error
-
OsmNetworkReader
protected OsmNetworkReader(URL inputSource, String countryName, PlanitOsmNetwork osmNetwork) throws PlanItException
Constructor- Parameters:
inputSource
- to usecountryName
- to useosmNetwork
- network to populate- Throws:
PlanItException
- thrown if error
-
OsmNetworkReader
protected OsmNetworkReader(OsmNetworkReaderSettings settings) throws PlanItException
Constructor- Parameters:
settings
- for populating the network- Throws:
PlanItException
- throw if settings are inconsistent with reader configuration (different country name or network used)
-
-
Method Detail
-
initialiseBeforeParsing
public void initialiseBeforeParsing() throws PlanItException
Call this BEFORE we parse the OSM network to initialise the handler(s) properly- Throws:
PlanItException
- thrown if error
-
getNetworkReaderData
protected OsmNetworkReaderData getNetworkReaderData()
Collect the network data gathered- Returns:
- network data
-
removeDanglingSubNetworks
protected void removeDanglingSubNetworks() throws PlanItException
Remove dangling subnetworks when settings dictate it- Throws:
PlanItException
- thrown if error
-
removeDanglingSubNetworks
public void removeDanglingSubNetworks(Zoning zoning) throws PlanItException
remove dangling subnetworks when settings dictate it. In case the removal of subnetworks causes zones to become dangling the user is required to remove those afterwards themselves, by providing the zoning, only the directly impacted connectoids are removed if affected.- Parameters:
zoning
- to also remove connectoids from when they reference removed road/rail subnetworks- Throws:
PlanItException
- thrown if error
-
read
public MacroscopicNetwork read() throws PlanItException
Parse a local *.osm or *.osm.pbf file and convert it into a Macroscopic network given the configuration options that have been set- Specified by:
read
in interfaceConverterReader<TransportLayerNetwork<?,?>>
- Returns:
- macroscopic network that has been parsed
- Throws:
PlanItException
- thrown if error
-
getSettings
public OsmNetworkReaderSettings getSettings()
Collect the settings which can be used to configure the reader- Specified by:
getSettings
in interfaceConverterReader<TransportLayerNetwork<?,?>>
- Returns:
- the settings
-
reset
public void reset()
reset the reader to allow for marking unnecessary resources for garbage collection- Specified by:
reset
in interfaceConverterEntity
-
createNetworkToZoningReaderData
public OsmNetworkToZoningReaderData createNetworkToZoningReaderData()
Factory method to create bridging data required for an OSM zoning reader to successfully parse the Pt zones based on the osm network parsed by this network reader. Without this data it is not possible to relate the two properly- Returns:
- created network to zoning reader data to use
-
-