AnsweredAssumed Answered

GeometryEngine: densify vs. densifyGeodetic

Question asked by norbert.thoden on Apr 3, 2018
Latest reply on Apr 12, 2018 by tdunn-esristaff

Hi!

 

What is the difference between GeometryEngine::densify and GeometryEngine::densifyGeodetic?

 

I tried to create additional coordinates in i polyline:

 

First i create a polyline with a length of ~1000meters:

Esri::ArcGISRuntime::SpatialReference sr = Esri::ArcGISRuntime::SpatialReference::wgs84();

Esri::ArcGISRuntime::Point p1 =
Esri::ArcGISRuntime::CoordinateFormatter::fromMgrs(QLatin1Literal("32UMD 00001 00001"), sr, Esri::ArcGISRuntime::MgrsConversionMode::Automatic);
Esri::ArcGISRuntime::Point p2 =
Esri::ArcGISRuntime::CoordinateFormatter::fromMgrs(QLatin1Literal("32UMD 00001 01001"), sr, Esri::ArcGISRuntime::MgrsConversionMode::Automatic);


// create Polyline:
Esri::ArcGISRuntime::PolylineBuilder polylineBuilder(sr, this);
polylineBuilder.addPoint(p1);
polylineBuilder.addPoint(p2);

const Esri::ArcGISRuntime::Polyline &polylineIn = polylineBuilder.toPolyline();

 

1st approach: GeometryEngine::densify(const Geometry& geometry, double maxSegmentLength);

 

const Esri::ArcGISRuntime::Geometry &geometryOut = Esri::ArcGISRuntime::GeometryEngine::densify(polylineIn, 100);

const Esri::ArcGISRuntime::Polyline polylineOut(geometryOut);

qCritical() << "polylineOut.parts().part(0).pointCount() = " << polylineOut.parts().part(0).pointCount();

The result is 2, but i expect ~12

 

2nd approach: GeometryEngine::densifyGeodetic(polylineIn, ...

const Esri::ArcGISRuntime::Geometry &geometryOut =    Esri::ArcGISRuntime::GeometryEngine::densifyGeodetic(polylineIn,
         100,
          Esri::ArcGISRuntime::LinearUnit::meters(),
          Esri::ArcGISRuntime::GeodeticCurveType::Geodesic);

const Esri::ArcGISRuntime::Polyline polylineOut(geometryOut);

qCritical() << "polylineOut.parts().part(0).pointCount() = " << polylineOut.parts().part(0).pointCount();

The result here is 12, as expected :-)

 

BTW:

Esri::ArcGISRuntime::GeometryEngine::errorOccurred is not fired.

 

 

Is that i bug in the first method or can someone explain what happens?

 

Thx

Norbert

Outcomes