[Qgis-developer] Details of rendering GIS map data in QGis

Marco Hugentobler marco.hugentobler at sourcepole.ch
Fri Sep 30 13:52:52 EDT 2011


> Is this everything that QGis does to transform a POINT(long, lat) to a
> Pixel- Point(x, y)? Because this is kind of what my naive approach (or
> what I thought it was) looked like, i.e., scaling factor plus correction
> of the counting direction.

Well, in case you apply on-the-fly reprojection (e.g. long / lat to meter 
system), a coordinate transformation is applied before the pixel 
transformation (done in class QgsCoordinateTransform).


Regards,
Marco

Am Freitag, 30. September 2011, 17.45:30 schrieb Eric MSP Veith:
> Hello Marco,
> 
> thank you for your friendly and helpful reply!
> 
> On Friday 30 September 2011, 17:02:22, Marco Hugentobler
> 
> <marco.hugentobler at sourcepole.ch> wrote:
> > The class QgsMapToPixel  (src/core/qgsmaptopixel.cpp/.h) contains the
> > transformation from map to pixel coordinates. Is this what you are
> > looking for?
> 
> I'm 98% positive that yes, this is what I was looking for. One last
> confirmation, through:
> 
> ---%<---
> QgsPoint QgsMapToPixel::toMapPoint( double x, double y ) const
> {
>   double mx = x * mMapUnitsPerPixel + xMin;
>   double my = -1 * (( y - yMax ) * mMapUnitsPerPixel - yMin );
>   return QgsPoint( mx, my );
> }
> --->%---
> 
> Is this everything that QGis does to transform a POINT(long, lat) to a
> Pixel- Point(x, y)? Because this is kind of what my naive approach (or
> what I thought it was) looked like, i.e., scaling factor plus correction
> of the counting direction.
> 
> 			Eric



More information about the Qgis-developer mailing list