I have a KML file which contains a line feature representing the passage of an Optical Fiber connecting two cities. I can trace them nicely in QGIS and OpenStreetMap.

Optical Fiber in blue

I would just like to know how I can determine its length.


Save AS ... the kml file as a shapefile into a CRS that uses meters as units, like your local UTM zone.

Then you can use the $length variable to label the line with the length in the layers units.

  • Hi AdreJ, I tried the solution of Roberto and yours.
    – ferdam
    Apr 13 '16 at 14:54
  • Hi AdreJ, I tried the solution of Roberto and yours. The first one (zonums) returns 204545 m and using QGIS returns 199866 m. In QGIS I used CRS EPSG:29101, SAD69 Brazil/Polyconic but there are many others related with Brazil and I don't know what is more adequade. Anyway, seems like very good. Thanks a lot ! Fernando
    – ferdam
    Apr 13 '16 at 15:03
  • For Sao Paulo, EPSG:32723 UTM 23S would be best, You can try also the SIRGAS projections, which are more up-to date than SAD69. I'm not sure about the accuracy of the nationwide Polyconic projection.
    – AndreJ
    Apr 13 '16 at 17:40

My solution to the problem would be:

  1. Open your kml file with a text editor (notepad for instance)
  2. Copy the entire text, and paste it here : http://www.zonums.com/online/kmlArea/
  3. Done!
  • Hi Roberto, Thanks a lot, please see my comments in the answer of AdreJ
    – ferdam
    Apr 13 '16 at 14:51
  • Unfortunately, they don't tell how they compute the length from degree coordinates, using an ellipsoid or a sphere.
    – AndreJ
    Apr 13 '16 at 17:41

Another option is to do the measurement in Google Earth. Google Earth Pro now makes it easy to get the length of line segments in your KML files (or polygon area & perimeter length). You can find it by going into the edit dialog for the KML feature and selecting the "Measurements" tab. The edit dialog is available by right-clicking the KML feature in your Places list, and selecting "Properties" (Get Info on Mac).

That should work well if your line is one long line segment. If it's lots of small segments, then you'll want to do some GIS work to combine them... and then measure it in your GIS or export back to KML for measurement in Google Earth.

FYI that Google Earth Pro is now free for everyone (use GEPFREE as the license key).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.