How to Calculate the LineString distance in kilometers?

429 views Asked by At

Assuming I have the following LineString in any document:

{ 
    type: "LineString", 
    coordinates: [ 
        [ 53.3477, -6.2597 ], [ 51.5008, -0.1224 ], 
        [48.8567, 2.3508], [52.5166, 13.3833] 
    ] 
}

When rendering this line on a map the result is:

enter image description here

How can I get the total distance of this LineString in kilometers, using the mongodb GeoQuery features?

0

There are 0 answers