2

I have seen many suggestions on how to measure the area of a polygon (see Getting polygon areas using GeoPandas)

I am not an expert in projection or CRS but I am aware that I need to convert the CRS I currently have in my Geodataframe (EPSG:4326 unit=degree) into a CRS which preserves the area measure and use meters as units. Which one shall I use?

.to_crs({'init': 'epsg:32633'})  # unit in meter

.to_crs({'init': 'epsg:3857'}) # unit in meter (pseudo Mercator)

.to_crs({'init': 'epsg:3395'}) # unit in meter (Mercator)

They all have units in meters but which one is correct or more accurate?

The code would be as follows:

# copy original geodataframe
tost = joinIlots.copy()
# convert from 4326 to WORLD MERCATOR for example
tost= tost.to_crs({'init': 'epsg:3395'}) 
# convert m2 into km2
tost["area"] = tost['geometry'].area/ 10**6
tost.head(2)
print(tost.crs)

My confusion is on the projection.

Vince
  • 20,017
  • 15
  • 45
  • 64
bravopapa
  • 475
  • 3
  • 11
  • 2
    Where on earth are you? – BERA Feb 18 '23 at 10:53
  • I am in Morocco. I should also add that I am not looking for a super high precision. Something that is roughly accurate should be enough for my exercise – bravopapa Feb 18 '23 at 10:55
  • 1
    https://epsg.io/26191 – bravopapa Feb 18 '23 at 10:58
  • It seems that 26191 is most appropriate for my case – bravopapa Feb 18 '23 at 11:09
  • 4
    use laea, Lambert Azimuthal Equal Area - set the centre lon and lat, works everywhere no need to futz with codes – mdsumner Feb 18 '23 at 13:13
  • 2
    NEVER consider Web Mercator for distance calculation, for anywhere, ever. – Vince Feb 18 '23 at 13:27
  • @mdsumner can you please clarify the EPSG number? is it CRS("+init=epsg:9820")) . Also what s wrong with using a specific epsg to Morocco similar to the one i mentioned 26191. Thank you – bravopapa Feb 18 '23 at 13:48
  • 1
    The UTM you chose was centered east of Algeria, and neither Mercator is appropriate for distance. Your best bet for national mapping is to use the projection used by the national mapping agency. When working with EPSG codes, you need to be able to distinguish classes from instances. 9820 is all Lambert Azimuthal Equal Area projections (a class), while 26191 is an instance of Lambert Conformal Conic appropriate to northern Morocco. – Vince Feb 18 '23 at 13:59
  • @Vince Thank you very much for your detailed explanation! Basically from your explanation i understand that using 26191 is similar to using an instance of 9820 which implies that it is correct. – bravopapa Feb 18 '23 at 15:11
  • 1
    No, and yes. Lambert CC is different than Lambert AEA, but it's not a bad choice. – Vince Feb 18 '23 at 15:28
  • 2
    no epsg code, use proj=laea and set the lon_0 and lat_0 args for the location, lots of people are obsessed with epsg codes but there's no need to be – mdsumner Feb 26 '23 at 11:08
  • 1
    @mdsumner for the sake of future searchers (e.g. me) it would be great if you could post this information in an answer. – shadowtalker Mar 15 '23 at 02:29
  • 1
    @Vince same goes for your helpful comment as well. – shadowtalker Mar 15 '23 at 02:30
  • web mercator is ok for distance "near to" the equator, for exactly the same reason utm is ok "near to" the given zone's central longitude, because the transverse means tipped on its side and the "equator" becomes that longitude – mdsumner Mar 20 '23 at 06:35

0 Answers0