Hi All,
I want to import shapefile to PostGIS, but the shapefile have many columns and
I want to import only column geom.
The code below makes the importation of all columns of the Shapefile, how do
you import only the geom column?
Map params = new HashMap();
params.put("dbtype", "postgis"); //must be
postgis
params.put("host", ConstantesMd.BD_HOST); //the name
or ip address of the machine running PostGIS
params.put("port", new Integer(5432)); //the port that
PostGIS is running on (generally 5432)
params.put("database", ConstantesMd.BD_NOME); //the name of
the database to connect to.
params.put("user", ConstantesMd.BD_USUARIO); //the user
to connect with
params.put("passwd", ConstantesMd.BD_SENHA);
params.put("schema", lNomSchema);
PostgisDataStore pgDatastore =
(PostgisDataStore)DataStoreFinder.getDataStore(params);
PostgisFeatureStore fsBC =
(PostgisFeatureStore)pgDatastore.getFeatureSource(lNomTabela);
Feature[] ftc = new Feature[1];
for (FeatureIterator it=source.getFeatures().features();
it.hasNext(); ) {
try {
ftc[0] = (Feature)it.next();
FeatureReader feature = DataUtilities.reader(ftc);
fsBC.addFeatures(feature);
lIntLinhasImportadas++;
System.out.println("Linha: " + lIntLinhasImportadas);
} catch (Exception e) {
e.printStackTrace();
System.out.println( e.getMessage() );
}
lIntTotalLinhas++;
}
Best Regards,
Fernando Quadro
GeoServer-BR
http://www.fernandoquadro.com.br
twitter.com/fernandoquadro
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users