This is a proof-of-concept for a charging station data fetcher for OpenStreetMap. The script fetches all charging stations worldwide through the Overpass API, preprocesses the data and writes it to a gzip-compressed JSON file.
The resulting gzipped file contains one JSON object per line.
The first line is a metadata object and may be skipped. All subsequent lines contain one JSON charging station object per line.
Format of the metadata object:
{
"type": "meta",
// UNIX timestamp in seconds
"timestamp": 1633282807,
// Generator URL
"generator": "https://github.com/dbrgn/evmap-osm"
}
Format of a charging station:
{
// Unique numeric ID
"id": 9079237567,
// Latitude, longitude (WGS84 coordinates, I assume)
"lat": 47.0701573,
"lon": 7.5664432,
// Timestamp of last update
"timestamp": "2021-09-10T11:47:56Z",
// Numeric, monotonically increasing version number
"version": 1,
// User that last modified this POI
"user": "dbrgn",
// Raw key-value OSM tags
"tags": {
"amenity": "charging_station",
...
}
}
For the tagging schema, see https://wiki.openstreetmap.org/wiki/DE:Tag:amenity%3Dcharging_station
Simply invoke the script:
./load-overpass.sh
Note: The API query may take multiple minutes. The default timeout is set to 15 minutes, but depending on the load on the API endpoint, this may not be sufficient.
The script can be adjusted by editing the configuration variables. Possible configuration variables include the Overpass API endpoint or the download timeout.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.