source: trunk/data/konvert/postnas_0.6/atkis_rp_rendering/processing/sql/baeche_full.sql @ 118

Revision 118, 4.2 KB checked in by tobias.dick, 10 years ago (diff)

Bugfixes

Line 
1DROP TABLE IF EXISTS ax_gewaesserachse_merged;
2--
3SELECT ax_gewaesserachse.wkb_geometry, ax_wasserlauf.name_ as widmung into ax_gewaesserachse_merged from ax_wasserlauf INNER JOIN alkis_beziehungen ON (alkis_beziehungen.beziehung_zu = ax_wasserlauf.gml_id) INNER JOIN ax_gewaesserachse ON
4(ax_gewaesserachse.gml_id=alkis_beziehungen.beziehung_von);
5--
6DROP TABLE IF EXISTS map_baeche_g0;
7--
8SELECT (ST_Dump(ST_Linemerge(ST_Collect(ST_SimplifyPreserveTopology( wkb_geometry, 2.5 ))))).geom AS wkb_geometry,
9widmung
10INTO map_baeche_g0
11FROM ax_gewaesserachse_merged GROUP BY ax_gewaesserachse_merged.widmung;
12--
13DROP SEQUENCE IF EXISTS map_baeche_g0_gid_seq;
14CREATE SEQUENCE map_baeche_g0_gid_seq;
15ALTER TABLE map_baeche_g0 ADD COLUMN gid INTEGER;
16UPDATE map_baeche_g0 SET gid = nextval('map_baeche_g0_gid_seq');
17ALTER TABLE map_baeche_g0 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g0_gid_seq');
18CREATE INDEX map_baeche_g0_gidx ON map_baeche_g0 USING GIST ( wkb_geometry );
19--
20--
21DROP TABLE IF EXISTS map_baeche_g1;
22--
23SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 5 ))).geom AS wkb_geometry, widmung
24INTO map_baeche_g1
25FROM map_baeche_g0;
26--
27DROP SEQUENCE IF EXISTS map_baeche_g1_gid_seq;
28CREATE SEQUENCE map_baeche_g1_gid_seq;
29ALTER TABLE map_baeche_g1 ADD COLUMN gid INTEGER;
30UPDATE map_baeche_g1 SET gid = nextval('map_baeche_g1_gid_seq');
31ALTER TABLE map_baeche_g1 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g1_gid_seq');
32CREATE INDEX map_baeche_g1_gidx ON map_baeche_g1 USING GIST ( wkb_geometry );
33--
34--
35DROP TABLE IF EXISTS map_baeche_g2;
36--
37SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 15 ))).geom AS wkb_geometry, widmung
38INTO map_baeche_g2
39FROM map_baeche_g1;
40--
41DROP SEQUENCE IF EXISTS map_baeche_g2_gid_seq;
42CREATE SEQUENCE map_baeche_g2_gid_seq;
43ALTER TABLE map_baeche_g2 ADD COLUMN gid INTEGER;
44UPDATE map_baeche_g2 SET gid = nextval('map_baeche_g2_gid_seq');
45ALTER TABLE map_baeche_g2 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g2_gid_seq');
46CREATE INDEX map_baeche_g2_gidx ON map_baeche_g2 USING GIST ( wkb_geometry );
47--
48--
49DROP TABLE IF EXISTS map_baeche_g3;
50--
51SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 35 ))).geom AS wkb_geometry, widmung
52INTO map_baeche_g3
53FROM map_baeche_g2;
54--
55DROP SEQUENCE IF EXISTS map_baeche_g3_gid_seq;
56CREATE SEQUENCE map_baeche_g3_gid_seq;
57ALTER TABLE map_baeche_g3 ADD COLUMN gid INTEGER;
58UPDATE map_baeche_g3 SET gid = nextval('map_baeche_g3_gid_seq');
59ALTER TABLE map_baeche_g3 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g3_gid_seq');
60CREATE INDEX map_baeche_g3_gidx ON map_baeche_g3 USING GIST ( wkb_geometry );
61--
62--
63DROP TABLE IF EXISTS map_baeche_g4;
64--
65SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 65 ))).geom AS wkb_geometry, widmung
66INTO map_baeche_g4
67FROM map_baeche_g3;
68--
69DROP SEQUENCE IF EXISTS map_baeche_g4_gid_seq;
70CREATE SEQUENCE map_baeche_g4_gid_seq;
71ALTER TABLE map_baeche_g4 ADD COLUMN gid INTEGER;
72UPDATE map_baeche_g4 SET gid = nextval('map_baeche_g4_gid_seq');
73ALTER TABLE map_baeche_g4 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g4_gid_seq');
74CREATE INDEX map_baeche_g4_gidx ON map_baeche_g4 USING GIST ( wkb_geometry );
75--
76--
77DROP TABLE IF EXISTS map_baeche_g5;
78--
79SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 125 ))).geom AS wkb_geometry, widmung
80INTO map_baeche_g5
81FROM map_baeche_g4;
82--
83DROP SEQUENCE IF EXISTS map_baeche_g5_gid_seq;
84CREATE SEQUENCE map_baeche_g5_gid_seq;
85ALTER TABLE map_baeche_g5 ADD COLUMN gid INTEGER;
86UPDATE map_baeche_g5 SET gid = nextval('map_baeche_g5_gid_seq');
87ALTER TABLE map_baeche_g5 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g5_gid_seq');
88CREATE INDEX map_baeche_g5_gidx ON map_baeche_g5 USING GIST ( wkb_geometry );
89--
90--
91DROP TABLE IF EXISTS map_baeche_g6;
92--
93SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 250 ))).geom AS wkb_geometry, widmung
94INTO map_baeche_g6
95FROM map_baeche_g5;
96--
97DROP SEQUENCE IF EXISTS map_baeche_g6_gid_seq;
98CREATE SEQUENCE map_baeche_g6_gid_seq;
99ALTER TABLE map_baeche_g6 ADD COLUMN gid INTEGER;
100UPDATE map_baeche_g6 SET gid = nextval('map_baeche_g6_gid_seq');
101ALTER TABLE map_baeche_g6 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g6_gid_seq');
102CREATE INDEX map_baeche_g6_gidx ON map_baeche_g6 USING GIST ( wkb_geometry );
Note: See TracBrowser for help on using the repository browser.