我有一个有 4 个角的多边形,而不是正方形。如何在 python 中获取较小部分的经纬度?

I have a polygon with 4 corners, not a square. How do I get the latitude and longitude of smaller sections of it in python?

我有一个有 4 个角的多边形,一个 GIS 投影。它不是一个精确的正方形。我如何获得它的较小部分的纬度和经度。网格将被分解成更小的正方形(每个 500x500 米,由此产生的 2d 分布的尺寸为 1728x1984)。我需要每个正方形一个角的纬度和经度。我正在查看 np.mgrid 或 np.meshgrid,但他们似乎无法获得我的输入。我有 4 个点,每个点有 2 个值。

LL_lat = 52.29427206432812
LL_lon = 4.379082700525593
LR_lat = 52.29427206432812
LR_lon = 18.893280870398133
UL_lat = 60.0
UL_lon = 3.0
UR_lat = 59.827708427801085
UR_lon = 20.735140174892805 

所以我想我需要将二维数组分成更小的间隔。我怎样才能做到这一点。间隔是固定的spacing。

右边的多边形就是我的那个。我想要一种方法来为每个立方体找到左下角的纬度和经度(它们的大小都相同)。1

所以我的老板帮我解决了如果你们都好奇:)

我们正在从 DMI 转换丹麦天气数据 GIS 网格

from pyproj import Proj, transform
import h5py

projection = ""
tmpfile = "file_path"
with h5py.File(tmpfile_in, 'r') as h5file:
    projection = h5file['where'].attrs['projdef'].decode('utf-8')

#projection = '+proj=stere+ellps=WGS84+lat_0=56+lon_0=10.5666+lat_ts=56' 
dmi_proj = Proj(projparams=projection)  # DMI input, custom stereographic projection
wgs_proj = Proj(init='EPSG:4326')  # WGS84

###Lat and lon in corners are known from file
LL_lat = 52.29427206432812
LL_lon = 4.379082700525593

###Get start projections as wgs projections instead of lat and lon (for the `calculation)`
x0, y0 = pyproj.transform(wgs_proj, dmi_proj, LL_lon, LL_lat)
print(x0, y0)
xscale = 500.0 
yscale = 500.0

latitude = []
longitude = []
###Whether or not the j and k orders need to be decending 
### will figure out, but `thats more based on the set up of your datafile.` 
for j in range(0, (1984 -1)):
    print(j)
    for k in range(0, (1728 -1)):
        east = x0 + j*xscale
        north = y0 + k*yscale
        ### convert back to lat and lon
        lon, lat = pyproj.transform(dmi_proj, wgs_proj, east, north)
        longitude.append(lon)
        latitude.append(lat)

print(longitude)
print(latitude)