Last active
February 25, 2023 13:35
-
-
Save gisfromscratch/a0cbdf7efb63af9cf38cfe19fcb22aa4 to your computer and use it in GitHub Desktop.
Some geospatial utility functions for mapping the Russian invasion of Ukraine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_osm_webmap(): | |
"""Creates a simple web map using the OSM basemap.""" | |
webmap = WebMap() | |
webmap.basemap = 'osm' | |
return webmap | |
def create_events_renderer(): | |
"""Creates a simple renderer representing events as areas of interests.""" | |
renderer = generate_simple(geometry_type='Polygon', colors=[171, 31, 42, 191]) | |
renderer_outline = { | |
'type': 'esriSLS', | |
'color': [0, 0, 0, 191], | |
'width': 0.75, | |
'style': 'esriSLSSolid' | |
} | |
renderer['symbol']['outline'] = renderer_outline | |
return renderer | |
def create_aggregated_renderer(spatial_df, field = 'count'): | |
"""Create a class-breaks renderer representing aggregated events as hexagonal spatial bins.""" | |
renderer = generate_classbreaks(sdf_or_series=spatial_df, geometry='Polygon', colors='OrRd', field=field) | |
return renderer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needed imports