Hello everybody:<br><br>I&#39;m working in a simple application that shows the bearing and distance from a reference point to the cursor position, but when I&#39;m trying to calcute them, distanceArea of MapRenderer returns a NaN<br>
I&#39;ve checked the configuration of mapcanvas and every thing looks fine. This is a chunk of code where I do the configuration:<br><br>QString fileName = &quot;config.xml&quot;;<br>        configMgt = new ConfigMgt(fileName, this);<br>
        QgsProviderRegistry::instance(configMgt-&gt;sPluginDir);<br>        QgsApplication::setPkgDataPath(configMgt-&gt;sPkgDir);<br>        QgsApplication::setPrefixPath(configMgt-&gt;sPkgDir);<br><br>        // Add Map Canvas<br>
        mpMapCanvas = new QgsMapCanvas(0, 0);<br>        mpMapCanvas-&gt;enableAntiAliasing(true);<br>        mpMapCanvas-&gt;useImageToRender(false);<br>        mpMapCanvas-&gt;freeze(false);<br>        mpMapCanvas-&gt;setVisible(true);<br>
        mpMapCanvas-&gt;refresh();<br>        mpMapCanvas-&gt;show();<br>        ui.Layout-&gt;addWidget(mpMapCanvas); <br>        crs = new QgsCoordinateReferenceSystem(3344,<br>                    QgsCoordinateReferenceSystem::InternalCrsId);<br>
<br><br>And this is the code where I show the Result<br><br>QString sLat(QVariant(getDegreesY(pos)).toString() + QChar(0xB0)+ QVariant(getMinutesY(pos)).toString());<br>    sLat.append(pos.y() &lt; 0 ? &quot; S&quot; : &quot; N&quot;);<br>
    this-&gt;ui.lbCursorPosLat-&gt;setText(sLat);<br>    QString sLon(QVariant(getDegreesX(pos)).toString() + QChar(0xB0)+ QVariant(getMinutesX(pos)).toString());<br>    sLon.append(pos.x() &lt; 0 ? &quot; W&quot; : &quot; E&quot;);<br>
    this-&gt;ui.lbCursorPosLon-&gt;setText(sLon);<br>        //Calculo de RNG y BRG<br>        QgsDistanceArea *daDistancia =new QgsDistanceArea();<br>        daDistancia=mpMapCanvas-&gt;mapRenderer()-&gt;distanceArea();<br>
        daDistancia-&gt;setProjectionsEnabled(false);<br>        QString * sRNG = new QString();<br>        QgsPoint *uno=new QgsPoint();<br>        QgsPoint *dos=new QgsPoint();<br>        uno-&gt;setX(pos.x());<br>        uno-&gt;setY(pos.y());<br>
<br>        dos-&gt;setX(ptReference.x());<br>        dos-&gt;setY(ptReference.y());<br><br><br>        sRNG-&gt;setNum(toNM(daDistancia-&gt;measureLine(*uno, *dos)), 10, 0);<br>        this-&gt;ui.laLat-&gt;setText(*sRNG + &quot; NM&quot;);<br>
<br>        QString * sBRG = new QString();<br><br>        double dDeg = RAD2DEG(/*daDistancia*/mpMapCanvas-&gt;mapRenderer()-&gt;distanceArea()-&gt;bearing(ptReference,pos));<br>        dDeg = dDeg &gt; 0 ? dDeg : 360 + dDeg;<br>
        dDeg = dDeg &gt; dCorrectionReference ? dDeg - dCorrectionReference : 360   - dCorrectionReference + dDeg;<br>        sBRG-&gt;setNum(dDeg, 10, 1);<br>        this-&gt;ui.laLon-&gt;setText(*sBRG + &quot; &quot; + QChar(0xB0));<br>
<br>Thank you for your help<br>