wip data import from OSM
This commit is contained in:
parent
6f95702cb9
commit
4b2f8bd65d
3
.gitignore
vendored
3
.gitignore
vendored
@ -32,3 +32,6 @@ version.tex
|
||||
db/
|
||||
_minted-*/
|
||||
*.qgz
|
||||
|
||||
.faux*
|
||||
*.pbf
|
||||
|
23
IV/Makefile
Normal file
23
IV/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
# HACK HACK
|
||||
EMPTY :=
|
||||
SPACE := $(EMPTY) $(EMPTY)
|
||||
|
||||
RIVERS ?= Visinčia Šalčia Žeimena Lakaja
|
||||
|
||||
.faux_filter-rivers: .faux_import-osm
|
||||
./filter-rivers-query.awk $(RIVERS) | ./db -f -
|
||||
touch $@
|
||||
|
||||
.faux_import-osm: lithuania-latest.osm.pbf .faux.db
|
||||
PGPASSWORD=osm osm2pgsql \
|
||||
-c --multi-geometry \
|
||||
-H 127.0.0.1 -d osm -U osm \
|
||||
$<
|
||||
touch $@
|
||||
|
||||
.faux.db:
|
||||
./db start
|
||||
touch $@
|
||||
|
||||
lithuania-latest.osm.pbf:
|
||||
wget http://download.geofabrik.de/europe/lithuania-latest.osm.pbf
|
1
IV/db
1
IV/db
@ -28,6 +28,7 @@ _wait_for_postgres() {
|
||||
|
||||
case ${1:-} in
|
||||
start)
|
||||
_psql -qc '\q' 2>/dev/null && exit 0
|
||||
docker run -d --rm \
|
||||
-p 5432:5432 \
|
||||
-e POSTGRES_DBNAME=osm \
|
||||
|
12
IV/filter-rivers-query.awk
Executable file
12
IV/filter-rivers-query.awk
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
BEGIN {
|
||||
print "DROP TABLE IF EXISTS rivers;";
|
||||
printf "CREATE TABLE rivers AS SELECT name,way FROM planet_osm_line WHERE "
|
||||
for (i = 1; i < ARGC; i++) {
|
||||
printf "name='%s'", ARGV[i]
|
||||
if (i != ARGC - 1)
|
||||
printf " OR ";
|
||||
}
|
||||
print ";";
|
||||
}
|
@ -51,6 +51,9 @@ insert into selfcrossing select name, (self_crossing(ways)).* from inflections;
|
||||
create table demo_selfcrossing3 (name text, i bigint, way geometry);
|
||||
insert into demo_selfcrossing3 select name, generate_subscripts(ways, 1), unnest(ways) from selfcrossing;
|
||||
|
||||
-- COMBINED
|
||||
drop table if exists demo_wm;
|
||||
create table demo_wm (name text, i bigint, way geometry);
|
||||
|
||||
do $$
|
||||
declare
|
||||
|
Loading…
Reference in New Issue
Block a user