umap icon indicating copy to clipboard operation
umap copied to clipboard

add an api for automatic export

Open yohanboniface opened this issue 10 years ago • 5 comments

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

yohanboniface avatar May 26 '14 15:05 yohanboniface

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!

yohanboniface avatar Jun 13 '14 13:06 yohanboniface

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.

yohanboniface avatar Jun 13 '14 13:06 yohanboniface

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 the datalayer_view template you can find in the urls key.

Yes, this could be more openly documented.

almereyda avatar Mar 13 '16 16:03 almereyda

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. grafik

Wikinaut avatar Jan 12 '22 23:01 Wikinaut

nodejs-code is here: https://github.com/Wikinaut/getumap

Wikinaut avatar Jan 14 '22 23:01 Wikinaut

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.

yohanboniface avatar Nov 27 '23 21:11 yohanboniface

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

hriebl avatar Dec 08 '23 12:12 hriebl

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 ...

hholzgra avatar Dec 08 '23 12:12 hholzgra

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?

prin-underlandscape avatar Mar 27 '24 13:03 prin-underlandscape

As a side-note, FOSSGIS have updated the umap.openstreetmap.de instance to v2.

grafik

  1. 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.
  2. Requests to a map set to Editors only will yield a 403.
  3. 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.

almereyda avatar Mar 28 '24 11:03 almereyda