Hello, I'm trying to make an application which will do the synchronisation between a postGIS data base and shape files. So I have to create a new table in the database with the same name of the shape files and columns matching with the schema of data in shape files (this part already works), and then load data from the shape file into my new table. I think DataStore could allow me to do this, but I still have this error since several days, that blocks me. Here is my code again :
FeatureCollection collection = fsShape.collection(); PostgisDataStoreFactory factory = new PostgisDataStoreFactory(); PostgisDataStore dataStore = (PostgisDataStore) factory.createDataStore(connec); FeatureStore featureStore = (FeatureStore)dataStore.getFeatureSource(tableName); FeatureReader reader = DataUtilities.reader(collection); featureStore.addFeatures(reader); // Exception here (AM_HYDRO_LIN_polyline is the name of my table and my shape file) org.geotools.data.DataSourceException: Could not create AM_HYDRO_LIN_polyline out of provided feature: AM_HYDRO_LIN_polyline.1 at org.geotools.data.jdbc.JDBCFeatureStore.addFeatures(JDBCFeatureStore.java:331) at Synchro.AlgoSynchro.fillTable(AlgoSynchro.java:206) at Synchro.AlgoSynchro.searchLakingTables(AlgoSynchro.java:112) at Synchro.AlgoSynchro.<init>(AlgoSynchro.java:94) at Synchro.SynchroGIS.<init>(SynchroGIS.java:109) at Synchro.SynchroGIS.main(SynchroGIS.java:239) Caused by: IllegalAttribute: null , but got null at org.geotools.feature.DefaultFeature.setAttributes(DefaultFeature.java:251) at org.geotools.data.jdbc.JDBCFeatureStore.addFeatures(JDBCFeatureStore.java:329) ... 5 more I have previously an error with the schema of tables in my postGID database, so I have placed the column containing the geometry in first position for each tables in my data base, to match with the structure of data in shape files. Is there any other method I could use to do this, or could anybody help me to find the problem in my code ? I really need explanations on what I'm doing wrong in my code to progress in my application. I'm using Geotools2.3 (from the trunk version of this morning), compiled with Maven 2.0.2 on a linux station (and of course jdk1.5). I'm using Eclipse... Cédric ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
