Skip to content

Instantly share code, notes, and snippets.

@gisfromscratch
Last active February 25, 2023 13:35
Show Gist options
  • Save gisfromscratch/a0cbdf7efb63af9cf38cfe19fcb22aa4 to your computer and use it in GitHub Desktop.
Save gisfromscratch/a0cbdf7efb63af9cf38cfe19fcb22aa4 to your computer and use it in GitHub Desktop.
Some geospatial utility functions for mapping the Russian invasion of Ukraine
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
@gisfromscratch
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment