andyuk ha scritto: > Hi, > > Is it currently possible to create a PostGIS table based on shapefile > and then copy the features to the table? > I know the shp2pgsql tool will do this, but it's not really suitable for > use in web applications. I can already copy the features, but creating > the table is the tricky bit. > > I've found quite a few emails on this list with people trying to do the > same thing. I don't want to code all of this if it has already been done > before. Can anyone offer any code or suggestions?
Well, with geotools you can use the shapefile datastore to read the shapefile, and the postgis datastore to both create the table and copy the contents. The tricky part is that DataStore.createSchema() is not that well tested, so you may stumble upon bugs (such as certain data types not being supported or buggy). Patches for these cases graciously accepted :) Cheers Andrea ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
