Todays mapping tour was interrupted by some thunderstorms. Being out in the woods, I desperately desired a shelter. If you ever thought that mapping hunting stands is a useless waste of time, I can tell you it isn’t :) .
(Picture shamelessly stolen from Wikimedia Commons)
Back to home and coding. I have written a small tool that stuffs some openstreetmap XML data into an sqlite database. The code is not polished (which is an euphemism). I included several exit conditions to detect errors in my SQL statements, but this failed as there are some weird elements in the dataset. So I disabled some of the checks.
This evening, I stuffed the data of Rhineland-Palatinate (as provided by my friends over at Geofabrik) into an sqlite file. As I applied some normalisation, I need to join together three tables to get the desired data out of the database. Firstly there’s a table containing the node ids, their lat and lon values etc. Secondly there’s a table containing all tags. Thirdly there’s a helper table which glues together the nodes and their tags by their ids.
To grab the coordinates of all hunting stands in Rhineland-Palatinate, the following SQL statement will do the job:
select node.lat,node.lon from node join node_tag on node.node_id = node_tag.node_id join tag on node_tag.tag_id = tag.tag_id where tag.key='amenity' and tag.value='hunting_stand';
Of course that's not enough, as one might be interested in hunting stands providing a shelter only. As it is late, I'll save this topic for a later post. Doh :) .