반응형
gdal을 활용해서 shapefile을 postgresql,mysql 테이블로 변환한 적이 있다.
이번 포스팅에서는 변환된 테이블을 export를 해볼려고 한다.
보통 qgis에서 export 해보면 shape,geojson,gml,csv 등 여러 포맷으로 내보낼 수 있다.
그중에서 geojson과 gml만 해보도록 하겠다.
# ogr2ogr -f 'GeoJSON' export.json PG:'host={호스트} dbname={데이터베이스명} user={유저명}' {스키마}.{테이블명}
만약 특정 필드만 조회해서 export 하고 싶다면
# ogr2ogr -f GeoJSON export.json PG:'host={호스트} dbname={데이터베이스명} user={유저명}' -sql select 필드1,필드2..필드5 from {스키마}.{테이블명}
이번에는 gml을 확인해보면 아래와 같다.
# ogr2ogr -f GML export.gml PG:'host={호스트} dbname={데이터베이스명} user={유저명}' {스키마}.{테이블명}
자세한 내용 아래 링크를 참조하면 된다.
https://gdal.org/drivers/vector/index.html
Vector drivers — GDAL documentation
gdal.org
반응형
'GDAL' 카테고리의 다른 글
gdal shape 파일을 mysql(mariadb) 테이블로 변환 (0) | 2021.04.28 |
---|---|
gdal shpaefile to database convert(postgis) (0) | 2021.04.15 |