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)提供一致的全球道路数据集。

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//=======================================================================================
// 导入非洲、南美洲和欧洲的道路数据
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);

 

  

 

posted @   百里屠苏top  阅读(13)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示