Subscribe to this thread
Home - General / All posts - Shapefile from M9 won't import into M8 (workaround found)
steveFitz

287 post(s)
#14-Feb-21 23:14

This may be a known issue or limitation.

I'm working quite a lot between M9 and M8 these days.

This morning I exported a very simple Drawing from M9: right click on Drawing file (not table but actual drawing in Project Pane) > Export > (choose folder where I have full read/write permissions) > click Export button.

I then attempted to import the M9 exported shapefile into M8: File > Import > Drawing > (choose folder where I have full read/write permissions)> Open = dialog box "File data appears to be corrupted. If you downloaded this file from the Internet, try downloading it again". > click OK in dialog. I then get the usual Import SHP File dialog but with no fields listed. I click OK and the geometry (the Drawing) imports but no fields (mf_id, Geom - both fields created by M9 when I created the drawing).

I understand that Geom should not import as a field in a shapefile.

I double checked the coordinate system and it was good (I tried 'Repair Initial Coordinate System' to the same coordinate system - not a different one) but that made no difference. After playing around with the export/import process I found that I needed to add at least one other field into the Drawing's Table before exporting it. If I did so then it imported into M8 with no issue.

I tried opening the dbf file part of the recalcitrant shapefile with DBF Viewer & Editor but it wouldn't open and warned me of an "Invalid header".

This is just a heads up to anyone that comes across the same issue.

Sample shapefile zipped and attached if anyone wants to check themselves.

Attachments:
SampleShp.zip

Dimitri


6,436 post(s)
#15-Feb-21 05:11

There's no such limitation known. People have written zillions of shapefiles with 9. If something on the computer is causing a corrupted file, that's not 9. If you have a corrupted file, it's not likely to import anywhere.

Do you have the original 9 project from which you exported the shapefile? That would let people export the shapefile and see if it exports OK.

tjhb

9,550 post(s)
#15-Feb-21 06:38

Well, there is a known limitation.

Manifold 8 expects shapefiles (or their DBF files) to have some other field besides geometry.

If there is only geometry, and no other field, Manifold 8 throws the error dialog reported by steveFitz.

However, usually it is easy to dismiss the dialog and import regardless.

(When you have a lot of shapefiles like this to import, you get a sore wrist.)

steveFitz

287 post(s)
#15-Feb-21 07:27

Dimitri,

Before I send the M9 project could you please test yourself and let me know how it goes?

By the way of test I mean create a simple file in M9 with no additional fields apart from what the program provides, export it and then import it into 8.

If it works fine then I'll gladly send the *.map file (with apologies!).

... it's not likely to import anywhere

I did try it with QGIS and it imported fine (no fields). I do wonder if this is QGIS overlooking stuff it probably shouldn't seeing as my DBF reader reported the shape dbf header had problems.

tjhb, thanks for confirming my diagnosis. I don't have any issue with clicking on dialogs while I know the work around. I only report this because I now I'll forget again in a few months time and spend time again wondering and investigating (In fact I'm sure I have actually been through this all before!). I think it would also be great to iron out little bugs like this anyway but as M8 is no longer being developed (?) I guess this won't happen.

tjhb

9,550 post(s)
#15-Feb-21 07:41

I suspect that Manifold 8 is following ESRI or DBF technical specifications to the letter, and nobody else cares.

steveFitz

287 post(s)
#15-Feb-21 08:15

Yes, indeed. Just to satisfy my nerdy interest and since work is over for the day:

From ESRI Shapefile Technical Description:

The dBASE file (.dbf) contains any desired feature attributes or attribute keys to which other tables can be joined. Its format is a standard DBF file used by many table-based applications in Windows™ and DOS. Any set of fields can be present in the table. There are three requirements, as follows:

  • The file name must have the same prefix as the shape and index file.
  • Its suffix must be .dbf. (See the example on page 2, in Naming Conventions.)
  • The table must contain one record per shape feature.
  • The record order must be the same as the order of shape features in the main (*.shp) file.
  • The year value in the dBASE header must be the year since 1900.

Dimitri


6,436 post(s)
#15-Feb-21 09:20

Ah, I see. I misunderstood. When I read

I click OK and the geometry (the Drawing) imports but no fields

I read that as though you did have some fields in the drawing but they did not import.

If you don't have any fields in the drawing (other than the geom or mfd_id) then you end up with a DBF that has no attribute fields, and that's not a shapefile as the ESRI standard is written, with the resulting import message as Tim has noted.

8 is applying the shapefile standard as it is written. If a DBF doesn't have any fields to it, it's not a shapefile. If you tell 8 it is a shapefile, but when 8 looks and sees that it is not a shapefile, it advises you that it is corrupted, but then goes ahead and does its best to import it anyway, importing it fine with no fields. You can even delete the DBF entirely and 8 will still import the shapefile.

This is one of those cases where whichever way you second-guess erroneous use of a standard, you're going to get it wrong for some people. For example, 9 could advise people that a drawing with no attributes can't be exported to shapefile format as a legal shapefile. That would drive people nuts, so instead 9 exports it as a "shapefile" that isn't strictly standard but which everybody can use.

Another way for 9 to do this would be to automatically add a field if there aren't any, like an ID field. That, too, would be annoying to some people who don't want their software adding a field, just to make software happy that applies standards as they are written. Maybe that could be an option, turned on by default.

steveFitz

287 post(s)
#16-Feb-21 04:13

I guess it is unusual to export a shapefile with no (additional) fields but when you do I don't mind the way 8 handles it.

Attachments:
Manifold 8 dialog.png

Manifold User Community Use Agreement Copyright (C) 2007-2019 Manifold Software Limited. All rights reserved.