Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit d55358ccfc312a45bc622d3484e476d8514afab3 1 parent e8d0409
asc authored
Showing with 50 additions and 0 deletions.
  1. +12 −0 osm/README.md
  2. +38 −0 osm/motorways.pgsql
View
12 osm/README.md
@@ -0,0 +1,12 @@
+motorways.pgsql
+--
+
+This is a series of Postgres commands for creating a new table called
+'planet_osm_motorways' derived from the 'planet_osm_line' table.
+
+For example:
+
+ psql -U osm planet_osm < motorways.pgsql
+
+Remember: This means you will need to have finished setting up a local
+planet_osm database before you do this.
View
38 osm/motorways.pgsql
@@ -0,0 +1,38 @@
+SELECT DropGeometryColumn('', 'planet_osm_motorways', 'way_orig');
+SELECT DropGeometryColumn('', 'planet_osm_motorways', 'way_zoom6');
+SELECT DropGeometryColumn('', 'planet_osm_motorways', 'way_zoom7');
+SELECT DropGeometryColumn('', 'planet_osm_motorways', 'way_zoom8');
+SELECT DropGeometryColumn('', 'planet_osm_motorways', 'way_zoom9');
+
+DROP TABLE "planet_osm_motorways";
+
+BEGIN;
+
+CREATE TABLE "planet_osm_motorways" (
+
+ osm_id INTEGER,
+ highway TEXT,
+ name TEXT,
+ ref TEXT,
+ route TEXT
+
+);
+
+SELECT AddGeometryColumn('', 'planet_osm_motorways', 'way_orig', '900913', 'LINESTRING', 2);
+SELECT AddGeometryColumn('', 'planet_osm_motorways', 'way_zoom6', '900913', 'LINESTRING', 2);
+SELECT AddGeometryColumn('', 'planet_osm_motorways', 'way_zoom7', '900913', 'LINESTRING', 2);
+SELECT AddGeometryColumn('', 'planet_osm_motorways', 'way_zoom8', '900913', 'LINESTRING', 2);
+SELECT AddGeometryColumn('', 'planet_osm_motorways', 'way_zoom9', '900913', 'LINESTRING', 2);
+
+INSERT INTO "planet_osm_motorways"
+
+ SELECT osm_id, name, highway, ref, route,
+ way AS way_orig,
+ ST_Simplify(way, 20037508*2 / 2^(8 + 6)) AS way_zoom6,
+ ST_Simplify(way, 20037508*2 / 2^(8 + 7)) AS way_zoom7,
+ ST_Simplify(way, 20037508*2 / 2^(8 + 8)) AS way_zoom8,
+ ST_Simplify(way, 20037508*2 / 2^(8 + 9)) AS way_zoom9
+ FROM planet_osm_line
+ WHERE highway IN ('motorway', 'trunk');
+
+COMMIT;
Please sign in to comment.
Something went wrong with that request. Please try again.