[Qgis-developer] Problems with reprojecting to mercator
hubbatov
hubbatov at mail.ru
Thu Oct 17 05:30:38 PDT 2013
First of all thanks for reply, Kaosmos
I wrote as you said.
m_mapCanvas->mapRenderer()->setProjectionsEnabled(true);
m_mapCanvas->mapRenderer()->setDestinationCrs(m_mapCanvas->pseudoMercator());
m_mapCanvas->mapRenderer()->setMapUnits(m_mapCanvas->pseudoMercator().mapUnits());
I created custom layer based on QgsVectorLayer and overloaded bool
draw(QgsRenderContext &rendererContext) method, where i draw pixmaps
(tiles). Also i set crs to this layer in constructor:
setCrs(QgsCoordinateReferenceSystem(4326,
QgsCoordinateReferenceSystem::PostgisCrsId));
So, i know the coordinates of tile (where i need to draw it in degrees).
Also i know, that my canvas has crs_3857 and my layer has crs_4326.
I try to get scene position, where i need to draw it:
QPointF toCanvasCoordinates( const QgsPoint& point ){
double x = point.x(), y = point.y();
m_layer->canvas()->getCoordinateTransform()->transformInPlace( x, y );
return QPointF( x, y );
}
And nothing is was happened... What i`m doing wrong?
Thanks.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problems-with-reprojecting-to-mercator-tp5082191p5084154.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
More information about the Qgis-developer
mailing list