将爱尔兰网格(北距和东距)转换为正确的北距和东距
Convert Irish Grid (Northings & Eastings) to Correct Northings & Eastings
我有一个 CSV 文件,其中包含纬度和经度列。每个数据都在爱尔兰网格坐标系 (Northings & Eastings) 中。如何转换为正确的经纬度?
我所拥有的示例 Latitude 372000 Longitude 332000
。
代码
from shapely.geometry import Point
import geopandas as gpd
from geopandas import GeoDataFrame
import pandas as pd
df = pd.read_csv("File.csv", skiprows=0, low_memory=False, encoding='ANSI')
geometry = [Point(xy) for xy in zip(df['longitude'], df['latitude'])]
gdf = GeoDataFrame(df, geometry=geometry)
#this is a simple map that goes with geopandas
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot(figsize=(10, 6)), color='red', markersize=1.5)
我相信爱尔兰网格使用 CRS 29903(根据 https://georepository.com/crs_29903/TM75-Irish-Grid.html),而 GeoPandas 附带的世界文件使用 CRS 4326。因此您必须将第一个重新投影到第二个,反之亦然.
类似于:
gdf = gdf.to_crs(4326)
或
world = world.to_crs(29903)
然后您可以使用(在此处使用 Jupyter)进行检查:
In: world.crs
Out:
Name: TM75 / Irish Grid
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Europe - Ireland (Republic and Ulster) - onshore
- bounds: (-10.56, 51.39, -5.34, 55.43)
Coordinate Operation:
- name: Irish Grid
- method: Transverse Mercator
Datum: Geodetic Datum of 1965
- Ellipsoid: Airy Modified 1849
- Prime Meridian: Greenwich
所以把这些放在一起(假设你的 .csv 的隐式 CRS 真的是 29903,它看起来像这样:
df = pd.read_csv("File.csv", skiprows=0, low_memory=False, encoding='ANSI')
geometry = [Point(xy) for xy in zip(df['longitude'], df['latitude'])]
gdf = GeoDataFrame(df, geometry=geometry, crs= 29903)
gdf = gdf.to_crs(4326)
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot(figsize=(10, 6)), color='red', markersize=1.5)
你会得到如下所示的几何值:
0 POINT (-6.45067 53.35318)
1 POINT (-6.44943 53.35470)
2 POINT (-6.44432 53.35355)
3 POINT (-6.43974 53.34900)
4 POINT (-6.44179 53.34956)
我有一个 CSV 文件,其中包含纬度和经度列。每个数据都在爱尔兰网格坐标系 (Northings & Eastings) 中。如何转换为正确的经纬度?
我所拥有的示例 Latitude 372000 Longitude 332000
。
代码
from shapely.geometry import Point
import geopandas as gpd
from geopandas import GeoDataFrame
import pandas as pd
df = pd.read_csv("File.csv", skiprows=0, low_memory=False, encoding='ANSI')
geometry = [Point(xy) for xy in zip(df['longitude'], df['latitude'])]
gdf = GeoDataFrame(df, geometry=geometry)
#this is a simple map that goes with geopandas
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot(figsize=(10, 6)), color='red', markersize=1.5)
我相信爱尔兰网格使用 CRS 29903(根据 https://georepository.com/crs_29903/TM75-Irish-Grid.html),而 GeoPandas 附带的世界文件使用 CRS 4326。因此您必须将第一个重新投影到第二个,反之亦然.
类似于:
gdf = gdf.to_crs(4326)
或
world = world.to_crs(29903)
然后您可以使用(在此处使用 Jupyter)进行检查:
In: world.crs
Out:
Name: TM75 / Irish Grid Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre) Area of Use:
- name: Europe - Ireland (Republic and Ulster) - onshore
- bounds: (-10.56, 51.39, -5.34, 55.43) Coordinate Operation:
- name: Irish Grid
- method: Transverse Mercator Datum: Geodetic Datum of 1965
- Ellipsoid: Airy Modified 1849
- Prime Meridian: Greenwich
所以把这些放在一起(假设你的 .csv 的隐式 CRS 真的是 29903,它看起来像这样:
df = pd.read_csv("File.csv", skiprows=0, low_memory=False, encoding='ANSI')
geometry = [Point(xy) for xy in zip(df['longitude'], df['latitude'])]
gdf = GeoDataFrame(df, geometry=geometry, crs= 29903)
gdf = gdf.to_crs(4326)
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot(figsize=(10, 6)), color='red', markersize=1.5)
你会得到如下所示的几何值:
0 POINT (-6.45067 53.35318)
1 POINT (-6.44943 53.35470)
2 POINT (-6.44432 53.35355)
3 POINT (-6.43974 53.34900)
4 POINT (-6.44179 53.34956)