C34 建筑环境(Part 7)
导读:
建筑环境由环境的人为物理部分组成,包括房屋、建筑物、街道、开放空间和基础设施。
重点分析全球基础设施数据集。
主要内容:
- 量化道路特征。
- 理解基于矢量和基于栅格的方法。
Section 1 GEE目前可用的数据集
- the Global Power Plant Database
- Open Buildings V1 Polygons (whichcurrently includes over half of Africa)
- Global Artificial Impervious Area
- the Global Flood Database
- the Global Roads Inventory Project
-
(GRIP) dataset
- 。。。。
Section 2 道路特征
使用Global Roads Inventory Project (GRIP) 数据集计算道路长度。
该数据集旨在为环境和生物多样性评估(environmental and biodiversity assessments)提供一致的全球道路数据集。
//=======================================================================================
// 导入非洲、南美洲和欧洲的道路数据
var grip4_africa = ee.FeatureCollection( 'projects/sat-io/open-datasets/GRIP4/Africa'),
grip4_north_america = ee.FeatureCollection( 'projects/sat-io/open-datasets/GRIP4/North-America'),
grip4_europe = ee.FeatureCollection( 'projects/sat-io/open-datasets/GRIP4/Europe');
// print('Grip4 Africa size', grip4_africa.size());
// print('Grip4 North America size', grip4_north_america.size());
// print('Grip4 Europe size', grip4_europe.size());
// // 显示道路数据.
// Map.addLayer(ee.FeatureCollection(grip4_africa).style({
// color: '413B3A',
// width: 1
// }), {}, 'Grip4 Africa');
// Map.addLayer(ee.FeatureCollection(grip4_north_america).style({
// color: '413B3A',
// width: 1
// }), {}, 'Grip4 North America');
// Map.addLayer(ee.FeatureCollection(grip4_europe).style({
// color: '413B3A',
// width: 1
// }), {}, 'Grip4 Europe');
//==========================================================================================
// 导入国家边界数据,计算国家面积,选择一个面积最大的国家
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
// Add a function to calculate the feature's geometry area.
// Add the function as a property.
var addArea = function(feature) {
return feature.set({
areaKm: feature.geometry().area().divide(1000 * 1000)
}); // km2 squared
};
// Map the area getting function over the FeatureCollection.
var countriesArea = countries.map(addArea);
print("countriesArea", countriesArea);
// Filter to the largest country in Africa .
var Algeria = countriesArea.filter(ee.Filter.inList('country_na', [ 'Algeria' ]));
// Display the selected countries.阿尔及利亚
Map.addLayer(Algeria.style({
fillColor: 'b5ffb4',
color: '00909F',
width: 1.0
}), {}, 'Algeria');
//=============================================================================================
//定义函数:为相关的GRIP数据集计算每个国家的道路长度。
var roadLength4Country = function(country, grip4) {
// Join roads to countries.
var intersectsFilter = ee.Filter.intersects({
leftField: '.geo',
rightField: '.geo',
maxError: 10
});
var grip4Selected = grip4.filterBounds(country);
var countriesWithRds = ee.Join.saveAll('roads').apply({
primary: country,
secondary: grip4Selected,
condition: intersectsFilter
}).filter(ee.Filter.neq('roads', null));
// Return country with calculation of roadLength and roadsPerArea.
return countriesWithRds.map(function(country) {
var roadsList = ee.List(country.get('roads'));
var roadLengths = roadsList.map(function(road) {
return ee.Feature(road).intersection( country, 10).length(10);
});
var roadLength = ee.Number(roadLengths.reduce(ee .Reducer.sum()));
return country.set({
roadLength: roadLength.divide( 1000), // Convert to km.
roadsPerArea: roadLength.divide(ee .Number(country.get('areaKm'))
)
});
}).select(['country_na', 'areaKm', 'roadLength',
'roadsPerArea'
]);
};
// Apply the road length function to Algeria.
var roadLengthAlgeria = roadLength4Country(Algeria, grip4_africa);
// Print the road statistics for Algeria.
print('Roads statistics in Algeria', roadLengthAlgeria);

浙公网安备 33010602011771号