ThinkGeo.com    |     Documentation    |     Premium Support

Convert decimal degree to meters is not correct

Hello Thinkgeo,

I use the following method to convert decimal degree to meters on bing map. But I found after converting, the line length is different. Length1 is 10464 meters and after converting, Length2 is 13252 meters. I compared it to google earth, I found Length 1 is correct. Any idea about this? I also attached the kml file which is the line shape is converting.

    public Proj4Projection Prj4Meters()
    {          
        Proj4Projection proj4 = new Proj4Projection();
        proj4.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
        proj4.ExternalProjectionParametersString = Proj4Projection.GetBingMapParametersString(); // It works for Bing map, for Google map please use the other one
        proj4.Open();
        return proj4;
    }

Thanks
Mindoc.zip (1.5 MB)

Hi Min,

If you want to calculate the line length, please always reproject the shape into 4326. Because projection will change the shape, so only 4326 is its really length.

Regards,

Ethan

Hi Ethan,

Do you mean using GetWgs84ParametersString()?
Proj4Projection _prj = new Proj4Projection();
_prj.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
_prj.InternalProjectionParametersString = Proj4Projection.GetWgs84ParametersString();
_prj.Open();
return (_prj);
or lineShapeMeter.GetAccurateLength(4326, DistanceUnit.Meter, DistanceCalculationMode.Default);?

Thanks

Hi Min,

I means you need to convert the shape into 4326 if it’s not a 4326 shape.

_prj.ConvertToExternalProjection(Your3857Shape)

And then call the GetLength function for the 4326 shape, the result should be the actual length of the shape.

If you have special requirement about it please let me know.

Regards,

Ethan

Thanks for your answer, Ethan. The problem is fixed now.
Cheer
Min

Hi Min,

I am glad to hear that solved.

Regards,

Ethan