简体   繁体   English

在Python中计算lat / lon多边形的面积

[英]Calculating area from lat/lon polygons in Python

Basically, I want to know how many times a 0.25°lat x 0.25°lon patch is fitting in various polygons located around the world. 基本上,我想知道0.25°纬度x 0.25°lon贴片在世界各地的各种多边形中适合多少次。 The latter have sizes around 3°lat x 10°lon or 2°lat x 4°lon. 后者的尺寸约为3°lat x 10°lon或2°lat x 4°lon。

I have the lat/lon values of the corners of the polygons and I am calculating their area like this: 我有多边形角的纬度/经度值,我正在计算它们的面积,如下所示:

from pyproj import Proj
from shapely.geometry import shape

def getArea(coords):
    c = {"type": "Polygon",
    "coordinates": [[ (coords[0], coords[2]), (coords[1], coords[2]),
                      (coords[0], coords[3]), (coords[1], coords[3]) ]]}
    lon, lat = zip(*c['coordinates'][0])
    pro = Proj("+proj=aea")
    x, y = pro(lon, lat)
    poly = {"type": "Polygon", "coordinates": [zip(x, y)]}
    return shape(cop).area

I took the approach from here: How to calculate the area of a polygon on the earth's surface using python? 我从这里采取了方法: 如何使用python计算地球表面上多边形的面积?

Now the question is, which equal area projection shall I choose in order to have comparable area sizes for the polygons. 现在的问题是,我应该选择哪个相等的面积投影,以便具有可比较的多边形面积大小。 The area of the small patch is always the same, regardless of where it is located on the globe in such a projection. 小补丁的区域总是相同的,无论它在这样的投影中位于地球上的什么位置。

Taking the Albers Equal Area Projection (aea) results in these areas of three polygons: 采用Albers等面积投影(aea)会产生三个多边形的这些区域:

  1. 240993868.90978813 240993868.90978813
  2. 699931593.1047173 699931593.1047173
  3. 212092562.5238676 212092562.5238676

Taking the Lambert Azimuthal Equal Area Projection (laea) results in these areas of the same polygons: 采用Lambert Azimuthal等面积投影(laea)得到相同多边形的这些区域:

  1. 148709452.69292444 148709452.69292444
  2. 409253749.5468254 409253749.5468254
  3. 106218747.36092758 106218747.36092758

Why is the relation between the areas in the two projections different? 为什么两个投影中的区域之间的关系不同? First 1:3 = 0.344; 首先1:3 = 0.344; Second 1:3 = 0.363; 第二个1:3 = 0.363; They should be the same since both are equal area projections?! 它们应该是相同的,因为两者都是相等的面积投影?!

That makes me wonder whether it is legitimate to compare the small patch to the areas of the polygons in either projection. 这让我想知道在任一投影中将小补丁与多边形区域进行比较是否合理。 Do you have any advice? 你有什么建议吗?

If you care about actual relative area, counting tiles won't give you the right answer. 如果你关心实际的相对面积,计算瓷砖将无法给你正确的答案。 If you need actual surface area, use ellipsoidal or spherical geometry, or the idea below. 如果您需要实际表面积,请使用椭圆体或球形几何体,或下面的想法。

Brute force vector approach: generate world-wide .25 deg grid as polygons, intersect with polygons, count results. 蛮力矢量方法:生成世界范围的.25度网格作为多边形,与多边形相交,计算结果。 Each polygon can be a Cartesian square or the actual ellipsoidal square. 每个多边形可以是笛卡尔方形或实际的椭圆形方形。 Create a custom ideal projection for each tile, then calculate and store the area as an attribute for each tile. 为每个图块创建自定义理想投影,然后计算并存储该区域作为每个图块的属性。 You only have to do this once :) 你只需要这样做一次:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM