基于夜间灯光遥感数据的城镇空间格局研究

基于夜间灯光提取城市建成区的范围,从而进行区域城镇化空间格局分析。

初始化环境

import aie
aie.Authenticate()
aie.Initialize()

读取行政区划数据

feature_collection = aie.FeatureCollection('user/35861bf257e14a8c807ef23cd92101c8')
geometry = feature_collection.geometry()
map = aie.Map(
    center=geometry.getCenter(),
    height=800,
    zoom=5
)

vis_params = {
    'color': '#00FF00'
}
map.addLayer(
    geometry,
    vis_params,
    'region',
    bounds=geometry.getBounds()
)
map

中原城市群

2020年中原城市群

#指定检索数据集,可设置检索的时间范围
dataset = aie.ImageCollection('NOAA_VIIRS_DNB_ANNUAL_V2_VCMSLCFG') \
             .filterDate("2020-01-01", "2020-12-31")
imgs = dataset.select(['average'])
imgs = imgs.mosaic()
imgs = imgs.clip(geometry)

# vis_params = {
#     'bands': 'average',
#     'min': 0.0,
#     'max': 60.0
# }
# map.addLayer(
#     imgs,
#     vis_params,
#     'Nighttime average',
#     bounds=imgs.getBounds()
# )
# map

DN_mean_2020 = imgs.reduceRegion(aie.Reducer.mean())
DN_mean_2020.getInfo()
DN_mean_2020 = DN_mean_2020.getInfo()['average_mean']
# 经过多次对比,将阈值设置为20,这个阈值大家可以设置的更加科学
city_2020 = imgs.gte(aie.Image.constant(20))
mask_params = {
    'bands': 'average',
    'min': 0,
    'max': 1,
    'paletee':['#000000','#ffffff']
}
map.addLayer(
    city_2020,
    mask_params,
    'city_2020',
    bounds=city_2020.getBounds()
)
map

2020年中原城市群

# task = aie.Export.image.toAsset(city_2020,'city_2020',1000)
# task.start()

2018年中原城市群

#指定检索数据集,可设置检索的时间范围
dataset = aie.ImageCollection('NOAA_VIIRS_DNB_ANNUAL_V2_VCMSLCFG') \
             .filterDate("2018-01-01", "2018-12-31")
imgs = dataset.select(['average'])
imgs = imgs.mosaic()
imgs = imgs.clip(geometry)
DN_mean_2018 = imgs.reduceRegion(aie.Reducer.mean())
DN_mean_2018.getInfo()
DN_mean_2018 = DN_mean_2018.getInfo()['average_mean']
city_2018 = imgs.gte(aie.Image.constant(20))
mask_params = {
    'bands': 'average',
    'min': 0,
    'max': 1,
    'paletee':['#000000','#ffffff']
}
map.addLayer(
    city_2018,
    mask_params,
    'city_2018',
    bounds=city_2018.getBounds()
)
map

2018年中原城市群

2016年中原城市群

#指定检索数据集,可设置检索的时间范围
dataset = aie.ImageCollection('NOAA_VIIRS_DNB_ANNUAL_V2_VCMSLCFG') \
             .filterDate("2016-01-01", "2016-12-31")
imgs = dataset.select(['average'])
imgs = imgs.mosaic()
imgs = imgs.clip(geometry)
DN_mean_2016 = imgs.reduceRegion(aie.Reducer.mean())
DN_mean_2016.getInfo()
DN_mean_2016 = DN_mean_2016.getInfo()['average_mean']
city_2016 = imgs.gte(aie.Image.constant(20))
mask_params = {
    'bands': 'average',
    'min': 0,
    'max': 1,
    'paletee':['#000000','#ffffff']
}
map.addLayer(
    city_2016,
    mask_params,
    'city_2016',
    bounds=city_2016.getBounds()
)
map

2016年中原城市群

2014年中原城市群

#指定检索数据集,可设置检索的时间范围
dataset = aie.ImageCollection('NOAA_VIIRS_DNB_ANNUAL_V2_VCMSLCFG') \
             .filterDate("2014-01-01", "2014-12-31")
imgs = dataset.select(['average'])
imgs = imgs.mosaic()
imgs = imgs.clip(geometry)

DN_mean_2014 = imgs.reduceRegion(aie.Reducer.mean())
DN_mean_2014.getInfo()
DN_mean_2014 = DN_mean_2014.getInfo()['average_mean']
city_2014 = imgs.gte(aie.Image.constant(20))
mask_params = {
    'bands': 'average',
    'min': 0,
    'max': 1,
    'paletee':['#000000','#ffffff']
}
map.addLayer(
    city_2014,
    mask_params,
    'city_2014',
    bounds=city_2014.getBounds()
)
map

2014年中原城市群

平均灯光亮度变化

import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
x = np.array([2014,2016,2018,2020])
Y = np.array([DN_mean_2014,DN_mean_2016,DN_mean_2018,DN_mean_2020])
plt.figure(figsize=(10,8))
ax = plt.gca()
ax.plot(x,Y,'o-')
ax.set_yticks([0,0.5,1,1.5])
ax.set_xticks([2014,2016,2018,2020])
for a,b in zip(x,Y):
    plt.text(a,b+0.02,'%.4f'%b,ha='center',va='bottom',fontsize=9)

image.png

建成区面积变化

比如还可以做建成区面积的变化对比,这方面还不太支持,所以知识给大家一个思路,还比如 CNLI 的区域整体城镇化水平动态演化。还有就是阈值的确定还不够合理,大家应该有更加合理确定阈值的方法,本次案例主要引用了《城市与区域规划空间分析实验教程》(第3版)中的实验13。

原文地址:http://www.cnblogs.com/truggling-zx/p/16852931.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性