|
Routify Documentation
|
Public Member Functions | |
| JSONArray | getNodes () |
| JSONArray | getWays () |
| OsmParser (String pathOfSourceFile) throws FileNotFoundException, ParseException | |
| void | initializeGraph (CustomGraph< CustomVertex, CustomEdge > graph) |
| void | clear () |
| void | exportOsmIdToCoordinates (String path) |
Static Public Member Functions | |
| static void | main (String[] args) throws FileNotFoundException, ParseException, IOException |
Parses OSM raw output from the Overpass Turbo API and initializes a graph representation of the data. It supports handling nodes and ways to construct vertices and edges in the graph.
|
inline |
Constructs an OsmParser and loads data from a specified source file.
| pathOfSourceFile | Path to the GeoJSON file containing OSM data. |
| FileNotFoundException | If the source file is not found. |
| ParseException | If parsing the JSON data fails. |
|
inline |
Clears internal data structures to release memory.
|
inline |
Exports a mapping of OSM IDs to their corresponding latitude and longitude coordinates to a specified file. The method iterates over a collection of nodes, each represented as a JSONObject, extracting the OSM ID, latitude, and longitude. These details are then formatted and written to a file in a JSON structure.
| path | The file system path where the exported JSON file will be saved. It specifies the location and name of the file. The method assumes that the path is valid and that it has the necessary permissions to write to it. |
| IOException | If an I/O error occurs during writing to the file. This includes cases where the file cannot be opened for writing, if there is an error during writing to the file, or if the file cannot be closed. |
|
inline |
|
inline |
|
inline |
Initializes the graph with vertices and edges based on the parsed OSM data.
| graph | The graph to be initialized. |
|
inlinestatic |
Main method to demonstrate the usage of OsmParser.
| args | Command line arguments (not used). |
| FileNotFoundException | If the source file is not found. |
| ParseException | If parsing the JSON data fails. |
| IOException | If an I/O error occurs. |