One Star

Error while converting SHP to MIF

I have not yet been able to do a simple conversion between GIS formats. This is the error I receive when I try to convert SHP to MIF:
Starting job SimpleTutorial at 23:19 20/11/2007.
20/11/2007 23:19:21 FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "MathTransformProvider". Cause is "NoClassDefFoundError: javax/media/jai/WarpAffine".
Exception in component sMapinfoOutput_1_SO
java.io.IOException: Can't write feature: java.io.IOException: Error writing MID file: null
at org.geotools.data.mif.MIFFile$Writer.write(MIFFile.java:1691)
at org.geotools.data.InProcessLockingManager$1.write(InProcessLockingManager.java:330)
at tutorial_1.simpletutorial.SimpleTutorial.sShapefileInput_1_GIProcess(SimpleTutorial.java:359)
at tutorial_1.simpletutorial.SimpleTutorial.runJob(SimpleTutorial.java:510)
at tutorial_1.simpletutorial.SimpleTutorial.main(SimpleTutorial.java:454)
Job SimpleTutorial ended at 23:19 20/11/2007.
Can anyone interpret this?
Thanks,
Simon

  • SDI
12 REPLIES
One Star Fxp
One Star

Re: Error while converting SHP to MIF

Hi Simon, it looks strange. Check that in the properties of the MIF/MID output component for the filename is ok.
"Error writing MID file: null" looks like filename is missing ?
HTH. Francois
One Star

Re: Error while converting SHP to MIF

Hi Francois,
The output is set to "C:/Program Files/SpatialDataIntegrator-All-r6584-V2.2.1/workspace/miftest.mif"
The following files actually get created when I run the process, but they are empty apart from the field headers:
miftest.mid
miftest.mid.out
miftest.mif
miftest.mif.out
Simon
One Star Fxp
One Star

Re: Error while converting SHP to MIF

Simon, I can't reproduce your problem. I have one other issu using the MapInfoOutput component.
The problem I have is:
Exception in component sMapinfoOutput_1_SO
java.io.IOException: Unable to create MIFFile object: Geometry must be the first attribute in schema.
at org.geotools.data.mif.MIFDataStore.createSchema(MIFDataStore.java:169)
at sdi.shp2mif.shp2mif.sShapefileInput_1_GIProcess(shp2mif.java:196)
at sdi.shp2mif.shp2mif.runJob(shp2mif.java:548)
at sdi.shp2mif.shp2mif.main(shp2mif.java:489)
A fix will be provided soon for that. Anyway a workaround is to add a tMap component to put the_geom object at the top of the output schema.
Concerning your issue, could you give us some more info about your job ? schema ? Could you try to only add the_geom element to the input/output schema ?
Francois
One Star

Re: Error while converting SHP to MIF

Hi Fancois,
Thanks for your help so far.
I added the_geom as a field of type 'object', removed all other fields, changed the output geometry type to multi-polygon, and ran it again. This time I managed to get a smaller error:
Starting job SimpleTutorial at 12:05 21/11/2007.
21/11/2007 12:05:42 FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "MathTransformProvider". Cause is "NoClassDefFoundError: javax/media/jai/WarpAffine".
Job SimpleTutorial ended at 12:05 21/11/2007.
The process created a MIF file that appeared to have data in it, however the corresponding MID file contained nothing but a bunch of end-of-line characters. MapInfo Professional encounters an error when attempting to import the MIF/MID. It says "Found while searching for ." I believe this is because it is expecting at least one attribute field.
If I attempt to add any fields in SDI other than the_geom and run it again, I get a bigger error message in SDI and the output MIF/MID files contain no data at all:
Starting job SimpleTutorial at 12:31 21/11/2007.
21/11/2007 12:31:27 FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "MathTransformProvider". Cause is "NoClassDefFoundError: javax/media/jai/WarpAffine".
Exception in component sMapinfoOutput_1_SO
java.io.IOException: Can't write feature: java.io.IOException: Error writing MID file: null
at org.geotools.data.mif.MIFFile$Writer.write(MIFFile.java:1691)
at org.geotools.data.InProcessLockingManager$1.write(InProcessLockingManager.java:330)
at tutorial_1.simpletutorial.SimpleTutorial.sShapefileInput_1_GIProcess(SimpleTutorial.java:370)
at tutorial_1.simpletutorial.SimpleTutorial.runJob(SimpleTutorial.java:521)
at tutorial_1.simpletutorial.SimpleTutorial.main(SimpleTutorial.java:465)
Job SimpleTutorial ended at 12:31 21/11/2007.

Simon
One Star Fxp
One Star

Re: Error while converting SHP to MIF

Can't really figure out where your problem is Smiley Sad.
Anyway, You should not have any warning : Can't load a service.
Do you get that message on all jobs ?
Could you try to convert from Shapefile to shapefile to test if this is a problem in the mapinfo output ?
If you run your job activating the traces and statistics, could you see if the problem happen on all rows or only for one in particular?
Ciao. Francois
One Star

Re: Error while converting SHP to MIF

Success! Here's how I finally worked out what was going on.
In 'Edit Schema', I made the field name match one of the fields in the source SHP file. I had wrongly assumed that because you had to manually tell it what the field names were, it didn't really matter what you called them. This appears to be what caused the "Can't write feature: java.io.IOException: Error writing MID file: null" error. (I can't wait until the automatic schema feature is implemented.)
And secondly, I changed the map projection of the source SHP file to Longitude/Latitude. My original SHP file was in Map Grid of Australia, but this appeared to be the cause of the "Can't load a service for category 'MathTransformProvider'" error.
I hope that these error messages can be made more useful to help tracking down problems.
Also, is there a list of map projections and/or datums that are supported by SDI?
Thanks to Francois for prodding me with ideas for the things I needed to test.
Cheers,
Simon
One Star Fxp
One Star

Re: Error while converting SHP to MIF

Simon, I have a fix for dealing with projected data.
In your installation, update the file located in TALEND dir plugins/org.talend.designer.components.localprovider_2.2.1.r6584/components/sGeoOutput/
by
https://project.camptocamp.com/svn/c2c_talendgeotools/branches/branch-2_2/sGeoOutput/sGeoOutput_java...
Then in lib/java add those jar files :
- https://project.camptocamp.com/svn/c2c_talendgeotools/branches/branch-2_2/lib/jai_codec.jar
- https://project.camptocamp.com/svn/c2c_talendgeotools/branches/branch-2_2/lib/jai_core.jar
- https://project.camptocamp.com/svn/c2c_talendgeotools/branches/branch-2_2/lib/mlibwrapper_jai.jar
and that works for me using French Lambert proj. Tests & feedbacks are welcome.
HTH. Francois
One Star

Re: Error while converting SHP to MIF

Thanks for posting these updated XML and JAR files, Fancois. I ran SDI with the new files installed, and it appears to run okay, but the resulting MIF file doesn't contain any projection information.
MapInfo Professional seems to import the MIF file but can't display it properly. I assume this is because it thinks that the coordinates must be Long/Lat.
TatukGIS Viewer encounters the following error when trying to open it: "File cannot be opened. 0090 File structure error in file "C:\Data\out.mid" as line 1"
This is what a MIF file header looks like when generated by MapInfo Professional:
Version 600
Charset "WindowsLatin1"
Delimiter ","
CoordSys Earth Projection 8, 116, "m", 147, 0, 0.9996, 500000, 10000000 Bounds (-500000, 5000000) (1500000, 7000000)
Columns 1
LGA_NAME Char(45)
This is what the SDI output file looks like:
version 300
charset "WindowsLatin1"
delimiter " "
Columns 1
LGA_NAME Char(2147483647)
Cheers,
Simon
One Star Fxp
One Star

Re: Error while converting SHP to MIF

Hi Simon, you should try the new release 1.1.
Mathieu added support for projection system in the GeoTools used in SDI (cf thread
http://www.nabble.com/CoordSys-clause-parsing-support-in-MIF-plugin-td14803238.html)
So now, in the output sMapinfoOutput, you could force the output coordinate system using an EPSG code. If this epsg code is available in the mapinfo projection code file mapping, you should be able to have well projected MIF output.
Keep us uptodate.
Ciao. Francois
One Star

Re: Error while converting SHP to MIF

Hello,
I got this problem with the 2.2.1 release of SpatialDataIntegrator. I would like to test the tutorial shate to postgis and I get the same "MathTransformProvider'" error.
My shapefile is in lambert 2 etendue. Do I need to update something? Note that my update feature in the Help menu does not find the tallend website.
Thanks in advance.
Yves Jacolin
One Star Fxp
One Star

Re: Error while converting SHP to MIF

Bonjour Yves, I'm using the Shapefile stationlIIe.shp (provided in the demo data package) and could make a shape to postgis with no problem.
Which data are you using ?
Could you try to connect your sShapefileInput to a simple tLogRow to check that you could read your shape properly ?
Could you turn on statistic to see if it fails at first geometry or during the process ?
Could you post all the console log ? - that could help.
Ciao. Francois
One Star

Re: Error while converting SHP to MIF

François,
I open a new thread as I upgrade to SDI 2.2.4.
Y.