Skip to content

How to style vector using specific color that matched with different propoerty value #432

Answered by giswqs
Jack-ee asked this question in Q&A
Discussion options

You must be logged in to vote

Update geemap using geemap.update_package() and then try the following example. You can pass a dictionary with label and color to palette

Map = geemap.Map()

states = ee.FeatureCollection("TIGER/2018/States") \
    .filter(ee.Filter.inList('NAME', ['California', 'Nevada', 'Utah', 'Arizona']))

palette = {    
    'California': 'ff0000',
    'Nevada': '00ff00',
    'Utah': '0000ff',
    'Arizona': 'ffff00'    
}

vis_params = {
    'color': '000000', 
    'colorOpacity': 1,
    'width': 2,
    'lineType': 'solid', 
    'fillColorOpacity': 0.66    
}

Map.add_styled_vector(states, column="NAME", palette=palette, layer_name="Styled vector", **vis_params)

Map

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by giswqs
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants