从爱尔兰横向墨卡托(ITM)到WGS84纬度的投影

问题描述 投票:0回答:1

[不幸的是,我从爱尔兰横轴墨卡托(ITM)到WGS84纬度的投影似乎出错了,因为绘制的坐标未与都柏林sourced from the CSO的地图对齐(请参见下文)。

My transformed coordinates plotted on a map of Dublin

[转换后的数据来自Irish Valuation Office,并将ITM X和Y坐标输入到previous stackoverflow discussion改编的函数中,该函数使用geopandas内置的points_from_xy方法在坐标参考系统之间转换坐标:

def create_geodf_from_GPS (df, latitude, longitude, crs):

    locations = gpd.points_from_xy(longitude, latitude)
    geo_df = gpd.GeoDataFrame(df, geometry=locations)
    geo_df.crs = crs

    return geo_df


VO_geo = create_geodf_from_GPS(VO, VO[" X ITM"], VO[" Y ITM"], crs = 'epsg:2157')
VO_geo = VO_geo.to_crs('epsg:4326')

有人知道这里出了什么问题吗?

python geopandas pyproj
1个回答
0
投票
使用x和y作为gpd.points_from_xy的参数的替代函数,而不是先前混合的经度和纬度:

def create_geodf_from_GPS (df, x, y, crs): locations = gpd.points_from_xy(x, y) geo_df = gpd.GeoDataFrame(df, geometry=locations) geo_df.crs = crs return geo_df

现在在WGS84纬度-经度中绘制数据按预期工作:

VO_geo = create_geodf_from_GPS(VO, x=VO[" X ITM"], y=VO[" Y ITM"], crs = 'epsg:2157')
VO_geo.to_crs('epsg:4326').plot()

注:必须通过使用geopandas(gpd)空间联接函数过滤掉非都柏林数据来清理数据以消除明显的异常值

VO_geo_clean = gpd.sjoin(VO_geo.to_crs('epsg:4326'), map_of_Dublin)

结果:
VO data plotted over a map of Dublin
© www.soinside.com 2019 - 2024. All rights reserved.