osm_new_waterways_gen1

86 views
Skip to first unread message

Meine Toonen

unread,
Jan 1, 2013, 10:37:33 AM1/1/13
to imp...@googlegroups.com
Hi all,

First off: thanks for this beautiful piece of work! Really nice and easy.

Importing the pbf for my country via imposm worked like a charm. Well documented and all. Then, off to showing it on a map, I followed this tutorial: http://trac.osgeo.org/mapserver/wiki/RenderingOsmDataUbuntu.
When trying to display the data, it failed on finding the table/view osm_new_waterways_gen1. It reconstructed that table by basing it on the osm2pgsql-to-imposm-schema.sql
I don't know if this is a problem but it might help others. This is the final query:



CREATE VIEW osm_new_waterways_gen1_view AS
  SELECT id, osm_id, name, type, ST_SimplifyPreserveTopology(geometry,50) AS geometry
  FROM osm_new_waterways;
 
--DROP TABLE osm_new_waterways_gen1;

CREATE TABLE osm_new_waterways_gen1 AS
  SELECT * FROM osm_new_waterways_gen1_view;
 
ALTER TABLE osm_new_waterways_gen1 ADD PRIMARY KEY (id);

-- create spatial index
CREATE INDEX osm_new_waterways_gen1_geom ON osm_new_waterways_gen1 USING GIST (geometry);
CLUSTER osm_new_waterways_gen1_geom ON osm_new_waterways_gen1;
-- add spatial constraints
ALTER TABLE osm_new_waterways_gen1 ADD CONSTRAINT enforce_dims_geometry CHECK (st_ndims(geometry) = 2);
ALTER TABLE osm_new_waterways_gen1 ADD CONSTRAINT enforce_srid_geometry CHECK (st_srid(geometry) = 28992);


Meine Toonen

unread,
Feb 22, 2013, 3:41:57 PM2/22/13
to imp...@googlegroups.com
I missed gen0. Here is the total script. Adjust where the srid, the tablenames and username is involved:

set session authorization osm;
-- DROP VIEW osm_new_waterways_gen0_view;

CREATE OR REPLACE VIEW osm_new_waterways_gen0_view AS
 SELECT osm_new_waterways.id, osm_new_waterways.osm_id, osm_new_waterways.name, osm_new_waterways.type, st_simplifypreservetopology(osm_new_waterways.geometry, 200::double precision) AS geometry
   FROM osm_new_waterways;

ALTER TABLE osm_new_waterways_gen0_view
  OWNER TO osm;

-- View: osm_new_waterways_gen1_view

-- DROP VIEW osm_new_waterways_gen1_view;

CREATE OR REPLACE VIEW osm_new_waterways_gen1_view AS
 SELECT osm_new_waterways.id, osm_new_waterways.osm_id, osm_new_waterways.name, osm_new_waterways.type, st_simplifypreservetopology(osm_new_waterways.geometry, 50::double precision) AS geometry
   FROM osm_new_waterways;

ALTER TABLE osm_new_waterways_gen1_view
  OWNER TO osm;


CREATE TABLE osm_new_waterways_gen1 AS
  SELECT * FROM osm_new_waterways_gen1_view;


CREATE TABLE osm_new_waterways_gen0 AS
  SELECT * FROM osm_new_waterways_gen0_view;


Op dinsdag 1 januari 2013 16:37:33 UTC+1 schreef Meine Toonen het volgende:
Reply all
Reply to author
Forward
0 new messages