Vector styling
Uncomment the following line to install geemap if needed.
In [ ]:
# !pip install geemap
Styling Earth Engine vector data
In [ ]:
import ee
import geemap
In [ ]:
# geemap.update_package()
Use the default style¶
In [ ]:
Map = geemap.Map()
states = ee.FeatureCollection("TIGER/2018/States")
Map.addLayer(states, {}, "US States")
Map
Use Image.paint()¶
In [ ]:
Map = geemap.Map()
states = ee.FeatureCollection("TIGER/2018/States")
image = ee.Image().paint(states, 0, 3)
Map.addLayer(image, {'palette': 'red'}, "US States")
Map
Use FeatureCollection.style()¶
In [ ]:
Map = geemap.Map()
states = ee.FeatureCollection("TIGER/2018/States")
style = {'color': '0000ffff', 'width': 2, 'lineType': 'solid', 'fillColor': '00000080'}
Map.addLayer(states.style(**style), {}, "US States")
Map
Use add_styled_vector()¶
In [ ]:
Map = geemap.Map()
states = ee.FeatureCollection("TIGER/2018/States")
vis_params = {
'color': '000000',
'colorOpacity': 1,
'pointSize': 3,
'pointShape': 'circle',
'width': 2,
'lineType': 'solid',
'fillColorOpacity': 0.66
}
palette = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
Map.add_styled_vector(states, column="NAME", palette=palette, layer_name="Styled vector", **vis_params)
Map
In [ ]:
import geemap.colormaps as cm
In [ ]:
Map = geemap.Map()
states = ee.FeatureCollection("TIGER/2018/States")
vis_params = {
'color': '000000',
'colorOpacity': 1,
'pointSize': 3,
'pointShape': 'circle',
'width': 2,
'lineType': 'solid',
'fillColorOpacity': 0.66
}
palette = list(cm.palettes.gist_earth.n12)
Map.add_styled_vector(states, column="NAME", palette=palette, layer_name="Styled vector", **vis_params)
Map
Use interactive GUI¶
In [ ]:
Map = geemap.Map()
states = ee.FeatureCollection("TIGER/2018/States")
Map.addLayer(states, {}, "US States")
Map
In [ ]:
Last update: 2021-03-17