【Kaggle 学习笔记】 | Geospatial Analysis

地理空间文件格式:shapefile(最常见)、GeoJSON、KML和GPKG

文件读取

# Read in the data
full_data = gpd.read_file("../input/geospatial-learn-course-data/DEC_lands/DEC_lands/DEC_lands.shp")

# View the first five rows of the data
full_data.head()

坐标参考系由欧洲石油勘探集团(EPSG)规范引用。

这个GeoDataFrame使用的是EPSG 32630,它通常被称为“墨卡托”投影。此投影保留角度(使其对航海有用)并稍微扭曲区域。

但是,当从CSV文件创建GeoDataFrame时,我们必须设置CRS。EPSG 4326对应于经纬度坐标。

# Create a DataFrame with health facilities in Ghana
facilities_df = pd.read_csv("../input/geospatial-learn-course-data/ghana/ghana/health_facilities.csv")

# Convert the DataFrame to a GeoDataFrame
facilities = gpd.GeoDataFrame(facilities_df, geometry=gpd.points_from_xy(facilities_df.Longitude, facilities_df.Latitude))

# Set the coordinate reference system (CRS) to EPSG 4326
facilities.crs = {
   'init': 'epsg:4326'}

DataFrame常用参数

regions.geometry.length # 线长度
regions.geometry.area # 区域面积

画图

静态
# 1.简单的图层叠加
# Define a base map with county boundaries
ax = counties.plot(figsize=(10,10), color='none', edgecolor='gainsboro', zorder=3) 

# Add wild lands, campsites, and foot trails to the base map
wild_lands.plot(color='lightgreen', ax=ax)
campsites.plot(color='maroon', markersize=2, ax=ax)
trails.plot(color='black', markersize=1, ax=ax)

# 2.考虑坐标参考的一致性
ax = regions.plot(figsize=(8,8), color='whitesmoke', linestyle=':', edgecolor='black')
facilities.to_crs(epsg=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值