Skip to content

Instantly share code, notes, and snippets.

Daniel Wiesmann yellowcap

Block or report user

Report or block yellowcap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>spatialsankey.js - sankey diagrams on a map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<style>
body {
position: absolute;
width:100%;
@yellowcap
yellowcap / Dockerfile
Last active Mar 29, 2016
Django Test Build for GDAL Versions
View Dockerfile
FROM ubuntu:14.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
wget\
libproj-dev\
python-dev\
build-essential\
libffi-dev\
git\
@yellowcap
yellowcap / serializers.py
Last active Aug 29, 2015
Django-parler integrated with Django-Rest-Framework for read only applications. When using these classes to create ModelViewSet endpoints, you can select the language using query parameters. For example /api/mymodel/?language=fr
View serializers.py
from rest_framework import serializers
class ParlerModelSerializer(serializers.ModelSerializer):
"""Serializer to handle django-parler fields"""
def __init__(self, *args, **kwargs):
# Get list of translated fields
fields = self.Meta.model._translations_model.get_translated_fields()
# Separate parler fields and scilent fields
@yellowcap
yellowcap / index.html
Last active Jul 29, 2019
Leaflet layer propagation example
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Leaflet GeoJSON Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
</head>
@yellowcap
yellowcap / index.html
Last active Jul 29, 2019
spatialsankey.js - visualizing flows on a leaflet map
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>spatialsankey.js - sankey diagrams on a map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<style>
body {
position: absolute;
width:100%;
@yellowcap
yellowcap / linux-2014.03-psql9.3.3-postgis2.1.0-mapscript6.4.1.sh
Last active May 4, 2016
Custom AMI preparation with PostGIS enabled
View linux-2014.03-psql9.3.3-postgis2.1.0-mapscript6.4.1.sh
#!/bin/bash
#
# Script to setup a Elastic Beanstalk AMI with geospatial libraries
# Author: Daniel Wiesmann, July 14, 2014
#
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 &
# Go to ec2-user home directory
cd /home/ec2-user
@yellowcap
yellowcap / Intersection Line for two circles
Last active Dec 30, 2015
This function calculates the intersection points for two circles defined by (x1, y1, r1) and (x2, y2, r2). It returns the coordinates of the two intersection points, which can also be used to calculate the intersection line for the circles.
View Intersection Line for two circles
def intersection_line(x1, y1, r1, x2, y2 r2):
"""Calculates intersection line for two circles defined by (x1, y1, r1) and (x2, y2, r2)."""
# Formulas obtained from
# http://www.wolframalpha.com/input/?i=solve+x^2+%2B+y^2+%3D+pow(r,2)+
# and+%28x-a%29^2+%2B+%28y-b%29^2+%3D+pow(q,2)+for+x%2Cy
# Create transformed coordinates for calculations
a = x2 - x1
b = y2 - y1
(r,q) = (r1, r2)
You can’t perform that action at this time.