On 11 October 2015 at 21:03, Chris Schaffer <[email protected]> wrote: > Hello, > > I would like to georeference a raster using PyQGIS. If I want to > georeference a raster manually (loaded from an ascii file), I can use the > Georeferencer plugin, but I don't see a way to access this core C++ plugin > using PyQGIS. > > When I tried using GDAL to georeference a raster, using the script created > by selecting "Generate GDAL Script" in the Georeferencer, the raster was > incorrectly georeferenced when I loaded it in QGIS. It looks like there may > be differences between how GDAL and QGIS handle the georeferencing offsets. > > Do you have any advice for georeferencing a raster using PyQGIS, using the > Georeferencer or otherwise? I'm using QGIS 2.4. > > Thanks! > > Chris
You can't access the georeferencer from pyQGIS as it is a plugin itself. You can find the plugin code at [1]. I would like to see it all tidied up and exposed as public api, especially seeing as the Helmert 2-point transform is not available in GDAL but is only implemented in QGIS itself. I did write my own georeferencer for our specialised purposes [2] seeing as the QGIS gui is rather poor (45 clicks to 3-point georef versus 5 in mine). There are Python bindings to gdal that you could use instead [3], but I found it just easier to call the binaries directly. John. [1] https://github.com/qgis/QGIS/tree/master/src/plugins/georeferencer [2] https://github.com/jlayt/ArkPlan/tree/master/georef [3] https://pypi.python.org/pypi/GDAL/ _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
