Hi,
I have added some classes to overwrite TrackOverlayer and make it a measurement layer.
It works fine when I don’t add BingMapLayer as background, but it stops working after I add the BingLayer as background although projection has been set.
I’ve attached a sample to demonstrate the problem.
Thank you in advance.
Regards,
Shahin
ThinkgeoMeasurementProjection.zip (30.9 KB)
TrackOverlayer with projection
Hi Shaahin,
Thanks for your sample.
I think comment the 94 line in MainWindow.xaml.cs can make that works.
//ruler.TrackShapeLayer.FeatureSource.Projection = projection;
After you comment that, you will found the two measure result looks not the same.
So you should want to convert the line back to 4326 then calculate its length.
case WellKnownType.Line:
{
LineShape convertedLine = shape as LineShape;
if (proj4 != null)
{
convertedLine = proj4.ConvertToInternalProjection(shape) as LineShape;
}
double length = ((LineShape)convertedLine).GetLength(mapUnit, DistanceUnit.Meter);
feature.ColumnValues.Add("length", string.Format("{0:n0}", (Int64)length) + " Meter");
mArgs = new MeasurementChangedEventArgs(length, MeasurementType.Distance);
}
break;
Regards,
Don