Index: trunk/import/atkis_rp_rendering/processing/functions/function_grid.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/functions/function_grid.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/functions/function_grid.sql	(revision 261)
@@ -0,0 +1,63 @@
+CREATE OR REPLACE FUNCTION grid(text, geometry, integer)
+  RETURNS integer AS
+$BODY$ 
+
+
+DECLARE
+bextent box3d_extent := ST_Extent($2);
+maxx real := ST_XMax( bextent );
+maxy real := ST_YMax( bextent );
+minx real := ST_XMin( bextent );
+miny real := ST_YMin( bextent );
+
+cell geometry := ST_GeometryFromText('POLYGON((0 0, 0 1, 1 1, 2 1, 2 2, 1 2, 1 1, 1 0, 0 0))',25832);
+
+counter integer := 0;
+query text;
+--i integer;
+--j integer;
+
+stepx integer := ceil((maxx-minx)/$3);
+stepy integer := ceil((maxy-miny)/$3);
+
+BEGIN
+
+query := 'DROP TABLE IF EXISTS '||$1||';';
+EXECUTE query;
+query := 'CREATE TABLE '||$1||' (  gid integer );';
+EXECUTE query;
+query := 'SELECT AddGeometryColumn (\'public\',\''||$1||'\',\'wkb_geometry\',25832,\'POLYGON\',2);'; 
+--RAISE NOTICE 'Info: %', query;
+EXECUTE query;
+FOR i IN  0..(stepx-1) LOOP
+	FOR j IN  0..(stepy-1) LOOP
+		 
+		query := 'INSERT INTO '|| $1 ||' (wkb_geometry) VALUES (st_geometryfromtext(\'POLYGON(('
+			|| minx+i*$3 || ' ' || miny+j*$3 || ',' 
+			|| minx+i*$3 || ' ' || miny+(j+1)*$3 || ','
+			|| minx+(i+1)*$3 || ' ' || miny+(j+1)*$3 || ','
+			|| minx+(i+1)*$3 || ' ' || miny+j*$3 || ','
+			|| minx+(i+1)*$3 || ' ' || miny+j*$3 || ','
+			|| minx+i*$3 || ' ' || miny+j*$3 || 
+		      '))\', 25832));';
+		EXECUTE query;
+        counter := counter + 1;
+	END LOOP;
+END LOOP;
+query := 'DROP SEQUENCE IF EXISTS '||$1||'_gid_seq;';
+EXECUTE query;
+
+query := 'CREATE INDEX '||$1||'_gidx ON '||$1||' USING GIST ( wkb_geometry ); 
+	  CREATE SEQUENCE '||$1||'_gid_seq;';
+EXECUTE query;
+query := 'UPDATE '||$1||' SET gid = nextval(\''||$1||'_gid_seq\');
+	  ALTER TABLE '||$1||' ALTER COLUMN gid SET DEFAULT nextval(\''||$1||'_gid_seq\');';
+EXECUTE query;
+
+return counter;
+
+END
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+-- 
Index: trunk/import/atkis_rp_rendering/processing/functions/readme.txt
===================================================================
--- trunk/import/atkis_rp_rendering/processing/functions/readme.txt	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/functions/readme.txt	(revision 261)
@@ -0,0 +1,20 @@
+Die plpgsql-Funktion grid() benÃ¶tigt drei Parameter:
+
+$1: Name (text) der neu zu erstellenden Tabelle, die die Geometrie der Kacheln enthalten wird (DROP IF EXISTS).
+$2: Name der Geometriespalte (geometry), ÃŒber deren Bounding Box die vier Eckkoordinaten fÃŒr die Kachelung
+	abgeleitet werden.
+$3: Zahlenwert (integer), der angibt, wie groÃ eine KantenlÃ€nge der Kachel sein soll (Angabe in Meter).
+
+Beispielaufruf:
+	SELECT grid('meine_kachel_2km', wkb_geometry, 2000) FROM map_landesflaeche 
+
+Wichtig: 
+	Sollen Kacheln fÃŒr die LandesflÃ€che erstellt werden, mÃŒssen die zugrunde liegenden Daten bereits
+	zu einem Polygon zusammengefasst worden sein.
+
+=> FALSCH:	
+	SELECT grid('meine_kachel_2km', wkb_geometry, 2000) FROM ax_kommunalesgebiet
+
+=> RICHTIG:
+	SELECT grid('meine_kachel_2km', ST_Union(wkb_geometry), 2000) FROM ax_kommunalesgebiet
+
Index: trunk/import/atkis_rp_rendering/processing/batch.sh
===================================================================
--- trunk/import/atkis_rp_rendering/processing/batch.sh	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/batch.sh	(revision 261)
@@ -0,0 +1,279 @@
+#!/bin/bash
+
+source psql.conf
+
+# Query aufbauen
+if [ $dbpass == false ]; then
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport -w --quiet"
+else	
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport --password=$dbpass --quiet"
+fi
+
+START=$(date +%s)
+
+# Parameter:
+# ./flaechen.sh map_sonderkultur_g0 map_sonderkultur_g1 widmung 10000 5000 10 10 false true
+# Funktion	Eingabelayer	Ausgabelayer	Widmungsfeld	AuÃenpolygonMindestgrÃ¶Ãe InnenpolygonMindestgrÃ¶ÃÃe SimplifyAuÃen SimplifyInnen KachelungsgrÃ¶Ãe[false=keineKachelung] batch-Mode
+
+#############################
+# 0	PRE-PROCESSING
+# 0.1	ERSTELLEN DER KACHELN
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "0.1 Kachelung"
+#<<COMMENT0
+time $CONN -c "DROP TABLE IF EXISTS map_rlp_kachel_2km, map_rlp_kachel_5km, map_rlp_kachel_10km, map_rlp_kachel_25km, map_rlp_kachel_50km;
+				SELECT grid( 'map_rlp_kachel_2km', ST_ExteriorRing(ST_Union(wkb_geometry)), 2000) FROM ax_kommunalesgebiet;
+				SELECT grid( 'map_rlp_kachel_5km', ST_ExteriorRing(ST_Union(wkb_geometry)), 5000) FROM ax_kommunalesgebiet;
+				SELECT grid( 'map_rlp_kachel_10km', ST_ExteriorRing(ST_Union(wkb_geometry)), 10000) FROM ax_kommunalesgebiet;
+				SELECT grid( 'map_rlp_kachel_25km', ST_ExteriorRing(ST_Union(wkb_geometry)), 25000) FROM ax_kommunalesgebiet;
+				SELECT grid( 'map_rlp_kachel_50km', ST_ExteriorRing(ST_Union(wkb_geometry)), 50000) FROM ax_kommunalesgebiet;"
+echo "  - Prozessierung abgeschlossen"
+#COMMENT0
+#echo "  - Wird nicht neu prozessiert"
+sleep 1
+
+# 1.	FLÃCHENHAFTE OBJEKTE
+# 1.1	LANDESFLÃCHE und KACHELUNG ÃŒber die Grids
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.1 LandesflÃ€che"
+time $CONN -f sql/landesflaeche.sql
+echo "  - Abgeschlossen"
+#echo "  - Wird nicht neu prozessiert"
+sleep 1
+
+
+
+# 1.2	WALDFlÃ€chen
+# Vorprozessierung
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.2 WaldflÃ€chen"
+time $CONN -f sql/wald_prep.sql
+echo "  - g0 [1:7500] & g1 [1:17500] abgeschlossen"
+sleep 1
+./flaechen.sh map_wald_g1 map_wald_g2 widmung 25000 10000 25 20 false true
+echo "  - g1->g2 [1:50000] abgeschlossen"
+sleep 1
+./flaechen.sh map_wald_g2 map_wald_g3 widmung 50000 30000 65 50 false true
+echo "  - g2->g3 [1:100000] abgeschlossen"
+sleep 1
+./flaechen.sh map_wald_g3 map_wald_g4 widmung 85000 55000 100 75 false true
+echo "  - g3->g4 [1:300000] abgeschlossen"
+sleep 1
+./flaechen.sh map_wald_g4 map_wald_g5 widmung 100000 85000 200 150 false true
+echo "  - g4->g5 [1:750000] abgeschlossen"
+sleep 1
+./flaechen.sh map_wald_g5 map_wald_g6 widmung 1000000 1000000 350 350 false true
+echo "  - g5->g6 [1:infinite] abgeschlossen"
+sleep 1
+
+
+# 1.3	ORTSLAGEN
+# Vorprozessierung
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.3 Ortslagen"
+time $CONN -f sql/ortslage_prep.sql
+sleep 1
+echo "  - Vorprozessierung abgeschlossen"
+./flaechen.sh map_ortslage_g0 map_ortslage_g1 widmung 10000 5000 10 10 false true
+echo "  - g0->g1 [1:17500] abgeschlossen"
+sleep 1
+./flaechen.sh map_ortslage_g1 map_ortslage_g2 widmung 25000 10000 25 20 false true
+echo "  - g1->g2 [1:50000] abgeschlossen"
+sleep 1
+./flaechen.sh map_ortslage_g2 map_ortslage_g3 widmung 50000 30000 65 50 false true
+echo "  - g2->g3 [1:100000] abgeschlossen"
+sleep 1
+./flaechen.sh map_ortslage_g3 map_ortslage_g4 widmung 85000 55000 100 75 false true
+echo "  - g3->g4 [1:300000] abgeschlossen"
+sleep 1
+./flaechen.sh map_ortslage_g4 map_ortslage_g5 widmung 100000 85000 200 150 false true
+echo "  - g4->g5 [1:750000] abgeschlossen"
+sleep 1
+./flaechen.sh map_ortslage_g5 map_ortslage_g6 widmung 1000000 1000000 350 350 false true
+echo "  - g5->g6 [1:infinite] abgeschlossen"
+sleep 1
+
+
+# 1.4	INDUSTRIE und GEWERBEFLÃCHEN
+# Hier sind noch sehr viele Objekte (>13000) mit funktion NULL belegt!
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.4 Industrie- und GewerbeflÃ€chen"
+time $CONN -f sql/industrie_prep.sql
+sleep 1
+echo "  - Vorprozessierung abgeschlossen"
+./flaechen.sh map_industrie_g0 map_industrie_g1 widmung 10000 5000 10 10 false true
+echo "  - g0->g1 [1:17500] abgeschlossen"
+sleep 1
+./flaechen.sh map_industrie_g1 map_industrie_g2 widmung 25000 10000 25 20 false true
+echo "  - g1->g2 [1:50000] abgeschlossen"
+sleep 1
+./flaechen.sh map_industrie_g2 map_industrie_g3 widmung 50000 30000 65 50 false true
+echo "  - g2->g3 [1:100000] abgeschlossen"
+sleep 1
+./flaechen.sh map_industrie_g3 map_industrie_g4 widmung 85000 55000 100 75 false true
+echo "  - g3->g4 [1:300000] abgeschlossen"
+sleep 1
+./flaechen.sh map_industrie_g4 map_industrie_g5 widmung 100000 85000 200 150 false true
+echo "  - g4->g5 [1:750000] abgeschlossen"
+sleep 1
+./flaechen.sh map_industrie_g5 map_industrie_g6 widmung 1000000 1000000 350 350 false true
+echo "  - g5->g6 [1:infinite] abgeschlossen"
+sleep 1
+
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.5 Landwirtschaft -> Derivat 'GrÃŒnland'"
+echo "  - Wird nicht prozessiert"
+<<COMMENT1
+	time $CONN -f sql/gruenland_prep.sql
+	# 414"
+	sleep 1
+	echo "  - Vorprozessierung abgeschlossen"
+	./flaechen.sh map_gruenland_g0 map_gruenland_g1 widmung 10000 5000 10 10 false true
+	echo "  - g0->g1 [1:17500] abgeschlossen"
+	sleep 1
+	./flaechen.sh map_gruenland_g1 map_gruenland_g2 widmung 25000 10000 25 20 false true
+	echo "  - g1->g2 [1:50000] abgeschlossen"
+	sleep 1
+	./flaechen.sh map_gruenland_g2 map_gruenland_g3 widmung 50000 30000 65 50 false true
+	echo "  - g2->g3 [1:100000] abgeschlossen"
+	sleep 1
+	./flaechen.sh map_gruenland_g3 map_gruenland_g4 widmung 85000 55000 100 75 false true
+	echo "  - g3->g4 [1:300000] abgeschlossen"
+	sleep 1
+	./flaechen.sh map_gruenland_g4 map_gruenland_g5 widmung 100000 85000 200 150 false true
+	echo "  - g4->g5 [1:750000] abgeschlossen"
+	sleep 1
+	./flaechen.sh map_gruenland_g5 map_gruenland_g6 widmung 1000000 1000000 350 350 false true
+	echo "  - g5->g6 [1:infinite] abgeschlossen"
+	sleep 1
+COMMENT1
+
+
+# 1.6	SONDERKULTUREN
+# Vorprozessierung
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.6 Landwirtschaft -> Derivat 'Sonderkulturen'"
+time $CONN -f sql/sonderkultur_prep.sql
+sleep 1
+echo "  - Vorprozessierung abgeschlossen"
+./flaechen.sh map_sonderkultur_g0 map_sonderkultur_g1 widmung 10000 5000 10 10 false true
+echo "  - g0->g1 [1:17500] abgeschlossen"
+sleep 1
+./flaechen.sh map_sonderkultur_g1 map_sonderkultur_g2 widmung 25000 10000 25 20 false true
+echo "  - g1->g2 [1:50000] abgeschlossen"
+sleep 1
+./flaechen.sh map_sonderkultur_g2 map_sonderkultur_g3 widmung 50000 30000 65 50 false true
+echo "  - g2->g3 [1:100000] abgeschlossen"
+sleep 1
+./flaechen.sh map_sonderkultur_g3 map_sonderkultur_g4 widmung 85000 55000 100 75 false true
+echo "  - g3->g4 [1:300000] abgeschlossen"
+sleep 1
+./flaechen.sh map_sonderkultur_g4 map_sonderkultur_g5 widmung 100000 85000 200 150 false true
+echo "  - g4->g5 [1:750000] abgeschlossen"
+sleep 1
+./flaechen.sh map_sonderkultur_g5 map_sonderkultur_g6 widmung 1000000 1000000 350 350 false true
+echo "  - g5->g6 [1:infinite] abgeschlossen"
+sleep 1
+
+
+# 1.7	Stehendes Gewaesser
+# Vorprozessierung
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.7 Stehendes GewÃ€sser 'See'"
+time $CONN -f sql/stehendesgewaesser_prep.sql
+sleep 1
+echo "  - Vorprozessierung abgeschlossen"
+./flaechen.sh map_stehendesgewaesser_g0 map_stehendesgewaesser_g1 widmung 500 250 5 5 false true
+echo "  - g0->g1 [1:17500] abgeschlossen"
+sleep 1
+./flaechen.sh map_stehendesgewaesser_g1 map_stehendesgewaesser_g2 widmung 1500 500 15 10 false true
+echo "  - g1->g2 [1:50000] abgeschlossen"
+sleep 1
+./flaechen.sh map_stehendesgewaesser_g2 map_stehendesgewaesser_g3 widmung 10000 5000 30 30 false true
+echo "  - g2->g3 [1:100000] abgeschlossen"
+sleep 1
+./flaechen.sh map_stehendesgewaesser_g3 map_stehendesgewaesser_g4 widmung 25000 10000 50 50 false true
+echo "  - g3->g4 [1:300000] abgeschlossen"
+sleep 1
+./flaechen.sh map_stehendesgewaesser_g4 map_stehendesgewaesser_g5 widmung 50000 25000 75 75 false true
+echo "  - g4->g5 [1:750000] abgeschlossen"
+sleep 1
+./flaechen.sh map_stehendesgewaesser_g5 map_stehendesgewaesser_g6 widmung 150000 75000 150 150 false true
+echo "  - g5->g6 [1:infinite] abgeschlossen"
+sleep 1
+
+# 1.8	FlÃŒsse
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.8 FlieÃgewÃ€sser - FlÃŒsse [Polygone]"
+time $CONN -f sql/fluesse_full.sql
+echo "  - Prozessierung abgeschlossen"
+sleep 1
+
+# 1.	FLÃCHENHAFTE OBJEKTE
+# 1.8	GEBÃUDEGRUNDRISSE
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "1.9 GebÃ€ude - Transformation [Polygone]->[Punktsignaturen]"
+time $CONN -f sql/gebaeude_prep.sql
+echo "  - Prozessierung abgeschlossen"
+sleep 1
+
+# 2.	LINIENHAFTE OBJEKTE
+# 2.1	STRASSEN
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "2.1 StraÃen"
+time $CONN -f sql/strassen_full.sql
+echo "  - Prozessierung abgeschlossen"
+
+# 2.2	BAHN
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "2.3 Bahn"
+time $CONN -f sql/bahn_full.sql
+echo "  - Prozessierung abgeschlossen"
+sleep 1
+
+# 2.3	BÃ€che
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "2.4 FlieÃgewÃ€sser - BÃ€che"
+time $CONN -f sql/baeche_full.sql
+echo "  - Prozessierung abgeschlossen"
+sleep 1
+
+# 2.4	Wege
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "2.4 Wege"
+time $CONN -f sql/wege_full.sql
+echo "  - Prozessierung abgeschlossen"
+sleep 1
+
+# POST-PROCESSING
+# 3.	KACHELUNG
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "3. Kachelung"
+time ./kacheln.sh 
+echo "  - Kachelung abgeschlossen"
+
+
+echo 
+echo "-------------------------------------------------------------------------------------------"
+echo "4. VACUUM ANALYZE"
+time $CONN -c "VACUUM ANALYZE"
+echo "  - Abgeschlossen"
+
+END=$(date +%s)
+DIFF=$(( $END - $START ))
+echo -e "\r\nProzessierung abgeschlossen nach ${DIFF} Sekunden"
Index: trunk/import/atkis_rp_rendering/processing/readme.txt
===================================================================
--- trunk/import/atkis_rp_rendering/processing/readme.txt	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/readme.txt	(revision 261)
@@ -0,0 +1,16 @@
+Um tagesaktuelle Daten abzuleiten, reicht ein Aufruf der 
+./batch.sh 
+
+Zuvor sollte jedoch
+1. die DB-Konfiguration in psql.conf angepasst werden
+2. sichergestellt werden, dass nicht benÃ¶tigte DatensÃ€tze in batch.sh auskommentiert sind
+3. DatensÃ€tze, die gekachelt werden sollen, in der kacheln.sh aufgefÃŒhrt sind.
+
+
+Im Verzeichnis functions/ liegt der Source fÃŒr die Funktion grid(), die die Ausgangskacheln erstellt.
+Bei einer Datenmigration auf einen neuen Server muss diese Funktion dort aufgespielt werden, bevor 
+man mit dem Prozessieren beginnt.
+
+In sql/ liegen die Quellcodes aller (Vor)Verarbeitungsschritte. Diese kÃ¶nnen je nach Anforderung
+angepasst werden.
+
Index: trunk/import/atkis_rp_rendering/processing/flaechen.sh
===================================================================
--- trunk/import/atkis_rp_rendering/processing/flaechen.sh	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/flaechen.sh	(revision 261)
@@ -0,0 +1,254 @@
+#!/bin/bash
+
+source psql.conf
+
+####################################################################
+#					ab hier nichts mehr Ã€ndern
+#				do not change anything below this line.
+####################################################################
+
+# Kommandozeilen-Variante
+# @params
+# Tabellenparameter::
+# $1= einzulesende Tabelle
+table_input=$1
+# $2= auszugebende Tabelle
+table_output=$2
+# $3= in welcher Spalte wird die Widmung vorgehalten? (kann NULL-Werte enthalten)
+column_label=$3
+# Generalisierungsparameter:
+# $4= MindestgrÃ¶Ãe fÃŒr AuÃenpolygone
+minArea_outer=$4
+# $5= MindestgrÃ¶Ãe fÃŒr Innenpolygono
+minArea_inner=$5
+# $6= SimplifyDistance fÃŒr AuÃenpolygone
+simplDist_outer=$6
+# $7= SimplifyDistance fÃŒr Innenpolygone
+simplDist_inner=$7
+# $8= RasterCellsize fÃŒr Perimter-Verschneidungen (siehe Doku)
+rasterCellsize=$8
+##
+##
+##
+# @ToDo: "Input at hoc"-Variante (read "Geben Sie den Tabellennamen der Eingabedaten ein:" table_input, ...)
+# @ToDo: Automatisierte Variante mit cat betroffene.txt
+
+
+force=false
+if [ $9 ]; then
+	if [ $9 == 'true' ] || [ $9 == 1 ]; then
+		force=true
+		echo "batch mode mit 'force' gesetzt."
+	fi
+fi
+
+# Testen, ob Variablen gesetzt sind
+
+if [ ! $table_input ]; then 
+	error="${error}Keine Angabe zur Eingabetabelle gemacht!\r\n"
+fi
+if [ ! $table_output ]; then 
+	error="${error}Keine Angabe zur Ausgabetabelle gemacht!\r\n"
+fi
+if [ ! $column_label ]; then 
+	error="${error}Keine Angabe zur Spalte 'Widmung' gemacht!\r\n"
+fi
+if [ ! $minArea_outer ]; then 
+	error="${error}Keine Angabe zur MindestgrÃ¶Ãe der AuÃenpolygone!\r\n"
+fi
+if [ ! $minArea_inner ]; then 
+	error="${error}Keine Angabe zur MindestgrÃ¶Ãe der Innenpolygone!\r\n"
+fi
+if [ ! $simplDist_outer ]; then 
+	error="${error}Keine Angabe zur Simplify-Distance fÃŒr die AuÃenpolygone!\r\n"
+fi
+if [ ! $simplDist_inner ]; then 
+	error="${error}Keine Angabe zur Simplify-Distance fÃŒr die Innenpolygone!\r\n"
+fi
+if [ ! $RasterCellsize ]; then 
+	error="${error}Keine Angabe zur ZellgrÃ¶Ãe (in km) fÃŒr die Verschneidung!\r\n"
+fi
+
+if [ $# -lt 9 ]; then
+	echo "Aufruf mit inkorrekter Anzahl an Parametern:"
+	echo -e $error #@ ToDo
+	exit 0
+fi
+
+# Festlegen der Datenbank-Verbindung
+echo "Teste PostGIS-Verbindung zu $dbname auf $dbuser@$dbhost:$dbport:"
+if [ $dbpass == false ]; then
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport -w"
+else	
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport --password=$dbpass"
+fi
+
+# Testen, ob die Eingangstabelle exisitiert
+QUERY="${CONN} -c 'SELECT true FROM $table_input LIMIT 1 OFFSET 0' --quiet"
+
+if eval $QUERY &> /dev/null;
+then 
+	echo "Verbindung erfolgreich hergestellt, Eingabetabelle existiert."
+else # Kein Abruf von Tabelle mÃ¶glich - DB-Konfig falsch oder Tabelle nicht existent
+	QUERY="${CONN} -c 'SELECT false' --quiet"
+	if eval $QUERY &> /dev/null;
+	then 
+		echo "Fehler: Eingabetabelle $table_input existiert nicht."
+	else
+		echo "Fehler: Verbindung zum Server konnte nicht hergestellt werden!"
+		echo "Bitte Verbindungseinstellungen ÃŒberprÃŒfen."
+	fi
+	exit 0
+fi
+
+
+# Testen, ob die Ausgabetabelle bereits exisitiert - Abfrage: Ãberschreiben oder Abbruch?
+QUERY="${CONN} -c 'SELECT true FROM $table_output LIMIT 1 OFFSET 0' --quiet"
+
+if eval $QUERY &> /dev/null;
+then 
+	echo "Ausgabetabelle existiert bereits!"
+	
+	response=false
+	if [ $force == true ]; then
+		response=true
+		QUERY="${CONN} -c 'DROP TABLE $table_output' --quiet"
+		eval $QUERY &> /dev/null;
+		echo "Tabelle $table_output gelÃ¶scht."
+	fi
+
+	while [ $response = false ]; do
+		read -p "[L]Ã¶sche Tabelle oder [A]bbruch: " var
+		if [ "$var" = 'L' ]; then
+			response=true
+			QUERY="${CONN} -c 'DROP TABLE $table_output' --quiet"
+			eval $QUERY &> /dev/null;
+			echo "Tabelle $table_output gelÃ¶scht."
+		elif [ "$var" = 'A' ]; then
+			response=true
+			echo "Abbruch durch Benutzer."
+			exit 0
+		fi
+	done
+else # Kein Abruf von Tabelle mÃ¶glich - DB-Konfig falsch oder Tabelle nicht existent
+	QUERY="${CONN} -c 'SELECT false' --quiet"
+	if eval $QUERY &> /dev/null;
+	then 
+		echo "Alle Vorbereitungen zum Prozessieren sind abgeschlossen."
+	else
+		echo "Fehler: Verbindung zum Server konnte nicht hergestellt werden!"
+		echo "Bitte Verbindungseinstellungen ÃŒberprÃŒfen."
+	fi
+fi
+
+# NÃ€chstes "Fenster"
+if [ $force != true ]; then
+	read -p "DrÃŒcken Sie eine beliebige Taste zum Fortfahren: " > /dev/null
+	echo '##            ATKIS-Generalisierung :: Wrapper            ##'
+fi;
+
+if [ $dbpass == false ]; then
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport -w"
+else	
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport --password=$dbpass"
+fi
+
+################################# GENERALISIERUNG per se #################################
+
+time $CONN -c "DROP TABLE IF EXISTS temp0;
+	SELECT path[1] AS path, ST_MakePolygon(ST_ExteriorRing(geom)) AS wkb_geometry, $3::text
+	INTO temp0
+	FROM (
+		SELECT (ST_DumpRings( wkb_geometry )).*, $3
+		FROM $1
+	) AS t1;
+	CREATE INDEX temp0_geomidx ON temp0 USING GIST ( wkb_geometry );
+	DROP SEQUENCE IF EXISTS temp0_geomid_seq;
+	CREATE SEQUENCE temp0_geomid_seq;
+	ALTER TABLE temp0 ADD COLUMN geomid INTEGER;
+	UPDATE temp0 SET geomid = nextval('temp0_geomid_seq');
+	ALTER TABLE temp0 ALTER COLUMN geomid SET DEFAULT nextval('temp0_geomid_seq');
+	-- 
+	DELETE FROM temp0 WHERE path = 0 AND ST_Area( wkb_geometry ) < $4; -- 
+	DELETE FROM temp0 WHERE path <> 0 AND ST_Area( wkb_geometry ) < $5; -- 
+	UPDATE temp0 SET wkb_geometry = ST_Buffer( 
+											ST_Buffer(
+													ST_SimplifyPreserveTopology( wkb_geometry, $6 )
+											, SQRT( $6 ) )
+									, SQRT( $6 ) *-1 )
+	WHERE path = 0;
+	UPDATE temp0 SET wkb_geometry = ST_Buffer( 
+											ST_Buffer(
+													ST_SimplifyPreserveTopology( wkb_geometry, $7 )
+											, SQRT( $7 ) )
+									, SQRT( $7 ) *-1 )
+	WHERE path <> 0;
+	INSERT INTO temp0
+	(wkb_geometry, path, $3)
+	SELECT
+		ST_Buffer(	ST_Buffer( wkb_geometry	, 1.5 ), -1.5 ) AS wkb_geometry,
+		path, $3
+	FROM temp0
+	WHERE NOT ST_IsValid( wkb_geometry );
+	DELETE FROM temp0 WHERE NOT ST_IsValid( wkb_geometry );";
+
+
+time $CONN -c "ALTER TABLE temp0 ADD COLUMN relate VARCHAR;
+	UPDATE temp0 AS t SET relate = 'intersects' 
+	WHERE EXISTS (
+		SELECT 1 
+			FROM map_landesflaeche_g0 AS rlp 
+			WHERE rlp.wkb_geometry && t.wkb_geometry
+			GROUP BY t.wkb_geometry 
+			HAVING ST_Overlaps( ST_Union(rlp.wkb_geometry), t.wkb_geometry )
+	);
+	INSERT INTO temp0 
+	(relate, wkb_geometry, path, $3)
+	SELECT 'clipped' AS relate, proc.wkb_geometry, path, $3
+	FROM (
+		SELECT path, $3, (ST_Dump(wkb_geometry)).geom AS wkb_geometry
+		FROM (
+			SELECT ST_Intersection( lyr, rlp) AS wkb_geometry, path, $3
+			FROM
+			(
+				SELECT path, $3, relate, wkb_geometry AS lyr FROM temp0 
+			) AS w,
+			(
+				SELECT wkb_geometry AS rlp FROM map_landesflaeche
+			) AS l
+			WHERE w.relate = 'intersects' 
+		) AS wrapper
+	) AS proc;
+
+	DELETE FROM temp0 WHERE relate = 'intersects' OR ST_GeometryType( wkb_geometry ) IN ('ST_Point', 'ST_LineString');
+
+	INSERT INTO temp0
+	(relate, wkb_geometry, path, $3 )
+	SELECT relate, (ST_Dump( wkb_geometry )).geom AS wkb_geometry, path, $3
+	FROM temp0
+	WHERE ST_GeometryType( wkb_geometry ) = 'ST_MultiPolygon';
+	DELETE FROM temp0 WHERE ST_GeometryType( wkb_geometry ) = 'ST_MultiPolygon';
+	DROP TABLE IF EXISTS $2;
+
+		SELECT ST_MakePolygon( ST_ExteriorRing(o.wkb_geometry) , ST_Accum(ST_ExteriorRing(i.wkb_geometry)) ) AS wkb_geometry, o.$3
+		INTO $2
+		FROM temp0 AS o
+		INNER JOIN temp0 AS i
+		ON ST_Contains(o.wkb_geometry, i.wkb_geometry) 
+		WHERE o.path = 0 AND NOT (o.wkb_geometry ~= i.wkb_geometry)
+		GROUP BY o.wkb_geometry, o.$3
+	UNION ALL
+		SELECT
+		t0.wkb_geometry, $3
+		FROM temp0 AS t0
+		WHERE NOT EXISTS( SELECT 1 FROM temp0 AS t1 WHERE ST_Contains(t0.wkb_geometry, t1.wkb_geometry) AND NOT (t0.wkb_geometry ~= t1.wkb_geometry) ) AND t0.path = 0;
+	DROP TABLE temp0;
+	CREATE INDEX $2_gidx ON $2 USING GIST ( wkb_geometry );
+	DROP SEQUENCE IF EXISTS $2_gid_seq;
+	CREATE SEQUENCE $2_gid_seq;
+	ALTER TABLE $2 ADD COLUMN gid INTEGER;
+	UPDATE $2 SET gid = nextval('$2_gid_seq');
+	ALTER TABLE $2 ALTER COLUMN gid SET DEFAULT nextval('$2_gid_seq'); 
+	UPDATE $2 SET wkb_geometry = ST_Buffer(ST_Buffer( wkb_geometry, 1), -1) WHERE NOT ST_IsValid( wkb_geometry );
+	UPDATE $2 SET wkb_geometry = (ST_Dump( wkb_geometry )).geom WHERE ST_GeometryType( wkb_geometry ) = 'ST_MultiPolygon'; 
+	REINDEX TABLE $2; " 
Index: trunk/import/atkis_rp_rendering/processing/kacheln.sh
===================================================================
--- trunk/import/atkis_rp_rendering/processing/kacheln.sh	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/kacheln.sh	(revision 261)
@@ -0,0 +1,236 @@
+#!/bin/bash
+
+source psql.conf
+
+# Die zu verarbeitendenden Tabellen
+# gefolgt vom entsprechenden Geometrietyp
+#
+#	TODO: saubere Array-Struktur ...
+
+#	PROBLEM: unterschiedliche (Anzahl) Spalten:
+# 	wenn alles pauschal prozessiert wird,
+#	werden alle Spalten abgesehen von 'wkb_geometry' und
+#	'widmung' nicht berÃŒcksichtigt! 
+#	Workaround: auxfields...
+
+tables=('map_wald_g0')
+geomtype=('ST_Polygon')
+auxfields=('')
+
+tables+=('map_wald_g1')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_wald_g2')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_wald_g3')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_wald_g4')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_wald_g5')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_wald_g6')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g0')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g1')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g2')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g3')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g4')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g5')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_fluesse_g6')
+geomtype+=('ST_Polygon')
+auxfields+=('')
+
+tables+=('map_baeche_g0')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_baeche_g1')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_baeche_g2')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_baeche_g3')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_baeche_g4')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_baeche_g5')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_baeche_g6')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_strasse_g0')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_strasse_g1')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_strasse_g2')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_strasse_g3')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_strasse_g4')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_strasse_g5')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_strasse_g6')
+geomtype+=('ST_LineString')
+auxfields+=('name_, bezeichnung,')
+
+tables+=('map_wege_g0')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_wege_g1')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+tables+=('map_wege_g2')
+geomtype+=('ST_LineString')
+auxfields+=('')
+
+
+
+
+# Es kÃ¶nnen auch noch andere DatensÃ€tze hier geclippt werden.
+# Einfach danach auch das $cells-Array entsprechend erweitern.
+
+# Die zu verwendenden Kacheln: g0=2km, g1=5km, g2=10km, g3=25km, g4=50km
+cells=('map_landesflaeche_g0')  #wald_g0
+cells+=('map_landesflaeche_g0') #wald_g1
+cells+=('map_landesflaeche_g1') #wald_g2
+cells+=('map_landesflaeche_g1') #wald_g3
+cells+=('map_landesflaeche_g2') #wald_g4
+cells+=('map_landesflaeche_g3') #wald_g5
+cells+=('map_landesflaeche_g4') #wald_g6
+
+cells+=('map_landesflaeche_g0') #fluesse_g0
+cells+=('map_landesflaeche_g0') #fluesse_g1
+cells+=('map_landesflaeche_g1') #fluesse_g2
+cells+=('map_landesflaeche_g1') #fluesse_g3
+cells+=('map_landesflaeche_g2') #fluesse_g4
+cells+=('map_landesflaeche_g3') #fluesse_g5
+cells+=('map_landesflaeche_g4') #fluesse_g6
+
+cells+=('map_landesflaeche_g0') #baeche_g0
+cells+=('map_landesflaeche_g0') #baeche_g1
+cells+=('map_landesflaeche_g1') #baeche_g2
+cells+=('map_landesflaeche_g1') #baeche_g3
+cells+=('map_landesflaeche_g2') #baeche_g4
+cells+=('map_landesflaeche_g3') #baeche_g5
+cells+=('map_landesflaeche_g4') #baeche_g6
+
+cells+=('map_landesflaeche_g0') #strasse_g0
+cells+=('map_landesflaeche_g0') #strasse_g1
+cells+=('map_landesflaeche_g1') #strasse_g2
+cells+=('map_landesflaeche_g1') #strasse_g3
+cells+=('map_landesflaeche_g2') #strasse_g4
+cells+=('map_landesflaeche_g3') #strasse_g5
+cells+=('map_landesflaeche_g4') #strasse_g6
+
+cells+=('map_landesflaeche_g0') #wege_g0
+cells+=('map_landesflaeche_g0') #wege_g1
+cells+=('map_landesflaeche_g1') #wege_g2
+####################################################################
+#					ab hier nichts mehr Ã€ndern
+#				do not change anything below this line.
+####################################################################
+
+# Festlegen der Datenbank-Verbindung
+echo "Teste PostGIS-Verbindung zu $dbname auf $dbuser@$dbhost:$dbport:"
+if [ $dbpass == false ]; then
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport -w"
+else	
+	CONN="psql --user=$dbuser $dbname --host=$dbhost --port=$dbport --password=$dbpass"
+fi
+
+
+
+
+#### SCHLEIFE ÃŒber tables ####
+echo ${#tables[@]}
+for (( x=0 ; x < ${#tables[@]}; x++ ))
+do
+	echo -e "\n-----------------------------------------------------------------"
+	echo "Prozessiere ${tables[$x]}:"
+	
+	QUERY="${CONN} -c 'SELECT true FROM ${tables[$x]} LIMIT 1 OFFSET 0' --quiet"
+
+	if eval $QUERY &> /dev/null;
+	then 
+		echo "  Verbindung erfolgreich hergestellt, Eingabetabelle existiert."
+	else # Kein Abruf von Tabelle mÃ¶glich - DB-Konfig falsch oder Tabelle nicht existent
+		QUERY="${CONN} -c 'SELECT false' --quiet"
+		if eval $QUERY &> /dev/null;
+		then 
+			echo "  Fehler: Eingabetabelle ${tables[$x]} existiert nicht."
+		else
+			echo "  Fehler: Verbindung zum Server konnte nicht hergestellt werden!"
+			echo "  Bitte Verbindungseinstellungen ÃŒberprÃŒfen."
+		fi
+		exit 0
+	fi
+	
+	#### PROZESSIERUNG ####
+
+	
+	echo "Geometrie-Layer: ${tables[$x]}, Clipping-Layer: ${cells[$x]}, aux fields: ${auxfields[$x]}"
+	time $CONN -c "DROP TABLE IF EXISTS temp0; 
+	SELECT ${auxfields[$x]} (ST_Dump(ST_Intersection(rlp.wkb_geometry, t.wkb_geometry))).geom AS wkb_geometry, t.widmung
+	INTO temp0
+	FROM ${tables[$x]} t
+	INNER JOIN ${cells[$x]} rlp
+	ON rlp.wkb_geometry && t.wkb_geometry
+	WHERE ST_Intersects( rlp.wkb_geometry, t.wkb_geometry);
+	DELETE FROM ${tables[$x]} ;
+	INSERT INTO ${tables[$x]} (${auxfields[$x]} wkb_geometry, widmung) SELECT ${auxfields[$x]} wkb_geometry, widmung FROM temp0 WHERE ST_GeometryType( wkb_geometry ) = '${geomtype[$x]}';"
+
+done
Index: trunk/import/atkis_rp_rendering/processing/sql/industrie_prep.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/industrie_prep.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/industrie_prep.sql	(revision 261)
@@ -0,0 +1,15 @@
+DROP TABLE IF EXISTS map_industrie_g0;
+DROP SEQUENCE IF EXISTS map_industrie_g0_gid_seq;
+--
+SELECT (ST_Dump( ST_Union( ax_industrieundgewerbeflaeche.wkb_geometry ))).geom AS wkb_geometry, funktion AS widmung
+INTO map_industrie_g0 
+FROM ax_industrieundgewerbeflaeche 
+--WHERE (funktion IS NULL OR funktion in (..??..))
+GROUP BY funktion; 
+--
+CREATE INDEX map_industrie_g0_gidx ON map_industrie_g0 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_industrie_g0_gid_seq;
+ALTER TABLE map_industrie_g0 ADD COLUMN gid INTEGER;
+UPDATE map_industrie_g0 SET gid = nextval('map_industrie_g0_gid_seq');
+ALTER TABLE map_industrie_g0 ALTER COLUMN gid SET DEFAULT nextval('map_industrie_g0_gid_seq');
+----
Index: trunk/import/atkis_rp_rendering/processing/sql/wald_prep.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/wald_prep.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/wald_prep.sql	(revision 261)
@@ -0,0 +1,43 @@
+-- map_wald_g0 [Echtdaten, zusammengefasst nach Vegetationsmerkmal]
+-- Laufzeit gesamt: 364"
+-- ST_GeometryType(): ST_Polygon
+-- ST_IsSimple(): WAHR
+-- ST_IsEmpty(): FALSE
+-- ST_IsValid(): WAHR
+-- COUNT(*): 55019
+-- SUM(ST_NPoints()): 4058371
+DROP TABLE IF EXISTS map_wald_g0;
+DROP SEQUENCE IF EXISTS map_wald_g0_gid_seq;
+--
+SELECT (ST_Dump( ST_Union( ax_wald.wkb_geometry ))).geom AS wkb_geometry, vegetationsmerkmal AS widmung
+INTO map_wald_g0 
+FROM ax_wald 
+GROUP BY vegetationsmerkmal; 
+--
+CREATE INDEX map_wald_g0_gidx ON map_wald_g0 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_wald_g0_gid_seq;
+ALTER TABLE map_wald_g0 ADD COLUMN gid INTEGER;
+UPDATE map_wald_g0 SET gid = nextval('map_wald_g0_gid_seq');
+ALTER TABLE map_wald_g0 ALTER COLUMN gid SET DEFAULT nextval('map_wald_g0_gid_seq');
+--
+--
+DROP TABLE IF EXISTS map_wald_g1;
+DROP SEQUENCE IF EXISTS map_wald_g1_gid_seq;
+--
+-- map_wald_g1 [Echtdaten, keine Differenzierung mehr nach Vegetationsart]
+-- Laufzeit gesamt: 563"
+-- ST_GeometryType(): ST_Polygon
+-- ST_IsSimple(): WAHR
+-- ST_IsEmpty(): FALSCH
+-- ST_IsValid(): WAHR
+-- COUNT(*): 19164
+-- SUM(ST_NPoints()): 1958223
+SELECT (ST_Dump(ST_Union( wkb_geometry ))).geom AS wkb_geometry, NULL::text AS widmung 
+INTO map_wald_g1 
+FROM map_wald_g0;
+-- Index und Sequenz
+CREATE INDEX map_wald_g1_gidx ON map_wald_g1 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_wald_g1_gid_seq;
+ALTER TABLE map_wald_g1 ADD COLUMN gid INTEGER;
+UPDATE map_wald_g1 SET gid = nextval('map_wald_g1_gid_seq');
+ALTER TABLE map_wald_g1 ALTER COLUMN gid SET DEFAULT nextval('map_wald_g1_gid_seq');
Index: trunk/import/atkis_rp_rendering/processing/sql/landesflaeche.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/landesflaeche.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/landesflaeche.sql	(revision 261)
@@ -0,0 +1,148 @@
+-----------------------------------------
+-----------------------------------------
+--  LandesflÃ€che [Umriss, gefÃŒllt]
+--  alles in einer Tabelle 
+--  (keine Attributierungen)
+--  t gesamt: 30s
+-----------------------------------------
+-----------------------------------------
+--
+-- Erstellen eines Polygons der LandesflÃ€che RLP
+DROP TABLE IF EXISTS map_landesflaeche;
+--
+SELECT ST_BuildArea(ST_ExteriorRing(ST_Union( wkb_geometry ))) AS wkb_geometry
+INTO map_landesflaeche
+FROM ax_kommunalesgebiet;
+--
+CREATE INDEX map_landesflaeche_gidx ON map_landesflaeche USING GIST ( wkb_geometry );
+--
+DROP SEQUENCE IF EXISTS map_landesflaeche_gid_seq;
+CREATE SEQUENCE map_landesflaeche_gid_seq;
+ALTER TABLE map_landesflaeche ADD COLUMN gid INTEGER;
+UPDATE map_landesflaeche SET gid = nextval('map_landesflaeche_gid_seq');
+ALTER TABLE map_landesflaeche ALTER COLUMN gid SET DEFAULT nextval('map_landesflaeche_gid_seq');
+--
+--
+/*
+-- GRID - MUSS NICHT JEDES MAL ERSTELLT WERDEN!
+-- DROP-Statement wird auch nochmal in Funktion selbst aufgerufen
+-- DROP TABLE IF EXISTS map_rlp_kachel_2km, map_rlp_kachel_5km, map_rlp_kachel_10km, map_rlp_kachel_25km, map_rlp_kachel_50km; 
+
+SELECT grid( 'map_rlp_kachel_2km', wkb_geometry, 2000)
+FROM temp0;
+--
+SELECT grid( 'map_rlp_kachel_5km', wkb_geometry, 5000)
+FROM temp0;
+--
+SELECT grid( 'map_rlp_kachel_10km', wkb_geometry, 10000)
+FROM temp0;
+--
+SELECT grid( 'map_rlp_kachel_25km', wkb_geometry, 25000)
+FROM temp0;
+--
+SELECT grid( 'map_rlp_kachel_50km', wkb_geometry, 50000)
+FROM temp0;
+*/
+--
+--
+-------------------------------------------
+-- Clipping des GRID auf Landesgrenzen 
+-- ergibt gekachelte FlÃ€che Rheinland-Pfalz
+-- = Grundlage weiterer rÃ€umlicher Verschneidungen
+-- + performante Darstellung der LandesflÃ€che selbst
+--
+-- 2km Kachelung [g0] 2km
+DROP TABLE IF EXISTS map_landesflaeche_g0;
+--
+SELECT (ST_Dump(ST_Intersection( t.wkb_geometry, g.wkb_geometry ))).geom AS wkb_geometry
+INTO map_landesflaeche_g0
+FROM  map_landesflaeche t
+LEFT JOIN map_rlp_kachel_2km g
+ON ST_Intersects( t.wkb_geometry, g.wkb_geometry );
+--
+CREATE INDEX map_landesflaeche_g0_gidx ON map_landesflaeche_g0 USING GIST ( wkb_geometry );
+--
+DROP SEQUENCE IF EXISTS map_landesflaeche_g0_gid_seq;
+CREATE SEQUENCE map_landesflaeche_g0_gid_seq;
+ALTER TABLE map_landesflaeche_g0 ADD COLUMN gid INTEGER;
+UPDATE map_landesflaeche_g0 SET gid = nextval('map_landesflaeche_g0_gid_seq');
+ALTER TABLE map_landesflaeche_g0 ALTER COLUMN gid SET DEFAULT nextval('map_landesflaeche_g0_gid_seq');
+-- 423s fÃŒr RLP
+--
+--
+-- 5km Kachelung [g1] 5km
+DROP TABLE IF EXISTS map_landesflaeche_g1;
+--
+SELECT (ST_Dump(ST_Intersection( t.wkb_geometry, g.wkb_geometry ))).geom AS wkb_geometry
+INTO map_landesflaeche_g1
+FROM  map_landesflaeche t
+LEFT JOIN map_rlp_kachel_5km g
+ON ST_Intersects( t.wkb_geometry, g.wkb_geometry );
+--
+CREATE INDEX map_landesflaeche_g1_gidx ON map_landesflaeche_g1 USING GIST ( wkb_geometry );
+--
+DROP SEQUENCE IF EXISTS map_landesflaeche_g1_gid_seq;
+CREATE SEQUENCE map_landesflaeche_g1_gid_seq;
+ALTER TABLE map_landesflaeche_g1 ADD COLUMN gid INTEGER;
+UPDATE map_landesflaeche_g1 SET gid = nextval('map_landesflaeche_g1_gid_seq');
+ALTER TABLE map_landesflaeche_g1 ALTER COLUMN gid SET DEFAULT nextval('map_landesflaeche_g1_gid_seq');
+-- 67s fÃŒr RLP
+--
+--
+-- 10km Kachelung [g2] 10km
+DROP TABLE IF EXISTS map_landesflaeche_g2;
+--
+SELECT (ST_Dump(ST_Intersection( t.wkb_geometry, g.wkb_geometry ))).geom AS wkb_geometry
+INTO map_landesflaeche_g2
+FROM  map_landesflaeche t
+LEFT JOIN map_rlp_kachel_10km g
+ON ST_Intersects( t.wkb_geometry, g.wkb_geometry );
+--
+CREATE INDEX map_landesflaeche_g2_gidx ON map_landesflaeche_g2 USING GIST ( wkb_geometry );
+--
+DROP SEQUENCE IF EXISTS map_landesflaeche_g2_gid_seq;
+CREATE SEQUENCE map_landesflaeche_g2_gid_seq;
+ALTER TABLE map_landesflaeche_g2 ADD COLUMN gid INTEGER;
+UPDATE map_landesflaeche_g2 SET gid = nextval('map_landesflaeche_g2_gid_seq');
+ALTER TABLE map_landesflaeche_g2 ALTER COLUMN gid SET DEFAULT nextval('map_landesflaeche_g2_gid_seq');
+-- 17s fÃŒr RLP
+--
+--
+-- 25km Kachelung [g3] 25km
+DROP TABLE IF EXISTS map_landesflaeche_g3;
+--
+SELECT (ST_Dump(ST_Intersection( t.wkb_geometry, g.wkb_geometry ))).geom AS wkb_geometry
+INTO map_landesflaeche_g3
+FROM  map_landesflaeche t
+LEFT JOIN map_rlp_kachel_25km g
+ON ST_Intersects( t.wkb_geometry, g.wkb_geometry );
+--
+CREATE INDEX map_landesflaeche_g3_gidx ON map_landesflaeche_g3 USING GIST ( wkb_geometry );
+--
+DROP SEQUENCE IF EXISTS map_landesflaeche_g3_gid_seq;
+CREATE SEQUENCE map_landesflaeche_g3_gid_seq;
+ALTER TABLE map_landesflaeche_g3 ADD COLUMN gid INTEGER;
+UPDATE map_landesflaeche_g3 SET gid = nextval('map_landesflaeche_g3_gid_seq');
+ALTER TABLE map_landesflaeche_g3 ALTER COLUMN gid SET DEFAULT nextval('map_landesflaeche_g3_gid_seq');
+-- 3s fÃŒr RLP
+--
+--
+-- 50km Kachelung [g4] 50km
+DROP TABLE IF EXISTS map_landesflaeche_g4;
+--
+SELECT (ST_Dump(ST_Intersection( t.wkb_geometry, g.wkb_geometry ))).geom AS wkb_geometry
+INTO map_landesflaeche_g4
+FROM  map_landesflaeche t
+LEFT JOIN map_rlp_kachel_50km g
+ON ST_Intersects( t.wkb_geometry, g.wkb_geometry );
+--
+CREATE INDEX map_landesflaeche_g4_gidx ON map_landesflaeche_g4 USING GIST ( wkb_geometry );
+--
+DROP SEQUENCE IF EXISTS map_landesflaeche_g4_gid_seq;
+CREATE SEQUENCE map_landesflaeche_g4_gid_seq;
+ALTER TABLE map_landesflaeche_g4 ADD COLUMN gid INTEGER;
+UPDATE map_landesflaeche_g4 SET gid = nextval('map_landesflaeche_g4_gid_seq');
+ALTER TABLE map_landesflaeche_g4 ALTER COLUMN gid SET DEFAULT nextval('map_landesflaeche_g4_gid_seq');
+-- 1s fÃŒr RLP 
+--
+
Index: trunk/import/atkis_rp_rendering/processing/sql/stehendesgewaesser_prep.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/stehendesgewaesser_prep.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/stehendesgewaesser_prep.sql	(revision 261)
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS map_stehendesgewaesser_g0;
+DROP SEQUENCE IF EXISTS map_stehendesgewaesser_g0_gid_seq;
+--
+
+SELECT 
+wkb_geometry,
+widmung
+INTO map_stehendesgewaesser_g0 
+
+FROM (
+	SELECT (ST_Dump( ST_Union( ax_stehendesgewaesser.wkb_geometry ))).geom AS wkb_geometry, unverschluesselt as widmung 
+	FROM ax_stehendesgewaesser GROUP BY widmung 
+) AS wrapper; 
+--
+CREATE INDEX map_stehendesgewaesser_g0_gidx ON map_stehendesgewaesser_g0 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_stehendesgewaesser_g0_gid_seq;
+ALTER TABLE map_stehendesgewaesser_g0 ADD COLUMN gid INTEGER;
+UPDATE map_stehendesgewaesser_g0 SET gid = nextval('map_stehendesgewaesser_g0_gid_seq');
+ALTER TABLE map_stehendesgewaesser_g0 ALTER COLUMN gid SET DEFAULT nextval('map_stehendesgewaesser_g0_gid_seq');
+----
Index: trunk/import/atkis_rp_rendering/processing/sql/strassen_full.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/strassen_full.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/strassen_full.sql	(revision 261)
@@ -0,0 +1,117 @@
+DROP TABLE IF EXISTS map_strasse_g0;
+--
+SELECT
+(ST_Dump(ST_LineMerge(ST_Collect(ax_strassenachse.wkb_geometry)))).geom AS wkb_geometry, 
+ax_strasse.widmung,
+ax_strasse.name_, 
+CASE 
+  WHEN ax_strasse.widmung = 1301 
+  THEN unnest(regexp_matches(ax_strasse.bezeichnung, E'(A[0-9]+)'))
+  ELSE ax_strasse.bezeichnung
+END AS bezeichnung,
+ax_strasse.strassenschluessel 
+INTO map_strasse_g0
+FROM ax_strasse 
+INNER JOIN alkis_beziehungen 
+ON (alkis_beziehungen.beziehung_zu = ax_strasse.gml_id) 
+INNER JOIN ax_strassenachse ON (ax_strassenachse.gml_id=alkis_beziehungen.beziehung_von)
+GROUP BY name_, bezeichnung, strassenschluessel, widmung;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g0_gid_seq;
+CREATE SEQUENCE map_strasse_g0_gid_seq;
+ALTER TABLE map_strasse_g0 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g0 SET gid = nextval('map_strasse_g0_gid_seq');
+ALTER TABLE map_strasse_g0 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g0_gid_seq');
+CREATE INDEX map_strasse_g0_gidx ON map_strasse_g0 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g0_widmung_idx ON map_strasse_g0 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_strasse_g1;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 5) AS wkb_geometry, widmung, name_, bezeichnung
+INTO map_strasse_g1
+FROM map_strasse_g0;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g1_gid_seq;
+CREATE SEQUENCE map_strasse_g1_gid_seq;
+ALTER TABLE map_strasse_g1 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g1 SET gid = nextval('map_strasse_g1_gid_seq');
+ALTER TABLE map_strasse_g1 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g1_gid_seq');
+CREATE INDEX map_strasse_g1_gidx ON map_strasse_g1 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g1_widmung_idx ON map_strasse_g1 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_strasse_g2;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 15) AS wkb_geometry, widmung, name_, bezeichnung
+INTO map_strasse_g2
+FROM map_strasse_g1;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g2_gid_seq;
+CREATE SEQUENCE map_strasse_g2_gid_seq;
+ALTER TABLE map_strasse_g2 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g2 SET gid = nextval('map_strasse_g2_gid_seq');
+ALTER TABLE map_strasse_g2 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g2_gid_seq');
+CREATE INDEX map_strasse_g2_gidx ON map_strasse_g2 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g2_widmung_idx ON map_strasse_g2 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_strasse_g3;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 35) AS wkb_geometry, widmung, name_, bezeichnung
+INTO map_strasse_g3
+FROM map_strasse_g2;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g3_gid_seq;
+CREATE SEQUENCE map_strasse_g3_gid_seq;
+ALTER TABLE map_strasse_g3 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g3 SET gid = nextval('map_strasse_g3_gid_seq');
+ALTER TABLE map_strasse_g3 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g3_gid_seq');
+CREATE INDEX map_strasse_g3_gidx ON map_strasse_g3 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g3_widmung_idx ON map_strasse_g3 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_strasse_g4;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 50) AS wkb_geometry, widmung, name_, bezeichnung
+INTO map_strasse_g4
+FROM map_strasse_g3;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g4_gid_seq;
+CREATE SEQUENCE map_strasse_g4_gid_seq;
+ALTER TABLE map_strasse_g4 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g4 SET gid = nextval('map_strasse_g4_gid_seq');
+ALTER TABLE map_strasse_g4 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g4_gid_seq');
+CREATE INDEX map_strasse_g4_gidx ON map_strasse_g4 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g4_widmung_idx ON map_strasse_g4 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_strasse_g5;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 100) AS wkb_geometry, widmung, name_, bezeichnung
+INTO map_strasse_g5
+FROM map_strasse_g4;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g5_gid_seq;
+CREATE SEQUENCE map_strasse_g5_gid_seq;
+ALTER TABLE map_strasse_g5 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g5 SET gid = nextval('map_strasse_g5_gid_seq');
+ALTER TABLE map_strasse_g5 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g5_gid_seq');
+CREATE INDEX map_strasse_g5_gidx ON map_strasse_g5 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g5_widmung_idx ON map_strasse_g5 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_strasse_g6;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology(wkb_geometry, 200))).geom AS wkb_geometry, widmung, name_, bezeichnung
+INTO map_strasse_g6
+FROM map_strasse_g5;
+--
+DROP SEQUENCE IF EXISTS map_strasse_g6_gid_seq;
+CREATE SEQUENCE map_strasse_g6_gid_seq;
+ALTER TABLE map_strasse_g6 ADD COLUMN gid INTEGER;
+UPDATE map_strasse_g6 SET gid = nextval('map_strasse_g6_gid_seq');
+ALTER TABLE map_strasse_g6 ALTER COLUMN gid SET DEFAULT nextval('map_strasse_g6_gid_seq');
+CREATE INDEX map_strasse_g6_gidx ON map_strasse_g6 USING GIST ( wkb_geometry );
+CREATE INDEX map_strasse_g6_widmung_idx ON map_strasse_g6 (widmung);
+--
Index: trunk/import/atkis_rp_rendering/processing/sql/gruenland_prep.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/gruenland_prep.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/gruenland_prep.sql	(revision 261)
@@ -0,0 +1,16 @@
+--
+DROP TABLE IF EXISTS map_gruenland_g0;
+DROP SEQUENCE IF EXISTS map_gruenland_g0_gid_seq;
+--
+SELECT (ST_Dump( ST_Union( ax_landwirtschaft.wkb_geometry ))).geom AS wkb_geometry, vegetationsmerkmal AS widmung
+INTO map_gruenland_g0 
+FROM ax_landwirtschaft 
+WHERE vegetationsmerkmal = 1020  --
+GROUP BY vegetationsmerkmal; 
+--
+CREATE INDEX map_gruenland_g0_gidx ON map_gruenland_g0 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_gruenland_g0_gid_seq;
+ALTER TABLE map_gruenland_g0 ADD COLUMN gid INTEGER;
+UPDATE map_gruenland_g0 SET gid = nextval('map_gruenland_g0_gid_seq');
+ALTER TABLE map_gruenland_g0 ALTER COLUMN gid SET DEFAULT nextval('map_gruenland_g0_gid_seq');
+--
Index: trunk/import/atkis_rp_rendering/processing/sql/ortslage_prep.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/ortslage_prep.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/ortslage_prep.sql	(revision 261)
@@ -0,0 +1,24 @@
+-- map_wald_g0 [Echtdaten, zusammengefasst]
+-- Laufzeit gesamt: 18"
+-- ST_GeometryType(): ST_Polygon
+-- ST_IsSimple(): WAHR
+-- ST_IsEmpty(): FALSE
+-- ST_IsValid(): WAHR
+-- COUNT(*): 3956 
+-- SUM(ST_NPoints()): 612574
+DROP TABLE IF EXISTS map_ortslage_g0;
+DROP SEQUENCE IF EXISTS map_ortslage_g0_gid_seq;
+--
+SELECT (ST_Dump( ST_Union( wkb_geometry ))).geom AS wkb_geometry, name_ AS widmung
+INTO map_ortslage_g0 
+FROM ax_ortslage
+GROUP BY name_;
+--
+CREATE INDEX map_ortslage_g0_gidx ON map_ortslage_g0 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_ortslage_g0_gid_seq;
+ALTER TABLE map_ortslage_g0 ADD COLUMN gid INTEGER;
+UPDATE map_ortslage_g0 SET gid = nextval('map_ortslage_g0_gid_seq');
+ALTER TABLE map_ortslage_g0 ALTER COLUMN gid SET DEFAULT nextval('map_ortslage_g0_gid_seq');
+--
+
+
Index: trunk/import/atkis_rp_rendering/processing/sql/sonderkultur_prep.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/sonderkultur_prep.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/sonderkultur_prep.sql	(revision 261)
@@ -0,0 +1,21 @@
+--
+DROP TABLE IF EXISTS map_sonderkultur_g0;
+DROP SEQUENCE IF EXISTS map_sonderkultur_g0_gid_seq;
+--
+SELECT (ST_Dump( ST_Union( ax_landwirtschaft.wkb_geometry ))).geom AS wkb_geometry, vegetationsmerkmal AS widmung
+INTO map_sonderkultur_g0 
+FROM ax_landwirtschaft 
+WHERE vegetationsmerkmal in ( 
+   1012, -- Hopfen; ohne Signatur - nur FlÃ€chenfÃ€rbung
+   1031,  -- Baumschule; ohne Signatur - dito
+   1040, -- Weingarten; signaturiert
+   1050  -- Obstplantage; signaturiert
+) -- 
+GROUP BY vegetationsmerkmal; 
+--
+CREATE INDEX map_sonderkultur_g0_gidx ON map_sonderkultur_g0 USING GIST ( wkb_geometry ); 
+CREATE SEQUENCE map_sonderkultur_g0_gid_seq;
+ALTER TABLE map_sonderkultur_g0 ADD COLUMN gid INTEGER;
+UPDATE map_sonderkultur_g0 SET gid = nextval('map_sonderkultur_g0_gid_seq');
+ALTER TABLE map_sonderkultur_g0 ALTER COLUMN gid SET DEFAULT nextval('map_sonderkultur_g0_gid_seq');
+--
Index: trunk/import/atkis_rp_rendering/processing/sql/fluesse_full.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/fluesse_full.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/fluesse_full.sql	(revision 261)
@@ -0,0 +1,104 @@
+DROP TABLE IF EXISTS map_fluesse_g0;
+--
+
+SELECT (ST_Dump(ST_Union(ax_fliessgewaesser.wkb_geometry))).geom AS wkb_geometry, ax_wasserlauf.name_ AS widmung
+INTO map_fluesse_g0
+FROM ax_wasserlauf 
+INNER JOIN alkis_beziehungen 
+	ON (alkis_beziehungen.beziehung_zu = ax_wasserlauf.gml_id) 
+INNER JOIN ax_fliessgewaesser 
+	ON (ax_fliessgewaesser.gml_id=alkis_beziehungen.beziehung_von)
+GROUP BY name_
+/*
+--
+UNION ALL 
+--
+SELECT wkb_geometry AS wkb_geometry, NULL AS name_
+FROM ax_gewaesserachse
+*/
+;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g0_gid_seq;
+CREATE SEQUENCE map_fluesse_g0_gid_seq;
+ALTER TABLE map_fluesse_g0 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g0 SET gid = nextval('map_fluesse_g0_gid_seq');
+ALTER TABLE map_fluesse_g0 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g0_gid_seq');
+CREATE INDEX map_fluesse_g0_gidx ON map_fluesse_g0 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_fluesse_g1;
+--
+SELECT (ST_Dump(ST_Buffer(ST_SimplifyPreserveTopology(ST_Buffer(wkb_geometry, 4), 8),-4))).geom AS wkb_geometry, widmung 
+INTO map_fluesse_g1 FROM map_fluesse_g0;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g1_gid_seq;
+CREATE SEQUENCE map_fluesse_g1_gid_seq;
+ALTER TABLE map_fluesse_g1 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g1 SET gid = nextval('map_fluesse_g1_gid_seq');
+ALTER TABLE map_fluesse_g1 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g1_gid_seq');
+CREATE INDEX map_fluesse_g1_gidx ON map_fluesse_g1 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_fluesse_g2;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology(ST_Buffer(ST_Buffer(wkb_geometry, 8), -8),30))).geom AS wkb_geometry, widmung INTO map_fluesse_g2 FROM map_fluesse_g1;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g2_gid_seq;
+CREATE SEQUENCE map_fluesse_g2_gid_seq;
+ALTER TABLE map_fluesse_g2 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g2 SET gid = nextval('map_fluesse_g2_gid_seq');
+ALTER TABLE map_fluesse_g2 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g2_gid_seq');
+CREATE INDEX map_fluesse_g2_gidx ON map_fluesse_g2 USING GIST ( wkb_geometry );
+--
+--
+--
+DROP TABLE IF EXISTS map_fluesse_g3;
+--
+SELECT wkb_geometry, widmung INTO map_fluesse_g3 FROM map_fluesse_g2;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g3_gid_seq;
+CREATE SEQUENCE map_fluesse_g3_gid_seq;
+ALTER TABLE map_fluesse_g3 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g3 SET gid = nextval('map_fluesse_g3_gid_seq');
+ALTER TABLE map_fluesse_g3 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g3_gid_seq');
+CREATE INDEX map_fluesse_g3_gidx ON map_fluesse_g3 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_fluesse_g4;
+--
+SELECT wkb_geometry, widmung INTO map_fluesse_g4 FROM map_fluesse_g3;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g4_gid_seq;
+CREATE SEQUENCE map_fluesse_g4_gid_seq;
+ALTER TABLE map_fluesse_g4 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g4 SET gid = nextval('map_fluesse_g4_gid_seq');
+ALTER TABLE map_fluesse_g4 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g4_gid_seq');
+CREATE INDEX map_fluesse_g4_gidx ON map_fluesse_g4 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_fluesse_g5;
+--
+SELECT wkb_geometry, widmung INTO map_fluesse_g5 FROM map_fluesse_g4;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g5_gid_seq;
+CREATE SEQUENCE map_fluesse_g5_gid_seq;
+ALTER TABLE map_fluesse_g5 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g5 SET gid = nextval('map_fluesse_g5_gid_seq');
+ALTER TABLE map_fluesse_g5 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g5_gid_seq');
+CREATE INDEX map_fluesse_g5_gidx ON map_fluesse_g5 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_fluesse_g6;
+--
+SELECT wkb_geometry, widmung INTO map_fluesse_g6 FROM map_fluesse_g5;
+--
+DROP SEQUENCE IF EXISTS map_fluesse_g6_gid_seq;
+CREATE SEQUENCE map_fluesse_g6_gid_seq;
+ALTER TABLE map_fluesse_g6 ADD COLUMN gid INTEGER;
+UPDATE map_fluesse_g6 SET gid = nextval('map_fluesse_g6_gid_seq');
+ALTER TABLE map_fluesse_g6 ALTER COLUMN gid SET DEFAULT nextval('map_fluesse_g6_gid_seq');
+CREATE INDEX map_fluesse_g6_gidx ON map_fluesse_g6 USING GIST ( wkb_geometry );
+
+
+
+
Index: trunk/import/atkis_rp_rendering/processing/sql/baeche_full.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/baeche_full.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/baeche_full.sql	(revision 261)
@@ -0,0 +1,102 @@
+DROP TABLE IF EXISTS ax_gewaesserachse_merged;
+--
+SELECT 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 
+(ax_gewaesserachse.gml_id=alkis_beziehungen.beziehung_von);
+--
+DROP TABLE IF EXISTS map_baeche_g0;
+--
+SELECT (ST_Dump(ST_Linemerge(ST_Collect(ST_SimplifyPreserveTopology( wkb_geometry, 2.5 ))))).geom AS wkb_geometry,
+widmung
+INTO map_baeche_g0 
+FROM ax_gewaesserachse_merged GROUP BY ax_gewaesserachse_merged.widmung;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g0_gid_seq;
+CREATE SEQUENCE map_baeche_g0_gid_seq;
+ALTER TABLE map_baeche_g0 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g0 SET gid = nextval('map_baeche_g0_gid_seq');
+ALTER TABLE map_baeche_g0 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g0_gid_seq');
+CREATE INDEX map_baeche_g0_gidx ON map_baeche_g0 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_baeche_g1;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 5 ))).geom AS wkb_geometry, widmung
+INTO map_baeche_g1 
+FROM map_baeche_g0;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g1_gid_seq;
+CREATE SEQUENCE map_baeche_g1_gid_seq;
+ALTER TABLE map_baeche_g1 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g1 SET gid = nextval('map_baeche_g1_gid_seq');
+ALTER TABLE map_baeche_g1 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g1_gid_seq');
+CREATE INDEX map_baeche_g1_gidx ON map_baeche_g1 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_baeche_g2;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 15 ))).geom AS wkb_geometry, widmung
+INTO map_baeche_g2 
+FROM map_baeche_g1;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g2_gid_seq;
+CREATE SEQUENCE map_baeche_g2_gid_seq;
+ALTER TABLE map_baeche_g2 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g2 SET gid = nextval('map_baeche_g2_gid_seq');
+ALTER TABLE map_baeche_g2 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g2_gid_seq');
+CREATE INDEX map_baeche_g2_gidx ON map_baeche_g2 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_baeche_g3;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 35 ))).geom AS wkb_geometry, widmung
+INTO map_baeche_g3 
+FROM map_baeche_g2;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g3_gid_seq;
+CREATE SEQUENCE map_baeche_g3_gid_seq;
+ALTER TABLE map_baeche_g3 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g3 SET gid = nextval('map_baeche_g3_gid_seq');
+ALTER TABLE map_baeche_g3 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g3_gid_seq');
+CREATE INDEX map_baeche_g3_gidx ON map_baeche_g3 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_baeche_g4;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 65 ))).geom AS wkb_geometry, widmung
+INTO map_baeche_g4 
+FROM map_baeche_g3;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g4_gid_seq;
+CREATE SEQUENCE map_baeche_g4_gid_seq;
+ALTER TABLE map_baeche_g4 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g4 SET gid = nextval('map_baeche_g4_gid_seq');
+ALTER TABLE map_baeche_g4 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g4_gid_seq');
+CREATE INDEX map_baeche_g4_gidx ON map_baeche_g4 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_baeche_g5;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 125 ))).geom AS wkb_geometry, widmung
+INTO map_baeche_g5 
+FROM map_baeche_g4;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g5_gid_seq;
+CREATE SEQUENCE map_baeche_g5_gid_seq;
+ALTER TABLE map_baeche_g5 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g5 SET gid = nextval('map_baeche_g5_gid_seq');
+ALTER TABLE map_baeche_g5 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g5_gid_seq');
+CREATE INDEX map_baeche_g5_gidx ON map_baeche_g5 USING GIST ( wkb_geometry );
+--
+--
+DROP TABLE IF EXISTS map_baeche_g6;
+--
+SELECT (ST_Dump(ST_SimplifyPreserveTopology( wkb_geometry, 250 ))).geom AS wkb_geometry, widmung
+INTO map_baeche_g6 
+FROM map_baeche_g5;
+--
+DROP SEQUENCE IF EXISTS map_baeche_g6_gid_seq;
+CREATE SEQUENCE map_baeche_g6_gid_seq;
+ALTER TABLE map_baeche_g6 ADD COLUMN gid INTEGER;
+UPDATE map_baeche_g6 SET gid = nextval('map_baeche_g6_gid_seq');
+ALTER TABLE map_baeche_g6 ALTER COLUMN gid SET DEFAULT nextval('map_baeche_g6_gid_seq');
+CREATE INDEX map_baeche_g6_gidx ON map_baeche_g6 USING GIST ( wkb_geometry );
Index: trunk/import/atkis_rp_rendering/processing/sql/wege_full.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/wege_full.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/wege_full.sql	(revision 261)
@@ -0,0 +1,50 @@
+DROP TABLE IF EXISTS map_wege_g0;
+--
+SELECT
+(ST_Dump(ST_LineMerge(ST_Collect(ax_fahrwegachse.wkb_geometry)))).geom AS wkb_geometry, 
+NULL::text AS widmung
+INTO map_wege_g0
+FROM ax_fahrwegachse;
+--
+DROP SEQUENCE IF EXISTS map_wege_g0_gid_seq;
+CREATE SEQUENCE map_wege_g0_gid_seq;
+ALTER TABLE map_wege_g0 ADD COLUMN gid INTEGER;
+UPDATE map_wege_g0 SET gid = nextval('map_wege_g0_gid_seq');
+ALTER TABLE map_wege_g0 ALTER COLUMN gid SET DEFAULT nextval('map_wege_g0_gid_seq');
+CREATE INDEX map_wege_g0_gidx ON map_wege_g0 USING GIST ( wkb_geometry );
+CREATE INDEX map_wege_g0_widmung_idx ON map_wege_g0 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_wege_g1;
+--
+
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 5) AS wkb_geometry, widmung
+INTO map_wege_g1
+FROM map_wege_g0
+WHERE ST_Length( wkb_geometry ) > 5;
+--
+DROP SEQUENCE IF EXISTS map_wege_g1_gid_seq;
+CREATE SEQUENCE map_wege_g1_gid_seq;
+ALTER TABLE map_wege_g1 ADD COLUMN gid INTEGER;
+UPDATE map_wege_g1 SET gid = nextval('map_wege_g1_gid_seq');
+ALTER TABLE map_wege_g1 ALTER COLUMN gid SET DEFAULT nextval('map_wege_g1_gid_seq');
+CREATE INDEX map_wege_g1_gidx ON map_wege_g1 USING GIST ( wkb_geometry );
+CREATE INDEX map_wege_g1_widmung_idx ON map_wege_g1 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_wege_g2;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 15) AS wkb_geometry, widmung
+INTO map_wege_g2
+FROM map_wege_g1
+WHERE ST_Length( wkb_geometry ) > 15;
+--
+DROP SEQUENCE IF EXISTS map_wege_g2_gid_seq;
+CREATE SEQUENCE map_wege_g2_gid_seq;
+ALTER TABLE map_wege_g2 ADD COLUMN gid INTEGER;
+UPDATE map_wege_g2 SET gid = nextval('map_wege_g2_gid_seq');
+ALTER TABLE map_wege_g2 ALTER COLUMN gid SET DEFAULT nextval('map_wege_g2_gid_seq');
+CREATE INDEX map_wege_g2_gidx ON map_wege_g2 USING GIST ( wkb_geometry );
+CREATE INDEX map_wege_g2_widmung_idx ON map_wege_g2 (widmung);
+--
+--
Index: trunk/import/atkis_rp_rendering/processing/sql/bahn_full.sql
===================================================================
--- trunk/import/atkis_rp_rendering/processing/sql/bahn_full.sql	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/sql/bahn_full.sql	(revision 261)
@@ -0,0 +1,79 @@
+DROP TABLE IF EXISTS map_bahn_g0;
+--
+SELECT
+(ST_Dump(ST_LineMerge(ST_Collect(ST_SimplifyPreserveTopology(ax_bahnstrecke.wkb_geometry, 2.5))))).geom AS wkb_geometry, NULL::text AS widmung
+INTO map_bahn_g0
+FROM ax_bahnstrecke;
+--
+DROP SEQUENCE IF EXISTS map_bahn_g0_gid_seq;
+CREATE SEQUENCE map_bahn_g0_gid_seq;
+ALTER TABLE map_bahn_g0 ADD COLUMN gid INTEGER;
+UPDATE map_bahn_g0 SET gid = nextval('map_bahn_g0_gid_seq');
+ALTER TABLE map_bahn_g0 ALTER COLUMN gid SET DEFAULT nextval('map_bahn_g0_gid_seq');
+CREATE INDEX map_bahn_g0_gidx ON map_bahn_g0 USING GIST ( wkb_geometry );
+CREATE INDEX map_bahn_g0_widmung_idx ON map_bahn_g0 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_bahn_g1;
+--
+
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 5) AS wkb_geometry, widmung
+INTO map_bahn_g1
+FROM map_bahn_g0
+WHERE ST_Length( wkb_geometry ) > 45;
+--
+DROP SEQUENCE IF EXISTS map_bahn_g1_gid_seq;
+CREATE SEQUENCE map_bahn_g1_gid_seq;
+ALTER TABLE map_bahn_g1 ADD COLUMN gid INTEGER;
+UPDATE map_bahn_g1 SET gid = nextval('map_bahn_g1_gid_seq');
+ALTER TABLE map_bahn_g1 ALTER COLUMN gid SET DEFAULT nextval('map_bahn_g1_gid_seq');
+CREATE INDEX map_bahn_g1_gidx ON map_bahn_g1 USING GIST ( wkb_geometry );
+CREATE INDEX map_bahn_g1_widmung_idx ON map_bahn_g1 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_bahn_g2;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 25) AS wkb_geometry, widmung
+INTO map_bahn_g2
+FROM map_bahn_g1
+WHERE ST_Length( wkb_geometry ) > 90;
+--
+DROP SEQUENCE IF EXISTS map_bahn_g2_gid_seq;
+CREATE SEQUENCE map_bahn_g2_gid_seq;
+ALTER TABLE map_bahn_g2 ADD COLUMN gid INTEGER;
+UPDATE map_bahn_g2 SET gid = nextval('map_bahn_g2_gid_seq');
+ALTER TABLE map_bahn_g2 ALTER COLUMN gid SET DEFAULT nextval('map_bahn_g2_gid_seq');
+CREATE INDEX map_bahn_g2_gidx ON map_bahn_g2 USING GIST ( wkb_geometry );
+CREATE INDEX map_bahn_g2_widmung_idx ON map_bahn_g2 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_bahn_g3;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 50) AS wkb_geometry, widmung
+INTO map_bahn_g3
+FROM map_bahn_g2
+WHERE ST_Length( wkb_geometry ) > 90;
+--
+DROP SEQUENCE IF EXISTS map_bahn_g3_gid_seq;
+CREATE SEQUENCE map_bahn_g3_gid_seq;
+ALTER TABLE map_bahn_g3 ADD COLUMN gid INTEGER;
+UPDATE map_bahn_g3 SET gid = nextval('map_bahn_g3_gid_seq');
+ALTER TABLE map_bahn_g3 ALTER COLUMN gid SET DEFAULT nextval('map_bahn_g3_gid_seq');
+CREATE INDEX map_bahn_g3_gidx ON map_bahn_g3 USING GIST ( wkb_geometry );
+CREATE INDEX map_bahn_g3_widmung_idx ON map_bahn_g3 (widmung);
+--
+--
+DROP TABLE IF EXISTS map_bahn_g4;
+--
+SELECT ST_SimplifyPreserveTopology(wkb_geometry, 150) AS wkb_geometry, widmung
+INTO map_bahn_g4
+FROM map_bahn_g3
+WHERE ST_Length( wkb_geometry ) > 90;
+--
+DROP SEQUENCE IF EXISTS map_bahn_g4_gid_seq;
+CREATE SEQUENCE map_bahn_g4_gid_seq;
+ALTER TABLE map_bahn_g4 ADD COLUMN gid INTEGER;
+UPDATE map_bahn_g4 SET gid = nextval('map_bahn_g4_gid_seq');
+ALTER TABLE map_bahn_g4 ALTER COLUMN gid SET DEFAULT nextval('map_bahn_g4_gid_seq');
+CREATE INDEX map_bahn_g4_gidx ON map_bahn_g4 USING GIST ( wkb_geometry );
+CREATE INDEX map_bahn_g4_widmung_idx ON map_bahn_g4 (widmung);
Index: trunk/import/atkis_rp_rendering/processing/psql.conf
===================================================================
--- trunk/import/atkis_rp_rendering/processing/psql.conf	(revision 261)
+++ trunk/import/atkis_rp_rendering/processing/psql.conf	(revision 261)
@@ -0,0 +1,6 @@
+# Konfig
+dbname=atkis
+dbhost=10.50.165.220
+dbport=5434
+dbuser=postgres
+dbpass=false
