You are not logged in.

#1 2021-09-14 15:49:16

Shohreh
Member
Registered: 2012-12-15
Posts: 226

[Bike trip] Script to query OSM and grab list of cities/towns in trip?

Hello,

As a low-fi backup for my smarphone that I use as GPS during bike trips, I'm thinking of printing it on a single page to have a rough idea where I should head using a compass, and run a script that will 1) take the (simplfied down to 500 points) trip as input, 2) query OSM for all the towns and cities along the way, and 3) output the list that I'll then use as a road book.

Provided Overpass won't complain with too many queries, would someone have some code to share (ideally Python)?

Thank you.

Offline

#2 2021-09-14 15:59:24

mmd
Member
Registered: 2010-11-06
Posts: 1,936

Re: [Bike trip] Script to query OSM and grab list of cities/towns in trip?

You can use my blog post as a starting point:

https://www.openstreetmap.org/user/mmd/diary/42055



Same question was also posted here: https://help.openstreetmap.org/question … ns-in-trip

Last edited by mmd (2021-09-14 16:01:22)

Offline

#3 2021-09-15 07:54:41

Shohreh
Member
Registered: 2012-12-15
Posts: 226

Re: [Bike trip] Script to query OSM and grab list of cities/towns in trip?

Thanks much!

Offline

#4 2021-09-15 11:37:47

mmd
Member
Registered: 2010-11-06
Posts: 1,936

Re: [Bike trip] Script to query OSM and grab list of cities/towns in trip?

You seem to have asked some follow up question on Help OSM. This is a bit confusing and not that helpful for other readers.
I would recommend to stick to one site, rather than spreading your question over two sites.

Last edited by mmd (2021-09-15 11:39:21)

Offline

#5 2021-09-16 15:52:57

Shohreh
Member
Registered: 2012-12-15
Posts: 226

Re: [Bike trip] Script to query OSM and grab list of cities/towns in trip?

Because I didn't know which site was more read, and more likely to get replies.

Incidently, why two sites?

Offline

#6 2021-09-16 20:24:20

mmd
Member
Registered: 2010-11-06
Posts: 1,936

Re: [Bike trip] Script to query OSM and grab list of cities/towns in trip?

Ok, if you want to query nodes and ways at the same time, you can use "nw" instead of "nodes". It's described in more detail here: https://dev.overpass-api.de/blog/total_ … _shortcuts

I don't know why we have two sites. As both run on no longer maintained software, they will be replaced anyway by Discourse at some point.

Offline

#7 2021-09-17 16:35:54

Shohreh
Member
Registered: 2012-12-15
Posts: 226

Re: [Bike trip] Script to query OSM and grab list of cities/towns in trip?

Thank you.

Offline

Board footer

Powered by FluxBB