umap
umap copied to clipboard
add an api for automatic export
Originally reported by: BitBucket: guillaumeallegre, GitHub: guillaumeallegre
I would like to automatically download the geojson export of a map, eg. on a daily basis. This is to track locally the editions of an open map (and perhaps manually revert to a previous version in case of vandalism). A very simple API would be useful for this.
- Bitbucket: https://bitbucket.org/yohanboniface/umap/issue/78
Original comment by Yohan Boniface (BitBucket: yohanboniface, GitHub: yohanboniface):
There is yet a sort of API, even if it's not public :)
Say you want to download data of this map: http://umap.openstreetmap.fr/en/map/prestataires-professionnels-osm-en-france_10299#6/46.324/6.306
You have a geojson entry point: http://umap.openstreetmap.fr/en/map/10299/geojson/ which will return a geojson.
In this geojson, you can look for the datalayers
key to get all the layers, and then request them using the datalayer_view
template you can find in the urls
key.
You may need to authenticate, according to the map settings. This is not managed by the current entry points, so let's say for now you only want public maps ;)
Nothing official here, but I promise to ping you if something change ;)
Hope it's usable enough for you!
Original comment by BitBucket: guillaumeallegre, GitHub: guillaumeallegre:
Yeah, thanks, it'll do the job.
If one day somehow noninteractive authentication is possible, let us know! Thanks again.
Please note we just ran into #174 trying to export as much raw data from uMap as possible. It also appeared the mime-type
for the geojson/
endpoint is not properly set; a browser tries to download a geojson.html
instead of map#.geojson
.
In this geojson, you can look for the
datalayers
key to get all the layers, and then request them using thedatalayer_view
template you can find in theurls
key.
Yes, this could be more openly documented.
Has anyone a working script for doing the steps programatically?
I my humble opion, the download "all" link should be a static perma link on the umap.
nodejs-code is here: https://github.com/Wikinaut/getumap
There is now a direct link to download full map data, eg.: https://umap.openstreetmap.fr/map/1/download/ where 1
is the id of the map.
This is not yet implemented on the German server, right? Or am I using the wrong URL?
- https://umap.openstreetmap.de/de/map/entsorgungsbetriebe-lubeck_49064 ➡️ works
- https://umap.openstreetmap.de/map/49064/download/ ➡️ doesn't work
The maintainer (not me) of the openstreetmap.de instance hosted by FOSSGIS e.V. is working on getting the site updated, but it is still work in progress right now ...
uMap is a fantastic project, but I lack an API that enables me to upload either a layer or the entire map. Is there any chance of it being implemented?
As a side-note, FOSSGIS have updated the umap.openstreetmap.de instance to v2.
- It now offers the download button and with that a "download API" to retrieve maps with permissions set to Everyone (Public) and Everyone with the link.
- Requests to a map set to Editors only will yield a 403.
- Additionally it is possible to craft a request to download multiple (public) maps at once:
https://umap.openstreetmap.de/de/me/download?map_id=1706&map_id=49064
Automation of cases (2.) and (3.), an "automatic export API", would probably be possible with authorising the requests with a valid authentication cookie.