[Qgis-user] coordinate system of a raster layer

Stefanie Tellex stefie10 at media.mit.edu
Mon Mar 2 05:00:53 PST 2009


Hi Peter,

I am trying to define a coordinate system.  I have an image that is just 
an image, with no intrinsic coordinate system.  Then I have regions of 
the image encoded as polygons in a vector layer in pixel space.  (0,0 is 
the upper left hand corner of the image, 960,960 is the lower right hand 
corner.)  I want to see the polygons overlayed on the image in QGIS, and 
draw new polygons to indicate new regions in the image.

As a hack, I added this method to QgsRasterLayer that sets 
mGeoTransform, and call it after loading the raster layer.  That works 
to move the raster layer around to align with the vector layer>. (The 
full patch is attached.)

+   void setGeoTransform(QList<double> transform) {
+      for (int i = 0; i < 6; i++) {
+	mGeoTransform[i] = transform[i];
+      }
+      closeDataset();
+      readFile( source() );
+    }

That works to align the image with the vector layer, but now I noticed 
that the vector layer is flipped about the Y axis.  I could probably use 
setGeoTransform to flip the raster layer so they align, but then the 
image would be upsidedown.  What I really want to do is tell the 
QgsVectorLayer to use a coordinate system that is reflected across the 
Y-axis.

Thanks!

Stefanie

Peter Ersts pisze:
> Hi Stefanie,
> 
> Are you just trying to define a coordinate system or are you trying to 
> change one? It kind of sounds like you are actually trying to reproject 
> your raster layer on the fly which is not currently supported.
> 
> Right now QGIS is heavily reliant on GDAL for most of the raster 
> capabilities and all of the functionality in QgsRasterLayer except the 
> pyramid building is read only.
> 
> -pete
> 
> Stefanie Tellex wrote:
>> Hi,
>>
>> I want to change the coordinate system of a raster layer, to control 
>> where it is rendered relative to a vector layer.
>>
>> I'm constructing a raster layer (from python) like this:
>> rasterLayer = QgsRasterLayer("resources/21.kitchen.png")
>>
>> It displays, it looks like at the right scale, but at the wrong place.
>>
>> It looks like I want to set mGeoTransform in QgsRasterLayer but I 
>> don't see a setter for it.  Should I submit a patch to add one or is 
>> there some other way?
>>
>> Thanks!
>>
>> Stefanie
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> 
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: raster-layer-coordinatesystem
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20090302/f5166351/attachment.ksh>


More information about the Qgis-user mailing list