Version 1 (modified by dac, 8 years ago) (diff)

Added page with assign_projection script documentation

Q: I get the error "Unknown map projection: You will have to fill in the projection name and datum in the map info in the .hdr file yourself." when defining a projection using Proj4, what should I do?

This error is produced when using a projection defined using a Proj4 string that is not OSGB36 NG or UTM and APL doesn't know how to add it to the header file correctly.

We've written a script which will add the projection information from a Proj4 string or WKT file ( which is available on GitHub (

If you copy the script to the same directory as your mapped files, open a command window and navigate to that directory you should be able to assign the correct projection to all your files using:

python --proj4 "+proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +units=m +no_defs" *mapped*.bil

or if you have a WKT file you can use:

python --wkt ogcwkt.wkt *mapped*.bil

Note the use of wild characters '*' to assign the projection to multiple files at once.

The tool requires GDAL to run, under Windows if you have QGIS or GRASS installed through OSGeo4W you need to run the tool from the OSGeo4W shell. Another option for installing the GDAL Python bindings is to install miniconda and get GDAL through this using:

conda install gdal

If you're running OS X, GDAL is also available through conda. For Linux it is available through the package manager.