On Tue, Jul 29, 2008 at 11:40 PM, Jody Garnett <[EMAIL PROTECTED]> wrote: > Wouter Schaubroeck wrote: >> >> Hey list, >> >> I'm building an application that reads the geometries in a shapefile, and >> writes them into postgis. >> > > Okay. >> >> To implement this, i've created my own featurereader (because i need >> create a Feature), and use this to insert the features in the postgis db. >> This is my code: >> >> PostgisFeatureStore pgFS = (PostgisFeatureStore) >> fsDao.getFeatureStore(uploadUtil.detectPostGisLayerName(file)); >> CustomShapeFileReader shpReader = new CustomShapeFileReader(shapefile, >> pgFS.getSchema()); >> shpReader.setParameters(kvp); >> shpReader.execute(); >> >> pgFS.addFeatures(shpReader); >> >> On this last line, the application throws the following error: >> >> java.lang.NoSuchFieldError: FEATURE_2D >> at >> org.geotools.data.postgis.PostgisDataStore.getGeometryAttributeIO(PostgisDataStore.java:1835) >> at org.geotools.data.jdbc.QueryData.<init>(QueryData.java:134) >> at >> org.geotools.data.jdbc.JDBC1DataStore.executeQuery(JDBC1DataStore.java:907) >> at >> org.geotools.data.jdbc.JDBC1DataStore.getFeatureWriter(JDBC1DataStore.java:1553) >> at >> org.geotools.data.postgis.PostgisDataStore.getFeatureWriterAppend(PostgisDataStore.java:1809) >> at >> org.geotools.data.jdbc.JDBCFeatureStore.addFeatures(JDBCFeatureStore.java:307) >> at >> be.geosolutions.main.Shape2PostGis.execute(Shape2PostGis.java:50) >> > > Hints.FEATURE_2D is all about choosing what way to encode your geometry when > it is inserted into PostGIS. We mostly thought about it > when using getFeatures( Query ); and not about when the data is added... > > I am actually pretty sure that we cannot use a Hint here; we need you to > provide the data with the number of dimensions indicated by your SRID?
The postgis table has this SRID: 4326, the shapefile hase the same srid, it just doesn't say this literally in the .prj - file: I can't look it up for now, but it was something like GCS_WGS_1984, with the projectionparameters next to it... Are you suggesting to specifically set the srid of the shapefile? >> >> I know it has something to do with Hints.FEATURE_2D, but i don't know >> what, i don't know when or where i have to specify this hint... >> >> Some background info: i'm using gt2.4.4. The postgis geom attribute is >> defined in 2D, the shape can be 2D, or 3D, but the z-coordinate is >> being ignored... >> >> What am i doing wrong? >> >> thx! Wouter Schaubroeck >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Geotools-gt2-users mailing list >> Geotools-gt2-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users