Skip to content

Instantly share code, notes, and snippets.

View gisfromscratch's full-sized avatar

Jan Tschada gisfromscratch

View GitHub Profile
@gisfromscratch
gisfromscratch / berlin_starting_locations.geojson
Created July 14, 2024 15:38
Berlin S- and U-Bahn stations near the Olympiastadium
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gisfromscratch
gisfromscratch / walking_scenarios.py
Created July 9, 2024 21:48
Exploring Walking Areas for EURO 2024 Stadiums Using ArcGIS Location Platform
from arcgis.gis import GIS
from arcgis.features import FeatureLayer, FeatureSet
from arcgis.mapping import WebMap
from geopedestrian.categories import CategoryRegistry
from geopedestrian.services import drive_from, solve_walking, walk_to
from georapid.client import GeoRapidClient
from georapid.factory import EnvironmentClientFactory
import os
import pandas as pd
@gisfromscratch
gisfromscratch / simulated_car_positions.md
Last active January 14, 2024 14:45
The simulated agent positions representing high commute car traffic nearby a highway crossroad intersection
trip person trip_time SHAPE
3485 2168 2023-08-24T08:00:00 ...
... ... ... ...
75 46 2023-08-24T08:00:00 ...
... ... ... ...
75 46 2023-08-24T08:00:12 ...
... ... ... ...
1562 966 2023-08-24T08:00:29 ...
@gisfromscratch
gisfromscratch / top_traffic_grid_cells.md
Created January 11, 2024 01:07
The top five accumulated car traffic grid cells from the city of Bonn
start_time end_time agent_count SHAPE
2023-08-24T08:00:00 2023-08-24T08:59:59 439 ...
... ... ...
... ... ...
... ... ...
2023-08-24T09:00:00 2023-08-24T09:59:59 408 ...
@gisfromscratch
gisfromscratch / pythagorean.py
Created December 10, 2023 15:33
Solve for any one side of a triangle using the Pythagorean Theorem.
import math
# Function to calculate the hypotenuse
def calculate_hypotenuse(a, b):
return math.sqrt(a**2 + b**2)
# Function to calculate one leg (a)
def calculate_leg_a(c, b):
return math.sqrt(c**2 - b**2)
@gisfromscratch
gisfromscratch / geoint-mapping-russian-invasion.py
Last active February 25, 2023 16:37
Mapping the Russian invasion of Ukraine
# Mapping the aggregated armed conflict events
focus_map = create_osm_webmap()
aggregated_events_renderer = create_aggregated_renderer(aggregated_events_featureset.sdf)
focus_map.add_layer(aggregated_events_featureset, {'renderer': aggregated_events_renderer, 'opacity': 0.7})
focus_map
# Mapping the armed conflict events
focus_map = create_osm_webmap()
events_renderer = create_events_renderer()
focus_map.add_layer(events_featureset, {'renderer': events_renderer, 'opacity': 0.7})
@gisfromscratch
gisfromscratch / geoint-russian-invasion.py
Created February 25, 2023 14:11
Querying the armed conflict events of 24th February 2022
host = 'geoconflicts.p.rapidapi.com'
conflicts_client = EnvironmentClientFactory.create_client_with_host(host)
features_dict = query(conflicts_client, date=datetime(2022, 2, 24), format=OutFormat.ESRI)
events_featureset = FeatureSet.from_dict(features_dict)
aggregated_features_dict = aggregate(conflicts_client, date=datetime(2022, 2, 24), format=OutFormat.ESRI)
aggregated_events_featureset = FeatureSet.from_dict(aggregated_features_dict)
@gisfromscratch
gisfromscratch / geoint-utils.py
Last active February 25, 2023 13:35
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 = {
@gisfromscratch
gisfromscratch / geoint-imports.py
Created February 25, 2023 12:23
Python imports for mapping the Russian invasion of Ukraine
from arcgis.gis import GIS
from arcgis.features import FeatureLayer, FeatureSet
from arcgis.mapping import WebMap
from arcgis.mapping.renderer import generate_simple, generate_classbreaks
from datetime import datetime
from georapid.client import GeoRapidClient
from georapid.factory import EnvironmentClientFactory
from georapid.conflicts import aggregate, query
from georapid.formats import OutFormat
@gisfromscratch
gisfromscratch / locations-25-26-02-2022.md
Created March 5, 2022 03:32
Protests locations 25-26 February 2022
name count date
Moscow, Moskva, Russia 797 2022-02-25
Budapest, Budapest, Hungary 258 2022-02-25
Kiev, Ukraine (General), Ukraine 256 2022-02-25
Saint Petersburg, Sankt-Peterburg, Russia 197 2022-02-25
New Delhi, Delhi, India 178 2022-02-25
Berlin, Berlin, Germany 118 2022-02-25
Dublin, Dublin, Ireland 83 2022-02-25
London, London, City Of, United Kingdom 73 2022-02-25