Created
March 4, 2018 05:42
-
-
Save joakimsk/48dcde9ba0ecaed71cbcdbd010efc7c3 to your computer and use it in GitHub Desktop.
Find all dxf recursively and upload to database
This file contains hidden or 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
#!/bin/bash | |
# Find all dxf recursively and upload to Postgresql+Postgis database, using ogr2ogr | |
find . -iname "*.dxf" -print0 | xargs -0 -I {} ogr2ogr --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE --config CPL_DEBUG ON -f "PostgreSQL" PG:"dbname=mapDatabase user=postgres" "{}" -s_srs "+proj=sterea +lat_0=34.2 +lon_0=39.15 +x_0=28 +y_0=-42 +a=6378249.2 +b=6356515 +units=m +no_defs" -t_srs EPSG:4326 -a_srs EPSG:4326 -dim XY -dialect SQLITE -sql "SELECT e.layer, e.text, e.geometry FROM entities e WHERE ST_GeometryType(e.geometry) IN ('POINT', 'POINT Z', 'LINESTRING', 'LINESTRING Z', 'MULTILINESTRING', 'MULTILINESTRING Z', 'POLYGON', 'POLYGON Z', 'MULTIPOLYGON', 'MULTIPOLYGON Z');" -nln 'entities' -append |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment