Skip to content

Instantly share code, notes, and snippets.

View gisfromscratch's full-sized avatar

Jan Tschada gisfromscratch

View GitHub Profile
@gisfromscratch
gisfromscratch / gist:4f8141d8a72fe63e6f6b
Created September 1, 2015 20:50
Strophe.js unit test for connecting to a XMPP Server
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Chat TestSuite</title>
<script src="/lib/strophe.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.19.0.css">
@gisfromscratch
gisfromscratch / OciSpatialInsert
Created May 18, 2016 21:10
Inserting spatial data using OCI native
#include "ocilib.h"
#define NB_ELEM 500
void error(OCI_Error *err)
{
printf("msg : %s\n", OCI_ErrorGetString(err));
exit(EXIT_FAILURE);
}
@gisfromscratch
gisfromscratch / geoprotests_aggregate.py
Created January 14, 2022 23:32
Aggregates the broadcasted news related to protests/demonstrations using a spatial grid and returns the features as hexagonal bins.
import requests
url = 'https://geoprotests.p.rapidapi.com/aggregate'
querystring = {
'date': '2021-12-31',
'format': 'geojson'
}
# Authenticate: https://rapidapi.com/auth
@gisfromscratch
gisfromscratch / geoprotests_hotspots.py
Created January 14, 2022 23:44
Returns the hotspot locations related to protests/demonstrations.
import requests
url = 'https://geoprotests.p.rapidapi.com/hotspots'
querystring = {
'date': '2021-12-31',
'format': 'geojson'
}
# Authenticate: https://rapidapi.com/auth
name count date
Istanbul, Istanbul, Turkey 67 2021-11-24
Honiara, Solomon Islands (General), Solomon Islands 212 2021-11-25
Canberra, Australian Capital Territory, Australia 127 2021-11-25
Khartoum, Al Khartum, Sudan 84 2021-11-25
Malaita, Solomon Islands (General), Solomon Islands 74 2021-11-25
Istanbul, Istanbul, Turkey 55 2021-11-25
Honiara, Solomon Islands (General), Solomon Islands 153 2021-11-26
Istanbul, Istanbul, Turkey 140 2021-11-26
@gisfromscratch
gisfromscratch / locations-01-07-12-2021.md
Created February 11, 2022 20:06
Protests locations 01-07 December 2021
name count date
Washington, Washington, United States 62 2021-12-01
Yangon, Yangon, Myanmar 50 2021-12-02
Belgrade, Serbia (General), 133 2021-12-04
Vienna, Wien, Austria 93 2021-12-04
Warsaw, (Pl67), Poland 61 2021-12-04
Kremlin, Moskva, Russia 60 2021-12-04
Grimma, Sachsen, Germany 59 2021-12-04
Berlin, Berlin, Germany 51 2021-12-04
@gisfromscratch
gisfromscratch / locations-23-24-02-2022.md
Created February 27, 2022 18:59
Protests locations 23–24 February 2022
name count date
Ottawa, Ontario, Canada 128 2022-02-23
Moscow, Moskva, Russia 108 2022-02-23
Moscow, Moskva, Russia 544 2022-02-24
Ottawa, Ontario, Canada 172 2022-02-24
Saint Petersburg, Sankt-Peterburg, Russia 161 2022-02-24
Berlin, Berlin, Germany 125 2022-02-24
Washington, Washington, United States 75 2022-02-24
London, London, City Of, United Kingdom 61 2022-02-24
@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
@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 / 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 = {