====== Infrastruktura ======
Cilem je vzgenerovat mapu zajimave infrastruktury.
==== OSM ====
Download OSM exportu ceske republiky (aktualizovano kazdou pulnoc) [[http://osm.kyblsoft.cz/archiv/]]
Po rozbaleni cca 14GiB
==== postgresql ====
Nastaveni psql je vzdycky boj...
apt-get install postgresql osm2pgsql postgresql-9.6-postgis-2.3
su postgres
cd $HOME
createuser --superuser root
createdb gis
alter user root with password '$%&%^#$#';
create extension postgis_tiger_geocoder;
create extension address_standardizer_data_us;
create extension address_standardizer;
create extension fuzzystrmatch;
create extension postgis_sfcgal;
create extension postgis_topology;
create extension postgis;
=== Pristup z localhostu s heslem ale bez hesla ===
Editovat /etc/postgresql/9.6/main/pg_hba.conf a prepsat opravneni na "trusted", aby heslo neotravovalo.
Uzivatel musi mit nastavene heslo protoze mapnik a jine tooly neumi pristup bez hesla
==== postgres v RAM ====
Mate spoustu RAMeti ale pomale disky?
/etc/init.d/postgresql stop
mv /var/lib/postgresql/9.6/main /dev/shm/
mkdir /var/lib/postgresql/9.6/main
chown postgres:postgres /var/lib/postgresql/9.6/main
chmod 700 /var/lib/postgresql/9.6/main
mount -t bind /dev/shm/main /var/lib/postgresql/9.6/main
/etc/init.d/postgresql start
==== Import dat ====
Import .osm (trva par minut)
osm2pgsql -s -d gis -C 22000 ./czech_republic-2018-08-02.osm
Kontrola ze se nahralo...
psql gis
gis=# SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
public.planet_osm_nodes | 4048 MB
public.planet_osm_ways_nodes | 3718 MB
public.planet_osm_ways | 2003 MB
public.planet_osm_polygon | 1804 MB
public.planet_osm_nodes_pkey | 1666 MB
public.planet_osm_polygon_index | 638 MB
public.planet_osm_line | 539 MB
public.planet_osm_point | 282 MB
public.planet_osm_point_index | 187 MB
public.planet_osm_line_index | 187 MB
public.planet_osm_roads | 170 MB
public.planet_osm_ways_pkey | 157 MB
public.planet_osm_polygon_pkey | 122 MB
public.planet_osm_point_pkey | 75 MB
public.planet_osm_rels | 73 MB
pg_toast.pg_toast_45676 | 58 MB
public.planet_osm_rels_parts | 49 MB
pg_toast.pg_toast_45680 | 47 MB
public.planet_osm_line_pkey | 33 MB
pg_toast.pg_toast_45675 | 33 MB
==== TODO ====
https://gis.stackexchange.com/questions/292464/mapnik-postgresql-python-segmentation-fault
Vsechny nastroje na vygenerovani mapy (mapnik,...) bud hodi SIGSEGV nebo jinak nefunguji :(