Tim Waters
Tech Changes to the
OpenStreetMap Stack
OpenHistoricalMap.org
● Very modest, really...
●
● A map of everything that has ever existed.
● It's putting a time slider on the world
● It's the worlds most out of date map.
What it isn't (quite)
Histosm
What it isn't (quite)
Historical Objects in OSM
What it is
Background
Many peoples mind
Slow start
Immense interest
Examples
Hunterston Scotland 19C
Hunterston Scotland Now
Saeby – Denmark 19C
Saeby – Denmark Now
Roman Roads
Roman Mainz
WW1 Trenches
Snows Infected Pump
Snows Infected Pump
Snows Infected Pump.. in OSM
Seattle – Jeff Meyer
Burning Man 2008/9
Manhattan 1854
Manhattan 1854 - Digitzer
NYPL Building Inspector
Data!
How to add stuff to OHM
Imports and tracing
Historical maps
Wikimaps
Wikimaps
Wikimaps
Editing
● JOSM – change URL
●
● Embedded iD editor
●
● Tags – start_date end_date
● (note of source map would be nice)
Simple?
● see frankies presentation
● cart before horse?
● osm way- good enough is best.
● Led by contributors not historical GIS “experts”
● Do whatever and let the rendered sort it out!
Stats
292 users
1,711,788 Ways
106,718,875 Nodes
6 planets so far 1.2G uncompressed
THE STACK
● What is the stack
● Website / API
● Editors
● Database export / changes replication
● Overpass API
● Map tile generation
Website
vagrant up && vagrant ssh
rails s
Embedded id Editor
Database / Replication
osmosis -q --replicate-apidb
authFile=dbAuth.txt
validateSchemaVersion=no
--write-replication
workingDirectory=data
Overpass
http://overpass.openhistoricalmap.org
Map Generation
Get a bit techy
OSM2PGSQL
osm2pgsql --slim
-S ohm_style.style
--tag-transform-script
ohm_tags_transform2.lua
-d ohm_gis -C 16000 --number-
processes 4 ohm.osm
OSM2PGSQL
-S ohm_style.style
node,way start_date date linear
node,way end_date date linear
node,way start_date_year int4 linear
node,way end_date_year int4 linear
OSM2PGSQL
--tag-transform-script
ohm_tags_transform2.lua
https://lists.openstreetmap.org/pipermail/dev/2013-May/026933.html
Kai Kruger
The lua script you pass into osm2pgsql needs to implement 4 functions
function filter_tags_node
function filter_tags_way
function filter_basic_tags_rel
function filter_tags_relation_member
OSM2PGSQL
--tag-transform-script
ohm_tags_transform2.lua
-- dates have to be ISO 8601 format YYYY-MM-DD
-- since postgres only goes as far back as 4713 BC, we'll store the
year in a new key
if (keyvalues["start_date"] ~= nil ) then
year,month,day = nil
year = string.match(keyvalues["start_date"], "^(-?%d+%d%d%d)")
if (year ~= nil) then
y, month = string.match(keyvalues["start_date"], "^(-?%d+%d%d%d)-
(%d%d)")
if (month == nil) then
month = "01"
day = "01"
else
y, m, day = string.match(keyvalues["start_date"], "^(-?%d+%d%d
%d)-(%d%d)-(%d%d)")
if (day == nil) then
day = "01"
end
--because I suck at patterns!
year = string.sub(year, 0, 4)
month = string.sub(month, 0, 2)
day = string.sub(day, 0, 2)
end_date = year.. "-" .. month .. "-"..day
keyvalues["end_date"] = end_date
keyvalues["end_date_year"] = year
else
OSM2PGSQL
--tag-transform-script
ohm_tags_transform2.lua
Maps
Database
Create view
create view planet_osm_line_2008 as
select * from planet_osm_line
where start_date_year = 2008;
insert into geometry_columns...
'planet_osm_line_2008'
Maps
CartoCSS / Mapnik project uses views
"Datasource": {
"type": "postgis",
"table": " (select way,waterwayn
from planet_osm_line_2008 where waterway in
('stream','drain','ditch') and (tunnel is null or
tunnel != 'yes') ) as water_lines_casing",
"extent": "-20037508,-
19929239,20037508,19929239",
"key_field": "",
"geometry_field": "way",
"dbname": "ohm_gis"
},
mod_tile
By Jaimie ohm_mod_tile
Needs review!
Future
● Overpass to do date time queries
● iD filtering - regex on year? time slider
● mod_tile review to propagate down a date range
to tile set
● Use Vector tiles and just use styles for date
queries?
● Front end js vector rendering?
● Mapwarper / wikimaps UI improvements
Join In & hack day activites?
● Overpass to do date time queries
● More map layers (19C, 18C, Roman)
● iD filtering - regex on year? time slider
● mod_tile work review
● Use Vector tiles and just use styles for date queries?
● Front end js vector rendering
● Mapwarper / wikimaps UI improvements
OpenHistoricalMap.org
#ohm on irc.oftc.net
https://lists.openstreetmap.org/listinfo/historic
https://github.com/openhistoricalmap/

Tim waters OpenHistoricalMap Changes to the OSM Stack. SOTM-US 2015