1

I have a GeoDataFrame created from a shapefile having CRS EPSG:4326.

Even though the GeoDataFrame has no src assigned the coordinates are correctly expressed in this CRS.

I want to calculate the length of the multilinestring objects in the geometry column in meters. Since EPSG:4326 is in degrees, I performed a reprojection of a copy of my data to EPSG:24877 for my geographical objects are located in costal Ecuador.

Unfortunately, the reprojection seems to have no effect when it comes to computing the length as shown in the attached screenshot

enter image description here

I'm very new to GIS.

How do I compute length in meters on the fly despite of the CRS?

4
  • 1
    Error messages and code should be posted as text, not as a screenshot. It is very difficult to read for some users and impossible for screen readers, and google. Please take the tour to see how this site works.
    – Ian Turton
    Commented Feb 6, 2023 at 14:38
  • changing the projection from a null CRS to a known CRS will not have any effect on the distances. Your original projection is probably EPSG:4326 so you will need to reproject your data from 4326 to 24877
    – Ian Turton
    Commented Feb 6, 2023 at 14:39
  • @IanTurton excellent! Thank you very much, reprojecting twice solved my problem
    – Natalio
    Commented Feb 6, 2023 at 14:55
  • 1
    Please post code as text in the Question. Images are not legible on all devices and would require those who would help to retype your code.
    – Vince
    Commented Feb 6, 2023 at 15:00

1 Answer 1

2

Changing the .crs property doesn't change the numbers, it only changes what GeoPandas thinks the numbers represent. You should first set the CRS to "EPSG:4326" and then you can transform to any other system.

In chunk 19 you've first told Geopandas the data are in 24877, and then you've asked it to project to 24877, but since it thinks they are in 24877 because you told it, it doesn't change the numbers.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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