Skip to content

Commit ab29cde

Browse files
committed
Update README
1 parent e4d6922 commit ab29cde

File tree

1 file changed

+96
-21
lines changed

1 file changed

+96
-21
lines changed

README.md

Lines changed: 96 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
# EVMap OSM Data Updater (PoC)
1+
# EVMap OSM Loader
22

3-
This is a proof-of-concept for a charging station data fetcher for
4-
OpenStreetMap. The script fetches all charging stations worldwide through the
5-
Overpass API, preprocesses the data and writes it to a gzip-compressed JSON
6-
file.
7-
8-
## Requirements
9-
10-
- [curl](https://curl.se/)
11-
- [jq](https://stedolan.github.io/jq/)
12-
- [gzip](https://www.gnu.org/software/gzip/)
3+
A Rust implementation of the Overpass API data loader for charging stations.
4+
This tool downloads worldwide charging station data from OpenStreetMap via the
5+
Overpass API and saves it as a compressed JSON file.
136

147
## Data Format
158

169
The resulting gzipped JSON file contains data in the following format:
1710

1811
```json5
1912
{
20-
"timestamp": 1633282807.294814, // UNIX timestamp in seconds
13+
"timestamp": 1633282807, // UNIX timestamp in seconds
14+
"count": 4376, // Number of elements below
2115
"elements": [
2216
{
2317
// Unique numeric ID
2418
"id": 9079237567,
2519
// Latitude, longitude (WGS84 coordinates, I assume)
2620
"lat": 47.0701573,
2721
"lon": 7.5664432,
22+
// Type of element (node, way, relation)
23+
"type": "node",
2824
// Timestamp of last update
2925
"timestamp": "2021-09-10T11:47:56Z",
3026
// Numeric, monotonically increasing version number
@@ -34,29 +30,108 @@ The resulting gzipped JSON file contains data in the following format:
3430
// Raw key-value OSM tags
3531
"tags": {
3632
"amenity": "charging_station",
37-
...
33+
... // More OSM tags
3834
}
3935
},
40-
...
36+
... // More elements
4137
]
4238
}
4339
```
4440

4541
For the tagging schema, see <https://wiki.openstreetmap.org/wiki/DE:Tag:amenity%3Dcharging_station>
4642

43+
## Building
44+
45+
Make sure you have Rust and Cargo installed.
46+
47+
Build the project:
48+
49+
cargo build --release
50+
51+
The binary will be available at `target/release/evmap-osm-loader`.
52+
4753
## Usage
4854

49-
Simply invoke the script:
55+
### Basic Usage
56+
57+
Download charging station data with default settings:
5058

51-
./load-overpass.sh
59+
evmap-osm-loader
5260

53-
Note: The API query may take multiple minutes. The default timeout is set to 15
54-
minutes, but depending on the load on the API endpoint, this may not be
61+
**Note 1:** The API query may take multiple minutes. The default timeout is set
62+
to 15 minutes, but depending on the load on the API endpoint, this may not be
5563
sufficient.
5664

57-
The script can be adjusted by editing the configuration variables. Possible
58-
configuration variables include the Overpass API endpoint or the download
59-
timeout.
65+
**Note 2:** By default, the script uses the Overpass API interpreter at
66+
<https://overpass.osm.ch/api/interpreter>, which returns only data within
67+
Switzerland. This is great for testing with a reduced data set. For a worldwide
68+
result set, you can specify the URL `https://overpass-api.de/api/interpreter`
69+
using the `--overpass-url` option.
70+
71+
Show usage:
72+
73+
evmap-osm-loader --help
74+
75+
### Command-Line Options
76+
77+
```
78+
evmap-osm-loader [OPTIONS]
79+
80+
Options:
81+
--keep-intermediate <BOOL>
82+
Keep intermediate raw response file
83+
[default: false]
84+
85+
--overpass-url <OVERPASS_URL>
86+
Overpass API interpreter URL
87+
[default: https://overpass.osm.ch/api/interpreter]
88+
89+
--timeout-seconds <TIMEOUT_SECONDS>
90+
Timeout in seconds for the Overpass query
91+
[default: 900]
92+
93+
--outfile-raw <OUTFILE_RAW>
94+
Output file for raw response (only written if --keep-intermediate=true)
95+
[default: overpass-result.json]
96+
97+
--outfile-compressed <OUTFILE_COMPRESSED>
98+
Output file for compressed result
99+
[default: charging-stations-osm.json.gz]
100+
101+
-h, --help
102+
Print help
103+
104+
-V, --version
105+
Print version
106+
```
107+
108+
## Query Details
109+
110+
The tool executes the following Overpass QL query:
111+
112+
```
113+
[out:json][timeout:900];
114+
(
115+
node[amenity=charging_station];
116+
area[amenity=charging_station];
117+
relation[amenity=charging_station];
118+
);
119+
out meta qt;
120+
```
121+
122+
This query retrieves:
123+
124+
- All nodes tagged as charging stations
125+
- All areas (ways) tagged as charging stations
126+
- All relations tagged as charging stations
127+
128+
## Future Enhancements
129+
130+
The async architecture allows for future parallelization opportunities, such as:
131+
132+
- Parallel processing of large datasets
133+
- Concurrent API requests for different regions
134+
- Streamed parsing and processing of HTTP response
60135

61136
## License
62137

0 commit comments

Comments
 (0)