One Star

Error importing shepafile to postgis

François,
Following this issue, I upgrade to the new release of SDI (2.2.4). I add the tLogrow and add statistic to the log, here is the log:

Starting job test_shp2pgsql at 11:34 01/02/2008.
connecting to socket on port 3760
connected
Aucune autorité n'a été spécifiée pour le code "-1". Le format attendu est habituellement "AUTORITÉ:NOMBRE".
Table test_import was dropped
1 févr. 2008 11:34:15 org.geotools.data.postgis.PostgisDataStore createSchema
INFO: CREATE TABLE "public"."test_import" ("test_import_fid" serial PRIMARY KEY, "the_geom" GEOMETRY NOT NULL, "gid" INTEGER, "sous_zone_num" INTEGER, "sous_zone_nom" VARCHAR(10485760), "zone_nom" VARCHAR(10485760));
1 févr. 2008 11:34:15 org.geotools.data.postgis.PostgisDataStore createSchema
INFO: DELETE FROM GEOMETRY_COLUMNS WHERE f_table_catalog='' AND f_table_schema = 'public'AND f_table_name = 'test_import';
1 févr. 2008 11:34:15 org.geotools.data.postgis.PostgisDataStore createSchema
INFO: INSERT INTO GEOMETRY_COLUMNS VALUES ('','public','test_import','the_geom',2,-1,'MULTIPOLYGON');
1 févr. 2008 11:34:15 org.geotools.data.postgis.PostgisDataStore createSchema
INFO: ALTER TABLE "public"."test_import" ADD CONSTRAINT "enforce_dims_the_geom" CHECK (ndims("the_geom") = 2);
1 févr. 2008 11:34:15 org.geotools.data.postgis.PostgisDataStore createSchema
INFO: ALTER TABLE "public"."test_import" ADD CONSTRAINT "enforce_geotype_the_geom" CHECK (geometrytype("the_geom") = 'MULTIPOLYGON'::text OR "the_geom" IS NULL);
1 févr. 2008 11:34:15 org.geotools.data.postgis.PostgisDataStore createSchema
INFO: CREATE INDEX spatial_test_import_the_geom ON "public"."test_import" USING GIST ("the_geom");
gid sous_zone_num sous_zone_nom zone_nom the_geom
Source CRS is: EPSG:NTF (Paris) / Lambert zone II code: NTF (Paris) / Lambert zone II authority: European Petroleum Survey Group version: null
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
disconnected
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at test_yja_1.test_shp2pgsql.test_shp2pgsql.sShapefileInput_1_GIProcess(test_shp2pgsql.java:666)
at test_yja_1.test_shp2pgsql.test_shp2pgsql.runJob(test_shp2pgsql.java:1066)
at test_yja_1.test_shp2pgsql.test_shp2pgsql.main(test_shp2pgsql.java:993)
Job test_shp2pgsql ended at 11:34 01/02/2008.


The shapefile is a personnal file I create from postgisDB (quartier de la defense). Thanks,
Y.

13 REPLIES
One Star

Re: Error importing shepafile to postgis

Hi Yves,
You're probably trying to launch your job with java 1.5.
Try to use the java 6 version to run SDI (update-alternatives --config java) it will be better.
We will fix this problem soon to be compatible with java 1.5.
Cheers,
Mathieu
One Star

Re: Error importing shepafile to postgis

Hi Mathieu,
You are right Smiley Happy I am using java 1.5.
Y;
One Star

Re: Error importing shepafile to postgis

Ok I upgraded java to 1.6, I tested my test job and here are some small issues:
1- attribut data are not imported, I have no error message, do you have an idea?
2- if I use Long for my key field (gid field), the job failed:
Starting job test_shp2pgsql at 14:05 01/02/2008.
connecting to socket on port 3776
connected
disconnected
Exception in component sPostgisOutput_1_SO
java.io.IOException: Type 'class java.lang.Long' not supported!
at org.geotools.data.postgis.PostgisDataStore.makeSqlCreate(PostgisDataStore.java:1518)
at org.geotools.data.postgis.PostgisDataStore.createSchema(PostgisDataStore.java:1191)
at test_yja_1.test_shp2pgsql.test_shp2pgsql.sShapefileInput_1_GIProcess(test_shp2pgsql.java:453)
at test_yja_1.test_shp2pgsql.test_shp2pgsql.runJob(test_shp2pgsql.java:1066)
at test_yja_1.test_shp2pgsql.test_shp2pgsql.main(test_shp2pgsql.java:993)
Job test_shp2pgsql ended at 14:05 01/02/2008.

Any ideas? Smiley Happy
Y.
One Star Fxp
One Star

Re: Error importing shepafile to postgis

1- attribut data are not imported, I have no error message, do you have an idea?

Did you defined your schema in the output component ?
You should have at least a fid column and the_geom column.
Can you give us more details ?
2- if I use Long for my key field (gid field), the job failed:
Y.

This is a known bug in GeoTools :
http://jira.codehaus.org/browse/GEOT-1508
... so you need to wait for this to be solved. A workaround could be to use a tMap component to change datatype to long to something else ...
Ciao.
Francois
One Star

Re: Error importing shepafile to postgis

Hi François,
Thanks for your answer. For the second problem, I am testing the application so I can wait.
About the first issue, indeed I get two columns: the_geom and test_import_fid which they are correct.
I defined the output component clicking the "sync columns" button. I followed this tutorials wrote by Elem.
One Star

Re: Error importing shepafile to postgis

Hi,
Anybody have an idea about this issue?
Y.
One Star

Re: Error importing shepafile to postgis

Hi Yves,
Sorry but I'm not sure to understand what is the issue....
You've got two output columns which are the_geom and test_import_fid in your postgis output table called test_import I guess.
So what do you want to achive?
How much input columns do you have in your shape?
Do you want to import all of them in postgis?
If not, try to use a tMap between input and output component to define your mapping.
Maybe I'm wrong and I don't understant what you want to do...
Please be more precise about what you define in input/output, and what is the issue according to you.
Cheers,
Mathieu
One Star

Re: Error importing shepafile to postgis

Hi,
Indeed, mu shapfile contains three others columns:
* sous_zone_num (int)
* sous_zone_nom (string)
* zone_nom (string)
I would like to import them into my postgis table but following the tutorials, they are not imported. My fields are empty except for the the_geom and fid column.
Regards,
Y.
One Star

Re: Error importing shepafile to postgis

Yves,
If your three columns are defined in your output schema and created in your output table in postgis, I can only think that they are empty....
Try to put a tLogRow directly connect to your Shapefile Input.
This step will allow you to check whether your three columns are not empty.
Otherwise try to activate traces during the execution of your job, this will give you more details about what is "in the flow"!
Cheers,
Mathieu
One Star

Re: Error importing shepafile to postgis

Hi Mathieu,
The tLogRow show me that the flow does not contains my data (sorry I should to tell you this sooner):
||||MULTIPOLYGON (((593340.5687667294 2432365.6942605344, 593715.5793209289 2432205.9264504616, 593691.6765663981 2432149.00044449, 593643.8661426135 2432130.324497699, 593559.4508631186 2432101.190020705, 593504.1700606177 2432082.5140739144, 593482.5059623403 2432084.008149658, 593452.6244474748 2432086.9963011444, 593386.1380768993 2432121.3600432393, 593346.5450697027 2432141.5300657735, 593302.4698352762 2432149.00044449, 593295.7464944315 2432169.170467024, 593256.2468669687 2432154.8895111326, 593267.3418537793 2432181.517479478, 593265.1228564172 2432203.7074530995, 593340.5687667294 2432365.6942605344)))

Y.
One Star

Re: Error importing shepafile to postgis

Hi,

If tLogRow shows you that the flow doesn't contain your data, it means that you have an error in your ShapefileInput. Check your three column names in the schema, ShapefileInput Component is case sensitive.

Regards,
Barbara.
One Star

Re: Error importing shepafile to postgis

Oups :rolleyes:
You are right, I had not check my columns in the DBF file :/
Shame on me. I am going to test by myself before posting here Smiley Happy
Y.

I solved my problem, after checking my DBF file, and all the columns, I get an error with integer columns. The description of the file (showed in OOo calc) was : NUM,N,11,0 which is automaticly converted in "Long", as "Long" is not yes supported by SDI, I get an error.
Change this in "NUM,N,2,0" resolved the issue.
Thanks all for your help,
Y.
One Star

Re: Error importing shepafile to postgis

Hi ,
I am trying to import some data in Postgis and I get this error:
Exception in component sPostgisOutput_1_SO
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
at java.util.ArrayList.add(ArrayList.java:367)
at org.geotools.feature.DefaultFeatureTypeFactory.add(DefaultFeatureTypeFactory.java:43)
at org.geotools.feature.FeatureTypeBuilder.addType(FeatureTypeBuilder.java:392)
at createosmdata.create_polygon_data.create_polygon_data.tPostgresqlInput_1Process(create_polygon_data.java:455)
at createosmdata.create_polygon_data.create_polygon_data.runJobInTOS(create_polygon_data.java:1774)
at createosmdata.create_polygon_data.create_polygon_data.main(create_polygon_data.java:1690)
does anyone have a clue?