Last active
August 29, 2015 14:16
-
-
Save alexanno/b484bb2eaa586ff34d26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
READHOST=*** | |
READUSER=*** | |
READPASSWORD=*** | |
WRITEHOST=*** | |
WRITEPASSWORD=*** | |
WRITEUSER=*** | |
## vars need integration in commands with ex: host=$READHOST | |
ogr2ogr --config PG_USE_COPY YES -f GeoJSON testsql.geojson PG:'host=localhost dbname=alexanno user=alexanno' -progress -sql "SELECT * FROM sandbox.kommuner" -lco COORDINATE_PRECISION=5 | |
ogr2ogr --config PG_USE_COPY YES -f PGDump public.sql PG:'dbname=alexanno schemas=sandbox' | |
ogr2ogr --config PG_USE_COPY YES -f PGDump public.sql PG:'dbname=alexanno tables=dok.view_miljodir_kartlagtfriluft_kartlagtfriluft_kartlfriomr,dok.view_svv_fartsgrenser_fartsgrense5_tema1,dok.view_sk_kommunernorge_kommunernorge_fylke,dok.view_sk_kommunernorge_kommunernorge_kommune' -progress | |
ogr2ogr --config PG_USE_COPY YES -f PGDump public.sql PG:'host=192.168.4.*** dbname=datavarehus user=XXXX password=YYYY tables=dok.view_miljodir_kartlagtfriluft_kartlagtfriluft_kartlfriomr' -progress | |
ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:'host=178.62.116.*** dbname=demo user=XXXX password=YYYY' -nln test.md_friluftom PG:'host=192.168.*.*** dbname=datavarehus user=dokuser password=**** tables=dok.view_miljodir_kartlagtfriluft_kartlagtfriluft_kartlfriomr' -progress | |
ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:'host=178.62.116.*** dbname=demo user=XXXX password=YYYY active_schema=test' -lco SCHEMA=test PG:'host=192.168.*.*** dbname=datavarehus user=**** password=**** active_schema=dok tables=dok.view_miljodir_kartlagtfriluft_kartlagtfriluft_kartlfriomr,dok.view_svv_fartsgrenser_fartsgrense5_tema1,dok.view_sk_kommunernorge_kommunernorge_fylke,dok.view_sk_kommunernorge_kommunernorge_kommune' -progress | |
#faster | |
ogr2ogr --config PG_USE_COPY YES --config PG_USE_BASE64 YES -overwrite -f PostgreSQL PG:'host=178.62.116.*** dbname=demo user=XXXX password=YYYY active_schema=test' -lco SCHEMA=test PG:'host=192.168.*.*** dbname=datavarehus user=**** password=**** active_schema=dok tables=dok.view_miljodir_kartlagtfriluft_kartlagtfriluft_kartlfriomr,dok.view_svv_fartsgrenser_fartsgrense5_tema1,dok.view_sk_kommunernorge_kommunernorge_fylke,dok.view_sk_kommunernorge_kommunernorge_kommune' -progress | |
#SOSI stedsnavn | |
ogr2ogr --config PG_USE_COPY YES --config PG_USE_BASE64 YES -f PostgreSQL PG:'host=178.62.116.104 dbname=demo user=norkart password=18Harer active_schema=test' -lco SCHEMA=test -nln stedsnavn -append Stedsnavn_10_Vest-Agder_UTM33_SOSI.sos | |
ogr2ogr -progress -f "GeoJSON" stedsnavn_langs_linje.geojson PG:'host=localhost dbname=alexanno user=alexanno' | |
-sql "select * from sandbox.stedsnavn_norge where st_dwithin(wkb_geometry, st_transform(st_geomfromtext('LINESTRING (10.51477875680084 61.080654345745948,10.128907003984329 61.534214708112188,9.570058258525934 61.682895851751098,9.177533544453965 61.978122747286619,9.124309854410308 62.1028914424965,9.59667010354776 62.205440779042526,9.643240832335961 62.584619666868647,10.022459623897017 62.740436678485821,10.288578074115298 63.031522469300192,10.288578074115298 63.328691040994421,10.405004896085797 63.440460576457681)',4326),3045), 1000)" | |
#Export all tables in schema into sqlite-db | |
ogr2ogr -f SQLite postgis_schema.sqlite PG:'host=localhost dbname=alexanno user=postgres active_schema=skjema schemas=skjema' -progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use -append and/or -update to merge layers like state-separated tables/views into a single table.