wtimme / OSM-Completionist

⛔️ DEPRECATED iOS companion app for OpenStreetMap that allows contributors to complete missing information
ISC License
18 stars 4 forks source link

[On Hold] Store Overpass queries on OpenStreetMap.org #18

Open wtimme opened 4 years ago

wtimme commented 4 years ago

This is an idea from @tordans (see #13):

Apparently there is an API for the user profile on osm.org which allows to store app specific data which is not used a lot, but Overpass might use it for its "save on osm.org". If so, this could be used to load the same queries in the app

The endpoint he is referring to is /api/0.6/user/preferences.

When saving the queries from overpass turbo, they are available in the XML. Example:

<osm version="0.6" generator="OpenStreetMap server" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
    <preferences>
        <preference k="overpass-ide_query_0_0" v="p=2&n=Trees with `ref` in Berlin&q=LyoKVGhpcyBoYcSGYmVlbiBnxI1lcmF0ZWQgYnkgdGhlIG92xJJwxIlzLXR1cmJvIHdpemFyZC7EgsSdxJ9yaWdpbmFsIHNlxLBjaMSsxIk6CsOiwoDCnMS7xKfEk2w9dHLEjCBhbsSXxZFmIMSFIG5vdMWbdWzEvcWUxJd0eXBlOsWcZGXFiMKdCiovCltvdXQ6anNvbl1bdGltZcW0xbYyNV07"/>
        <preference k="overpass-ide_query-count" v="1"/>
    </preferences>
</osm>
tordans commented 4 years ago

Do you have an idea what format this q query param has?

Looking at the code that writes those preferences at https://github.com/tyrasd/overpass-turbo/blob/master/js/sync-with-osm.js to me (with my limited coding knowledge) it looks like this file does not transform this q-values, it just loads it. This might be a place that decodes the query(?) https://github.com/tyrasd/overpass-turbo/blob/master/js/ide.js#L1412

We could ask tyrasd about it, if this is something that will really help the app. But I am a unsure …

wtimme commented 4 years ago

Thanks for your concerns! Yes, that looks like the place. From what I can tell, the string seems to be encoded with Base64. lzw_decode seems to refer to a compression called Lempel–Ziv–Welch.

the UI on the overpass-turbo-website is not optimized for this usecase (saving queries for external us), so it would not increase the usability for this app a lot.

That's correct; I actually wasn't aware of this functionality until you pointed it out. I don't think the app should primarily use the OSM preferences as the storage backend. However, I think incorporating the exchange of queries between Overpass Turbo and OSM Completionist is something that we can do for sure, as just another form of data source.

There is still the need for an edit UI

100% agreed. At the moment, the UI is an MVP at best.

To summarize, I think we can keep this GitHub issue, but we don't need to rush to it. If someone has the time and wants to look into it, I'm happy about contributions.