Hello everybody:<br><br>I'm working in a simple application that shows the bearing and distance from a reference point to the cursor position, but when I'm trying to calcute them, distanceArea of MapRenderer returns a NaN<br>
I'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 = "config.xml";<br>        configMgt = new ConfigMgt(fileName, this);<br>
        QgsProviderRegistry::instance(configMgt->sPluginDir);<br>        QgsApplication::setPkgDataPath(configMgt->sPkgDir);<br>        QgsApplication::setPrefixPath(configMgt->sPkgDir);<br><br>        // Add Map Canvas<br>
        mpMapCanvas = new QgsMapCanvas(0, 0);<br>        mpMapCanvas->enableAntiAliasing(true);<br>        mpMapCanvas->useImageToRender(false);<br>        mpMapCanvas->freeze(false);<br>        mpMapCanvas->setVisible(true);<br>
        mpMapCanvas->refresh();<br>        mpMapCanvas->show();<br>        ui.Layout->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() < 0 ? " S" : " N");<br>
    this->ui.lbCursorPosLat->setText(sLat);<br>    QString sLon(QVariant(getDegreesX(pos)).toString() + QChar(0xB0)+ QVariant(getMinutesX(pos)).toString());<br>    sLon.append(pos.x() < 0 ? " W" : " E");<br>
    this->ui.lbCursorPosLon->setText(sLon);<br>        //Calculo de RNG y BRG<br>        QgsDistanceArea *daDistancia =new QgsDistanceArea();<br>        daDistancia=mpMapCanvas->mapRenderer()->distanceArea();<br>
        daDistancia->setProjectionsEnabled(false);<br>        QString * sRNG = new QString();<br>        QgsPoint *uno=new QgsPoint();<br>        QgsPoint *dos=new QgsPoint();<br>        uno->setX(pos.x());<br>        uno->setY(pos.y());<br>
<br>        dos->setX(ptReference.x());<br>        dos->setY(ptReference.y());<br><br><br>        sRNG->setNum(toNM(daDistancia->measureLine(*uno, *dos)), 10, 0);<br>        this->ui.laLat->setText(*sRNG + " NM");<br>
<br>        QString * sBRG = new QString();<br><br>        double dDeg = RAD2DEG(/*daDistancia*/mpMapCanvas->mapRenderer()->distanceArea()->bearing(ptReference,pos));<br>        dDeg = dDeg > 0 ? dDeg : 360 + dDeg;<br>
        dDeg = dDeg > dCorrectionReference ? dDeg - dCorrectionReference : 360   - dCorrectionReference + dDeg;<br>        sBRG->setNum(dDeg, 10, 1);<br>        this->ui.laLon->setText(*sBRG + " " + QChar(0xB0));<br>
<br>Thank you for your help<br>