I have a shapefile of an Ordnance Survey Mastermap ITN road network that I am trying to load into an agent-based modelling software called Mason. When I try to run my model I get the following error:

Exception in thread "main" java.lang.IllegalArgumentException: shpFile is null; likely file not found

My model works fine with every other road network (OS Mastermap Meridian 2, Boundary-Line etc.) I can throw at it and can display other shapefiles I'm using. All the shapefiles show up in QGIS just fine.

The OS ITN data was downloaded as a compressed .gz file, with two GML files within. These were were then converted to .MIF/.MID using OSM2MIF. These were then loaded into QGIS and saved as .SHP (right click>Save As...>ESRI Shapefile).

In QGIS and ArcMap the resultant shapefile of the road network looks as expected and all the metadata is present. However, when I try to load it using my Mason model, it fails. It seems to only fail using this shapefile so I know it's not my model and is thus a problem with the shapefile.

Have I done something wrong during the conversion? Does anyone know how best to use Ordnance Survey Mastermap ITN and convert to usable shapefiles?

  • "Shapefile" is a misnomer, because it's actually 3-5 (and sometimes quite a few more) files. Your error message states that one or more are missing, so you should be certain that you have at least .shx, .dbf, and .prj with the same prefix as the .shp. – Vince Dec 3 '15 at 1:08
  • @Vince this is unlikely, because it is visible in ArcMap. I think it's good idea to export it to a new one: short name, z and m disabled – FelixIP Dec 3 '15 at 5:14
  • It's unclear from the question if the shapefile is being used in situ or bundled in some fashion for this modelling tool. – Vince Dec 3 '15 at 5:31
  • @Vince Yes, I have a .shx, .shp, dbf, .prj, qpj and a .cpg. The files are being used in situ, with the code referencing the files where they are: 'URL roadGeometry=NorfolkCSV.class.getResource("/Users/User/Downloads/ITN_1.shp"); ShapeFileImporter.read(roadGeometry, roads);' – KJGarbutt Dec 3 '15 at 8:22
  • @FelixIP, z and m disabled? – KJGarbutt Dec 3 '15 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.