此图像代表 17S 区 UTM 坐标中的组件位置列表。
但是,我想在 ArcGis Pro 或 Google Earth 中可视化它们,并且必须是 KMZ/KML 或 SHAPEFILE。每个坐标应显示为点,而不是多边形
data = ['ROO01',558635,9303470]
columns = ['ID','Easthing','Northing']
df = pd.DataFrame(data = data, columns = columns)
我怎样才能做到这一点并获得这样的东西?
utm
软件包将数据转换为纬度/经度。您也许可以用 pyproj
做同样的事情。
#!pip install utm
import utm
import geopandas as gpd
from shapely.geometry import Point
to_latlon = lambda x: Point(utm.to_latlon(x['Easthing'], x['Northing'], 17, 'S'))
df['geometry'] = df.apply(to_latlon, axis=1)
gdf = gpd.GeoDataFrame(df, crs='WGS84')
gdf.to_file('layer.shp')
输出:
>>> gdf
ID Easthing Northing geometry
0 ROO01 558635 9303470 POINT (83.75738 -76.16455)
>>> gdf.crs
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
>>> gdf.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
RangeIndex: 1 entries, 0 to 0
Data columns (total 4 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ID 1 non-null object
1 Easthing 1 non-null object
2 Northing 1 non-null object
3 geometry 1 non-null geometry
dtypes: geometry(1), object(3)
memory usage: 160.0+ bytes