java.lang.Object
org.jgrapht.osm.OsmCoordinatesReader
Reads a headerless
node_id,lat,lon CSV (the companion file produced by
GpkgRoadGraphPreprocessor) into a Map<Integer, double[]> keyed by node
id, with each value an array {lat, lon} in decimal degrees. Pair with
HaversineHeuristic.ofMap(Map) for A* heuristics over the loaded graph.
Edge / node CSVs are intentionally separate files: the edge list goes through
CSVImporter (which is graph-shaped), and the coordinate table is a flat
key-value resource that does not fit the importer interface.
- Author:
- Shai Eilat
-
Method Summary
Modifier and TypeMethodDescriptionreadGzipped(InputStream gzippedCsv) Reads the gzipped coordinates stream into a map.readGzippedFile(Path path) Reads the gzipped coordinates file into a map.readGzippedResource(Class<?> anchor, String resource) Reads the gzipped coordinates resource into a map.
-
Method Details
-
readGzippedResource
public static Map<Integer,double[]> readGzippedResource(Class<?> anchor, String resource) throws IOException Reads the gzipped coordinates resource into a map.- Parameters:
anchor- anchor class forClass.getResourceAsStream(java.lang.String)resource- resource path (must point at a gzipped CSV)- Returns:
- a map from node id to
{lat, lon} - Throws:
IOException- on missing resource or parse error
-
readGzippedFile
Reads the gzipped coordinates file into a map.- Parameters:
path- file path (must point at a gzipped CSV)- Returns:
- a map from node id to
{lat, lon} - Throws:
IOException- on parse error
-
readGzipped
Reads the gzipped coordinates stream into a map. The caller closes the stream.- Parameters:
gzippedCsv- gzipped CSV input stream- Returns:
- a map from node id to
{lat, lon} - Throws:
IOException- on parse error
-