Hello, this is my first time posting on forums.arcgis.com so please forgive me if I haven't formatted my question correctly or followed correct submission protocol. I am developing a desktop GIS product in C# using the ArcGis Runtime for WPF version 10.1.1I have written a function that uses Densify to insert a point every 1/n-th subsegment of a two-point segment (e.g. if I had a segment between (100,1) and (200,5) this function could insert points at (125,2), (150,3), and (175,4) (where n == 0.25). When I run this function, I get almost what I expect. The number of points and their X-values seem correct, but the Y-values of the inserted points seem drastically wrong. Here is the function (the parameter "proportionFromStart" is analogous to n in my above example, all Geometry is projected in ESRI.ArcGIS.Client.Projection.WebMercator) private MapPoint GetPointAlongSingleSegment(object polylineSegment, double proportionFromStart)
{
ESRI.ArcGIS.Client.Geometry.Polyline pL = polylineSegment as ESRI.ArcGIS.Client.Geometry.Polyline;
//control for extreme vaules
if (pL.Paths.Count != 1 || pL.Paths[0].Count != 2)
{
Log.Error("GetPointAlongSingleSegment called on a polyline that is not a single (two-point) segment");
return null;
}
double fullLength = ESRI.ArcGIS.Client.Geometry.Geodesic.Length(pL);
ESRI.ArcGIS.Client.Geometry.Geometry densifiedGeometry =
ESRI.ArcGIS.Client.Geometry.Geodesic.Densify(pL, (fullLength * proportionFromStart));
///////...placed breakpoint here to inspect objects
}
And here is the output when I inspect the original line (pL) and the densified line when proportionFromStart == 0.5:pL.Paths[0]Count = 2 [0]: {Point[X=-8932651.10126309, Y=4313679.64989647]} [1]: {Point[X=-8932680.55891339, Y=4313877.57298654]}(densifiedGeometry as ESRI.ArcGIS.Client.Geometry.Polyline).Paths[0]Count = 3 [0]: {Point[X=-8932651.10126309, Y=4313679.64989647]} [1]: {Point[X=-8932666.30560504, Y=-11.7697564697751]} [2]: {Point[X=-8932680.55891339, Y=4313877.57298654]}So, the expected number of points were added (in this case, just the one geodesic midpoint), and the X-values of these points all look correct to me, but why is the Y-value of the added point ([1]: {Point...) so strange? (The single point added by Densify has a Y-value of about -11.77, whereas the points on either side have much more common (for my data) "in-the-millions" values, roughly 4,313,679.65 and 4,313,877.57. I have tried this for many values of proportionFromStart between 0 and 1. In all cases, all inserted points have what appears to be correct X-values, but the Y-values are all very small and negative. The inserted Y-values are trending in the proper direction and seem evenly spaced around each other, but are orders-of-magnitude smaller than expected and have the wrong sign. Am I doing something wrong in the way I'm calling the Densify function? How should I interpret the inserted Y-values? Is there an easier way to achieve such point insertion within the WPF ArcGIS runtime? (It seems there may be options in other ESRI libraries, but I am confined to the ArcGIS Runtime for WPF.) Thanks very much, ThomasUPDATE: I discovered that, using almost all the same parameters, I can get the expected result if I call the Densify instance method of the Geometry service, so, this behavior seems likely tied to the static call. Here is the code that I'm using as a workaround (/*some comments for brevity*/): DensifyParameters densifyParameters = new DensifyParameters()
{
LengthUnit = LinearUnit.Meter,
Geodesic = true,
MaxSegmentLength = LengthOfGeometryInMeters(pL) * proportionFromStart
};
Graphic g = new Graphic();
g.Geometry = pL;
List<Graphic> gL = new List<Graphic>();
gL.Add(g);
ESRI.ArcGIS.Client.Geometry.Geometry asyncDensGeo = null;
asyncDensGeo = /*our app's local geometry service*/.Densify(gL, densifyParameters)[0].Geometry;
Upon inspection, asyncDensGeo looks very much like densifiedGeometry (above) but with sensible Y-values. I don't have an apples-to-apples output available to paste, but, what I observed is that the X-values still look correct (although, they were, in fact, very slightly different (+/- 0.5 meters) from the static Densify), and the Y-values look equally correct, ascending in expected increments along the segment. The only parameter that changed significantly was the maximum length parameter. To get expected results in the instance-Densify method, I had to use a fraction of the length-in-meters of the polyline. I tried using this same value in the static-Densify call, but got MANY too many points added, and, all of the injected points had strangely small, negative Y-values, just like before. So, for now, we are using the service instance Densify method as a workaround, and avoiding the staticESRI.ArcGIS.Client.Geometry.Geodesic.Densifyuntil we can understand how to prevent the strange Y-values from appearing