visualizing road network

explore osm road network in Google Earth Engine

Openstreetmap is a very rich source of geo-spatial information. In this exercise we will vizualize the road network in Google Earth Engine.

Step 1: import the dataset and print the different road categories.

//import road feature
var roads = ee.FeatureCollection('projects/servir-mekong/osm/cambodia/gis_osm_roads');

// print the road categories
print("road categories:", roads.aggregate_histogram("fclass"));

Step 2: categorize the different road networks

// create lists to categorize the road networks
var primary = ["primary","primary_link"];
var secondary = ["secondary","secondary_link"];
var tertiary = ["tertiary","tertiary_link"];
var other = ee.List(roads.aggregate_histogram("fclass").keys()).removeAll(primary).removeAll(secondary).removeAll(tertiary);

Step 3: filter the dataset for the different road types

// filter for primary, secondary and tertiary roads
var primaryRoads = roads.filter(ee.Filter.inList("fclass",primary));
var secondaryRoads = roads.filter(ee.Filter.inList("fclass",secondary));
var tertiaryRoads = roads.filter(ee.Filter.inList("fclass",tertiary));
var otherRoads = roads.filter(ee.Filter.inList("fclass",other));

Step 4: add the layers to the map

// add the layers to to the map
Map.addLayer(primaryRoads,{},"Primary roads");
Map.addLayer(secondaryRoads,{},"Secondary roads");

Click here for the full script

Leave a Reply