[Qgis-developer] request for review: Add possibility to ignore geotransform/gcps in QgsRasterLayer

Manuel Massing m.massing at warped-space.de
Fri May 7 11:05:06 EDT 2010


Hi Pete,

> At first read through I am not sure this is the right approach. If I am
> imagining the problem correctly, you basically need to convert from map
> coordinates back to pixel coordinates. I think it would be better to add
> that functionality rather than forcing the layer to ignore it's
> geotransform.

The problem is that a lot of code in the georeferencer expects coordinates to
be expressed in pixel coordinates. This includes GCP point rendering (as
canvas items), coordinate picking (e.g., when adding a GCP), visualisation of 
residuals, and also the geotransform classes. Adding transforms in all these 
cases would IMO add an undue amount of complexity to what essentially is a 
corner case for georeferencing.

So, I do agree that its not really pleasing (more in an aesthetic sense :-)) 
to support such a limited use-case in a core class - that being said, it 
doesn't really add complexity to the QgsRasterLayer logic, so I thought it was
a good compromise.

> If you can point me to the lines in the georeferencer code, I can try to
> take a look and see if there is an alternative option for modifying
> qgsrasterlayer.

Hmm, from the top of my head I'd think this would affect different parts of
the code, for example the addition of canvas items 
(qgsgeorefdatapoint.cpp:33),  adding points QgsGeorefPluginGui::addPoint
(qgsgeorefplugingui.cpp:434), etc. would need to be adapted to support
different coordinate frames, as would the qgsgeotransforms, GCP list loading /
saving etc., but I admit I haven't really looked into solving it from this
angle so maybe there is a simpler solution.

As a way to reproduce some of the problems: open an unreferenced raster,
add GCPs, then create a world file. If the (now georeferenced) raster
is reopened, raster and GCPs etc. are expressed in different coordinate 
frames.

thanks for your input,

  Manuel


More information about the Qgis-developer mailing list