Skip to content

Instantly share code, notes, and snippets.

@rrzefox
Created November 27, 2015 14:19
Show Gist options
  • Save rrzefox/ac64742a7e3a7406c9f5 to your computer and use it in GitHub Desktop.
Save rrzefox/ac64742a7e3a7406c9f5 to your computer and use it in GitHub Desktop.
view to map the columns of default osm2pgqsql style to a hstore-modified one
drop view view_osm_polygon;
create view view_osm_polygon as
select
osm_id,
"access",
tags->'addr:housename' as "addr:housename",
"addr:housenumber",
"addr:interpolation",
admin_level,
tags->'aerialway' as aerialway,
tags->'aeroway' as aeroway,
amenity,
area,
barrier,
bicycle,
tags->'brand' as brand,
bridge,
boundary,
building,
tags->'construction' as construction,
tags->'covered' as covered,
tags->'culvert' as culvert,
tags->'cutting' as cutting,
tags->'denomination' as denomination,
tags->'disused' as disused,
tags->'embankment' as embankment,
foot,
tags->'generator_source' as "generator:source",
tags->'harbour' as harbour,
highway,
tags->'historic' as historic,
tags->'horse' as horse,
intermittent,
tags->'junction' as junction,
landuse,
layer,
leisure,
tags->'lock' as "lock",
man_made,
tags->'military' as military,
tags->'motorcar' as motorcar,
name,
"natural",
tags->'office' as office,
oneway,
operator,
place,
tags->'population' as population,
power,
tags->'power_source' as power_source,
public_transport,
railway,
ref,
tags->'religion' as religion,
route,
service,
shop,
tags->'sport' as sport,
surface,
tags->'toll' as toll,
tourism,
tags->'tower:type' as "tower:type",
tracktype,
tunnel,
tags->'water' as water,
waterway,
tags->'wetland' as wetland,
width,
tags->'wood' as wood,
z_order,
way_area,
tags,
way
from planet_osm_polygon;
grant select on view_osm_polygon to public;
drop view view_osm_roads;
create view view_osm_roads as
select
osm_id,
"access",
tags->'addr:housename' as "addr:housename",
"addr:housenumber",
"addr:interpolation",
admin_level,
tags->'aerialway' as aerialway,
tags->'aeroway' as aeroway,
amenity,
area,
barrier,
bicycle,
tags->'brand' as brand,
bridge,
boundary,
building,
tags->'construction' as construction,
tags->'covered' as covered,
tags->'culvert' as culvert,
tags->'cutting' as cutting,
tags->'denomination' as denomination,
tags->'disused' as disused,
tags->'embankment' as embankment,
foot,
tags->'generator_source' as "generator:source",
tags->'harbour' as harbour,
highway,
tags->'historic' as historic,
tags->'horse' as horse,
intermittent,
tags->'junction' as junction,
landuse,
layer,
leisure,
tags->'lock' as "lock",
man_made,
tags->'military' as military,
tags->'motorcar' as motorcar,
name,
"natural",
tags->'office' as office,
oneway,
operator,
place,
tags->'population' as population,
power,
tags->'power_source' as power_source,
public_transport,
railway,
ref,
tags->'religion' as religion,
route,
service,
shop,
tags->'sport' as sport,
surface,
tags->'toll' as toll,
tourism,
tags->'tower:type' as "tower:type",
tracktype,
tunnel,
tags->'water' as water,
waterway,
tags->'wetland' as wetland,
width,
tags->'wood' as wood,
z_order,
way_area,
tags,
way
from planet_osm_roads;
grant select on view_osm_roads to public;
drop view view_osm_line;
create view view_osm_line as
select
osm_id,
"access",
tags->'addr:housename' as "addr:housename",
"addr:housenumber",
"addr:interpolation",
admin_level,
tags->'aerialway' as aerialway,
tags->'aeroway' as aeroway,
amenity,
area,
barrier,
bicycle,
tags->'brand' as brand,
bridge,
boundary,
building,
tags->'construction' as construction,
tags->'covered' as covered,
tags->'culvert' as culvert,
tags->'cutting' as cutting,
tags->'denomination' as denomination,
tags->'disused' as disused,
tags->'embankment' as embankment,
foot,
tags->'generator_source' as "generator:source",
tags->'harbour' as harbour,
highway,
tags->'historic' as historic,
tags->'horse' as horse,
intermittent,
tags->'junction' as junction,
landuse,
layer,
leisure,
tags->'lock' as "lock",
man_made,
tags->'military' as military,
tags->'motorcar' as motorcar,
name,
"natural",
tags->'office' as office,
oneway,
operator,
place,
tags->'population' as population,
power,
tags->'power_source' as power_source,
public_transport,
railway,
ref,
tags->'religion' as religion,
route,
service,
shop,
tags->'sport' as sport,
surface,
tags->'toll' as toll,
tourism,
tags->'tower:type' as "tower:type",
tracktype,
tunnel,
tags->'water' as water,
waterway,
tags->'wetland' as wetland,
width,
tags->'wood' as wood,
z_order,
way_area,
tags,
way
from planet_osm_line;
grant select on view_osm_line to public;
drop view view_osm_point;
create view view_osm_point as
select
osm_id,
"access",
tags->'addr:housename' as "addr:housename",
"addr:housenumber",
"addr:interpolation",
admin_level,
tags->'aerialway' as aerialway,
tags->'aeroway' as aeroway,
amenity,
area,
barrier,
bicycle,
tags->'brand' as brand,
bridge,
boundary,
building,
tags->'capital' as capital,
tags->'construction' as construction,
tags->'covered' as covered,
tags->'culvert' as culvert,
tags->'cutting' as cutting,
tags->'denomination' as denomination,
tags->'disused' as disused,
ele,
tags->'embankment' as embankment,
foot,
tags->'generator_source' as "generator:source",
tags->'harbour' as harbour,
highway,
tags->'historic' as historic,
tags->'horse' as horse,
intermittent,
tags->'junction' as junction,
landuse,
layer,
leisure,
tags->'lock' as "lock",
man_made,
tags->'military' as military,
tags->'motorcar' as motorcar,
name,
"natural",
tags->'office' as office,
oneway,
operator,
place,
tags->'poi' as poi,
tags->'population' as population,
power,
tags->'power_source' as power_source,
public_transport,
railway,
ref,
tags->'religion' as religion,
route,
service,
shop,
tags->'sport' as sport,
surface,
tags->'toll' as toll,
tourism,
tags->'tower:type' as "tower:type",
tunnel,
tags->'water' as water,
waterway,
tags->'wetland' as wetland,
width,
tags->'wood' as wood,
z_order,
tags,
way
from planet_osm_point;
grant select on view_osm_point to public;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment