Skip to content

Instantly share code, notes, and snippets.

@manuelep
Created October 7, 2017 22:08
Show Gist options
  • Save manuelep/8873272dd68961f35c1b686c963dbf41 to your computer and use it in GitHub Desktop.
Save manuelep/8873272dd68961f35c1b686c963dbf41 to your computer and use it in GitHub Desktop.
osm model
# -*- coding: utf-8 -*-
osm = DAL(myconf.get('osm.uri'),
pool_size = myconf.get('osm.pool_size'),
migrate_enabled = False,
check_reserved = ['all'],
lazy_tables = True
)
commons = osm.Table(osm, "commons",
Field("f_access", "text", rname="access"),
Field("addr_housename" "text", rname='"addr:housename"'),
Field("addr_housenumber" "text", rname='"addr:housenumber"'),
Field("addr_interpolation", "text", rname='"addr:interpolation"'),
Field("admin_level", "text"),
Field("aerialway", "text"),
Field("aeroway", "text"),
Field("amenity", "text"),
Field("area", "text"),
Field("barrier", "text"),
Field("bicycle", "text"),
Field("brand", "text"),
Field("bridge", "text"),
Field("boundary", "text"),
Field("building", "text"),
Field("construction", "text"),
Field("covered", "text"),
Field("culvert", "text"),
Field("cutting", "text"),
Field("denomination", "text"),
Field("disused", "text"),
Field("embankment", "text"),
Field("foot", "text"),
Field("generator_source", "text", rname='"generator:source"'),
Field("harbour", "text"),
Field("highway", "text"),
Field("historic", "text"),
Field("horse", "text"),
Field("intermittent", "text"),
Field("junction", "text"),
Field("landuse", "text"),
Field("layer", "text"),
Field("leisure", "text"),
Field("f_lock", "text", rname="lock"),
Field("man_made", "text"),
Field("military", "text"),
Field("motorcar", "text"),
Field("name", "text"),
Field("f_natural", "text", rname="natural"),
Field("office", "text"),
Field("oneway", "text"),
Field("f_operator", "text", rname="operator"),
Field("place", "text"),
Field("population", "text"),
Field("f_power", "text", rname="power"),
Field("power_source", "text"),
Field("public_transport", "text"),
Field("railway", "text"),
Field("f_ref", "text", rname="ref"),
Field("religion", "text"),
Field("route", "text"),
Field("service", "text"),
Field("shop", "text"),
Field("sport", "text"),
Field("surface", "text"),
Field("toll", "text"),
Field("tourism", "text"),
Field("tower_type", "text", rname='"tower:type"'),
Field("tunnel", "text"),
Field("water", "text"),
Field("waterway", "text"),
Field("wetland", "text"),
Field("width", "text"),
Field("wood", "text"),
Field("z_order", "integer"),
)
osm.define_table("planet_osm_point",
Field("id", "id", rname="osm_id"),
commons,
Field("capital", "text"),
Field("ele", "text"),
Field("way", "geometry()")
)
osm.define_table("planet_osm_line",
Field("id", "id", rname="osm_id"),
commons,
Field("way", "geometry()")
)
osm.define_table("planet_osm_polygon",
Field("id", "id", rname="osm_id"),
commons,
Field("way_area", "double"),
Field("way", "geometry()")
)
osm.define_table("planet_osm_roads",
Field("id", "id", rname="osm_id"),
commons,
Field("way_area", "double"),
Field("way", "geometry()")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment