After starting to use MOBAC to create offline background maps I found the aux.xml files very useful as QGIS automatically sets the CRS so this would be useful for my colleagues with smaller GIS knowledge.

Is it possible to generate such file for particular projection using WKT or .prj file? I am able to get both from spatialreference.org

Sample file from MOBAC for EPSG:3395 is here:


I use mostly only few CRS - epsg:4326, 32633, 900913, 3395 - so I could always create a copy of current *.aux.xml and rename it to fit the raster dataset name.

1 Answer 1


This was a proposed feature for QGIS which seems to have slipped down the priorities of the developers for the time being. However the feature request page outlines the syntax of the aux.xml file so it should be possible to write a simple python script to get all of the required parameters from the raster file and SpatialReference.org and write them to an xml file with the required filename.

XML parsing is a massive pain and generally it is best to use a pre-written parser such as beautifulsoup, however since this will write the same file structure every time it should be possible to manage in pure python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.