@@ -68,17 +68,42 @@ Certain countries sub parts have been merged to create a consistent single file
6868#### Earth Engine Snippet
6969
7070``` javascript
71- // Load a specific country's building data (example: Trinidad and Tobago)
72- var ghs_obat_tto = ee .FeatureCollection (" projects/sat-io/open-datasets/JRC/GHS-OBAT/GHS_OBAT_GPKG_TTO_E2020_R2024A_V1_0 " );
71+ // Load Singapore building data
72+ var ghs_obat_sgp = ee .FeatureCollection (" projects/sat-io/open-datasets/JRC/GHS-OBAT/GHS_OBAT_GPKG_SGP_E2020_R2024A_V1_0 " );
7373
74- // Filter buildings by attributes (example: residential buildings constructed 2000-2010)
75- var residential_2000s = ghs_obat_tto .filter (ee .Filter .and (
74+ // Filter out null height values
75+ var buildings_with_height = ghs_obat_sgp .filter (ee .Filter .neq (' height' , null ));
76+
77+ // Define visualization parameters for building heights
78+ var heightVis = {
79+ min: 0 ,
80+ max: 100 ,
81+ palette: [' blue' , ' green' , ' yellow' , ' orange' , ' red' ]
82+ };
83+
84+ // Create an image from the feature collection for height visualization
85+ var heightImage = buildings_with_height
86+ .reduceToImage ([' height' ], ee .Reducer .first ())
87+ .rename (' height' );
88+
89+ // Visualize building heights
90+ Map .addLayer (heightImage, heightVis, ' Singapore Building Heights' );
91+
92+ // Filter residential buildings from 2000-2010
93+ var residential_2000s = ghs_obat_sgp .filter (ee .Filter .and (
7694 ee .Filter .eq (' use' , 1 ), // Residential
7795 ee .Filter .eq (' epoch' , 4 ) // 2000-2010
7896));
7997
80- // Visualize building height distribution
81- Map .addLayer (ghs_obat_tto, {color: ' height' }, ' Building Heights' );
98+ Map .addLayer (residential_2000s, {color: ' #FF6600' }, ' Residential 2000s' );
99+
100+ // Print statistics
101+ print (' Total buildings:' , ghs_obat_sgp .size ());
102+ print (' Buildings with height data:' , buildings_with_height .size ());
103+ print (' Residential 2000s buildings:' , residential_2000s .size ());
104+
105+ // Center map on Singapore
106+ Map .centerObject (ghs_obat_sgp, 11 );
82107```
83108
84109Sample Code: https://code.earthengine.google.com/?scriptPath=users/sat-io/awesome-gee-catalog-examples:global-utilities-assets-amenities/GHS-OBAT-OPEN-BUILDINGS
0 commit comments