GeometryEngine: densify vs. densifyGeodetic

655
7
04-03-2018 05:57 AM
NorbertThoden
Occasional Contributor III

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

Tags (1)
0 Kudos
7 Replies
TroyFoster
New Contributor III

Check the units on the Densify function.  the documentation does not say what they are in so I would bet money that they are in terms of the input geometry, which in your case is wgs84 so decimal degrees.  With an input parameter of 100 degrees you are not going to get a break in 1000 meters.  Maybe try redoing your test case with points 10 degrees apart and use a maxSegmentLength of 1.0.

NorbertThoden
Occasional Contributor III

Hi Troy!
Sounds good or in other words: typical for this SDK :(

I will try your suggestion ~next week and will let you know.

Thx a lot

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hi Norbert,

We have logged an issue to improve the documentation to specify that the output units are the same as the input units. Please let us know when you find documentation that you think needs improvement, as want to make the documentation as robust as possible. Thanks!

-Luke

NorbertThoden
Occasional Contributor III

Hi Luke!

So i would like to suggest to add some picture to methods like 'clip' or 'cut' to illustrate  these methods...

I can remember that i have seen some ESRI website describing clip, cut, difference based on pictures (10.2.6).

I found it: https://developers.arcgis.com/qt/10-2/qml/guide/geometry-operations.htm

But this chapter is missing in 100.2.1...

0 Kudos
TroyFoster
New Contributor III

Since we are tacking on suggestions, you know what would be even cooler?  Little code samples of those geometry operations in Esri's github samples.

0 Kudos
ThomasDunn
Occasional Contributor

Norbert and Troy,

Keep those suggestions coming! We appreciate your feedback. As Luke mentioned, we created a new issue to fill in the missing units doc in GeometryEngine::densify. Also on our radar is putting the spatial relationships diagrams from the v10.2.x Geometry Operations topic of the v100.x Guide. Luke asked me to let you know that GeometryEngine samples are being planned, too.

So, let us know when you see things we can do to make the doc better for all our users. Thank you very much.

- Thomas Dunn

0 Kudos
NorbertThoden
Occasional Contributor III

Hi Troy!

As promised, i verified your assumption. From my point of view your are completely right:

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

p1 = Esri::ArcGISRuntime::Point(8.0, 53.0, sr);
p2 = Esri::ArcGISRuntime::Point(9.0, 53.0, sr);

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

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

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

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

The result is 11.

Thx a lot

Norbert

0 Kudos