The Query data structure lets you ask for what columns to retrieve; just indicate only the geometry column and you will get only the geometry column. - http://docs.codehaus.org/display/GEOTDOC/06+FeatureSource#06FeatureSource-FeatureAccessusingQuery
The example on that pages shows how to get only the columns "the_geom" and "name"; you can modify this to get only "the_geom". If you need to figure out the name of your geometry column you can ask your feature type for the default geometry. Jody On Wed, May 13, 2009 at 5:00 AM, Fernando Quadro <[email protected]> wrote: > 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 > ------------------------------------------------------------------------------ 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
