Wmo & Co

Pulling waypoints from an OpenStreetmap .OSM file

Before going on holiday, I like to gather the OpenStreetMap waypoints for the area I'll be staying at. This is the process.

Download an .osm file

Eg. pick one from download.geofabrik.de

Pull out all the nodes of the area of interest

The area is determined by lat,lon coordinates and the distance from this point. Eg. pulling data from the central-america .osm file, in radius of 10k around Willemstad, Curacao:

./pull central-america-latest.osm 12.1166 -68.9333 10  > willemstad10k.csv

Source code for pull.go on github.


Subsetting, selecting, etc.. using Python Pandas

Read the .csv file in Pandas (in an ipython session) :

import pandas as pd


Sort according to distance, and convert tags to lowercase:


Subset the restaurants

r = df[df.tags.str.contains("restau")][['lat','lon','name','dist','tags']]

Now give me the chinese restaurants


           lat        lon                        name   dist  tags
1917  12.120777 -68.897536  Chinese Restaurant and Bar  3.91  "[ .. {name chinese restaurant and bar}..
1872  12.121817 -68.895336                      Chindy  4.16  "[ .. {cuisine chinese} ..
2189  12.154782 -68.946812     Santa Maria Food Center  4.49  "[ .. {cuisine chinese} ..
1575  12.124456 -68.889972                       Winer  4.79  "[ .. {cuisine chinese} ..

See more detail (plus the source code) at github.com/wmo/pull_osm_nodes

Notes by Willem Moors. Generated on nini:/home/willem/sync/20140923_blog at 2018-06-16 11:17