| 1 | === 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? === |
| 2 | |
| 3 | '''A:'''[[BR]] |
| 4 | 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. |
| 5 | |
| 6 | We've written a script which will add the projection information from a Proj4 string or WKT file (assign_projection.py) which is available on GitHub ([https://github.com/pmlrsg/arsf_tools/ https://github.com/pmlrsg/arsf_tools/]). |
| 7 | |
| 8 | 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: |
| 9 | {{{ |
| 10 | python assign_projection.py --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 |
| 11 | }}} |
| 12 | |
| 13 | or if you have a WKT file you can use: |
| 14 | {{{ |
| 15 | python assign_projection.py --wkt ogcwkt.wkt *mapped*.bil |
| 16 | }}} |
| 17 | |
| 18 | Note the use of wild characters '*' to assign the projection to multiple files at once. |
| 19 | |
| 20 | 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 [http://conda.pydata.org/miniconda.html miniconda] and get GDAL through this using: |
| 21 | |
| 22 | {{{ |
| 23 | conda install gdal |
| 24 | }}} |
| 25 | |
| 26 | If you're running OS X, GDAL is also available through conda. For Linux it is available through the package manager. |