After about one months I got all Europe's data from OSM imported.
Now I needed to create some help tables, so I fired these queries:
CREATE TABLE city_admin_boundaries AS
SELECT
NEXTVAL('city_admin_boundaries_seq') AS id,
planet_osm_polygon.way,
planet_osm_polygon.admin_level,
planet_osm_point.name,
planet_osm_point.place,
CASE
WHEN (planet_osm_point.tags->'population' ~ '^[0-9]{1,8}$') THEN
(planet_osm_point.tags->'population')::INTEGER ELSE 0
END as population,
(ST_Area(ST_Transform(planet_osm_polygon.way, 4326)::geography) /
1000000) AS km2
FROM planet_osm_polygon
JOIN (
SELECT name, MAX(admin_level) AS al
FROM planet_osm_polygon
WHERE boundary = 'administrative' AND admin_level IN ('4', '6', '8')
AND osm_id < 0 GROUP BY name
) size USING(name)
JOIN planet_osm_point USING (name)
WHERE planet_osm_polygon.boundary = 'administrative' AND
planet_osm_polygon.admin_level = size.al AND
(
(
planet_osm_polygon.admin_level IN ('6', '8') AND
planet_osm_point.place IN ('city', 'town')
) OR
(
planet_osm_polygon.admin_level = '4' AND
planet_osm_point.place = 'city'
)
) AND
planet_osm_polygon.osm_id < 0;
CREATE TABLE city_boundaries AS
SELECT NEXTVAL('city_boundaries_seq') AS id,
ST_CollectionExtract(unnest(ST_ClusterWithin(planet_osm_polygon.way,
200)), 3)::geometry(MultiPolygon, 3857) as way
FROM planet_osm_polygon, city_admin_boundaries
WHERE landuse IN ('residential', 'retail', 'retail;residential',
'commercial', 'school', 'university', 'industrial',
'asphalt', 'cemetery', 'civic', 'civic_admin',
'concrete_surface', 'construction', 'education',
'educational', 'institutional', 'village') AND
ST_Within(planet_osm_polygon.way, city_admin_boundaries.way)
AND
(
(city_admin_boundaries.admin_level = '4' AND km2 >= 100)
OR
(
population > 18000 AND
(
(city_admin_boundaries.admin_level = '6' AND km2 >=
50) OR
(city_admin_boundaries.admin_level = '8' AND km2 >=
25)
)
) OR
(
population > 10000 AND city_admin_boundaries.admin_level
= '8' AND km2 >= 100
)
);
ALTER TABLE city_boundaries OWNER TO _renderd;
DELETE FROM city_boundaries WHERE ST_Area(ST_Buffer(way, -50)) < 50;
UPDATE city_boundaries SET way =
ST_Makevalid(ST_Multi(ST_Buffer(ST_Buffer(way, 300, 'join=miter'), -300,
'join=miter')));
The table were created successfully (13828 rows the first, 108385 the
seconds). The "DELETE" worked successfully, too, but on the UPDATE the
process crashes...
In PostgresSQL log I find:
2021-01-27 07:06:02.165 CET [582] LOG: Serverprozess (PID 10391) wurde
von Signal 9 beendet: Getötet
2021-01-27 07:06:02.165 CET [582] DETAIL: Der fehlgeschlagene Prozess
führte aus: UPDATE city_boundaries SET way =
ST_Makevalid(ST_Multi(ST_Buffer(ST_Buffer(way, 300, 'join=miter'), -300,
'join=miter')));
2021-01-27 07:06:02.178 CET [582] LOG: aktive Serverprozesse werden
abgebrochen
2021-01-27 07:06:02.179 CET [10238] postgres@gis WARNUNG: Verbindung
wird abgebrochen wegen Absturz eines anderen Serverprozesses
2021-01-27 07:06:02.179 CET [10238] postgres@gis DETAIL: Der Postmaster
hat diesen Serverprozess angewiesen, die aktuelle Transaktion
zurückzurollen und die Sitzung zu beenden, weil ein anderer
Serverprozess abnormal beendet wurde und möglicherweise das Shared
Memory verfälscht hat.
2021-01-27 07:06:02.179 CET [10238] postgres@gis TIPP: In einem Moment
sollten Sie wieder mit der Datenbank verbinden und Ihren Befehl
wiederholen können.
2021-01-27 07:06:02.180 CET [10234] WARNUNG: Verbindung wird
abgebrochen wegen Absturz eines anderen Serverprozesses
2021-01-27 07:06:02.180 CET [10234] DETAIL: Der Postmaster hat diesen
Serverprozess angewiesen, die aktuelle Transaktion zurückzurollen und
die Sitzung zu beenden, weil ein anderer Serverprozess abnormal beendet
wurde und möglicherweise das Shared Memory verfälscht hat.
2021-01-27 07:06:02.180 CET [10234] TIPP: In einem Moment sollten Sie
wieder mit der Datenbank verbinden und Ihren Befehl wiederholen können.
2021-01-27 07:06:02.997 CET [582] LOG: alle Serverprozesse beendet;
initialisiere neu
2021-01-27 07:06:03.208 CET [10410] LOG: Datenbanksystem wurde
unterbrochen; letzte bekannte Aktion am 2021-01-27 07:01:27 CET
2021-01-27 07:06:03.208 CET [10411] postgres@gis FATAL: das
Datenbanksystem ist im Wiederherstellungsmodus
2021-01-27 07:06:03.786 CET [10410] LOG: Datenbanksystem wurde nicht
richtig heruntergefahren; automatische Wiederherstellung läuft
2021-01-27 07:06:03.937 CET [10410] LOG: Redo beginnt bei 11F/22E1D520
2021-01-27 07:06:04.317 CET [10410] LOG: ungültige Datensatzlänge bei
11F/24124828: 24 erwartet, 0 erhalten
2021-01-27 07:06:04.317 CET [10410] LOG: Redo fertig bei 11F/241247F0
2021-01-27 07:06:05.597 CET [582] LOG: Datenbanksystem ist bereit, um
Verbindungen anzunehmen
Of course, I didn't killed the query...
I think, the problem could be "ungültige Datensatzlänge bei
11F/24124828: 24 erwartet, 0 erhalten" (invalid data length...).
The same query fired on a test server with just data from Saxony,
Brandenburg and Czeck Republic worked fine.
Could someone help me to solve the problem?
Thanks
Luca Bertoncello
(luca...@lucabert.de)
_______________________________________________
postgis-users mailing list
postgi...@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users
I tried now to add a SWAP file. I know, this is not the best, but right
now I cannot add more RAM to the PC...
It seems to help, since it runs and didn't crash yet...