NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I wish to create some statistic about a distance from different places in a city to the nearest bus station. For this, naturally, I need to check if a certain point is related to a street or not. I intend to do this via a python script, but I don't really know how to approach this. I know python fairly way, and I was hoping to use a python API rather than learning an entire API from scratch for a hobby project.

Any pointers?

asked 16 Nov '14, 16:06

Yotam's gravatar image

Yotam
16223
accept rate: 0%

edited 16 Nov '14, 17:20

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


You will likely not get around understanding the OSM data model regardless of which API you use. Given that the model is actually very simple that should not be a problem. The

See

http://wiki.openstreetmap.org/wiki/Elements

http://wiki.openstreetmap.org/wiki/API_v0.6

specifically for your problem see the "Ways for node" call.

A possible python API is http://wiki.openstreetmap.org/wiki/Osmapi

That was the good news.

The bad news is that you are problably setting about this completely wrong.

If this is any more than a very very low volume cursory check you want to do, you should not try to do this via the editing API in the first place. Particularly if this is something you want to do on a regular base you will want to import osm data in to a suitable database schema and perform queries on that database.

Potentially (your question is not quite clear about what kind of distance you are trying to determine, straight line or an actual route on the road/way network) you should be doing this with a routing service/api see for example the accessibility analysis on http://openrouteservice.org/ .

If you give some more information on what you are actually trying to acheive, we can probably give some more pointers.

permanent link

answered 16 Nov '14, 22:01

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 16 Nov '14, 22:05

Hi. Thanks for the replay. My initial though was to create a heat map of my city that show how far is a certain address from the nearest bus stop. I now think that maybe graph that shows the number of houses as a function of distance from the nearest bus stop would be good too. If I could harvest data about bus frequency at each stop, I would factor that in too. But that is not a priority for me.

Note that I have a (hebrew) list of streets in my city, but not house numbers.

(17 Nov '14, 09:13) Yotam

According to the OSM wiki about Overpass_API there is a python wrapper for queries:

This leads you to https://github.com/mvexel/overpass-api-python-wrapper

permanent link

answered 17 Nov '14, 05:48

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×290
×144
×78
×45
×33

question asked: 16 Nov '14, 16:06

question was seen: 7,294 times

last updated: 17 Nov '14, 09:16

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum