Magic Number mismatch reported while importing shapefile

Question: I have just tried to import a shapefile and got the message 'magic number mismatch'.  How do I solve the issue and import the file? 

Wow. We don't see that very often, as it's usually a sign of a corrupted shape file or a compressed file that hasn't been named correctly.  Occasionally, when downloading from a web site, files will arrive with no extension.   If you rename a file like this to be a .shp file and it results in the 'magic number mismatch' error, it is most likely that the downloaded file was some kind of archive file, most likely a ZIP file, but missing the .zip extension.    

A common way to resolve this is to change the file name and extract the original shapefile data:

  1. In the Finder select the file and change the name end in ".zip"
  2. You will be prompted with whether to add the extension or not, which you should answer to Add the extension
  3. Once that's done, double-click on the file and it should extract the files into a new directory
In the end, you should have a new directory containing a set of shapefiles (.shp, .shx, .prj, .dbf, etc) which can then be loaded into Cartographica.

A little more detail

In short, the 'magic number mismatch' error means that the file is missing a key binary sequence at the beginning of the file that is supposed to verify that the shapefile is indeed a shapefile and not just another file that happens to be named ending in .shp. 

Have more questions? Submit a request


Powered by Zendesk