문제

How can I import gis shapefiles into postgis database programatically using java ? I used a program named postgis shapefile import but now I want to do it in my java code.

도움이 되었습니까?

해결책

The most common tool (one of several) is shp2pgsql, which comes with PostGIS. It is normally used from a command prompt, but can be used through Java's ProcessBuilder.

ProcessBuilder pb =
   new ProcessBuilder("/bin/sh", "-c", "shp2pgsql my.shp | psql -d mydb");
Process p = pb.start();

ogr2ogr is another commonly used tool to convert most geospatial vector formats to PostGIS.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top