SVG der Landkreise, erzeugt mit Kartograph.py aus diesem Shapefile.
kartograph -o landkreise.svg --pretty-print config.yaml
var textWidth = (function() { | |
function charW(w, c) { | |
if (c == 'W' || c == 'M') w += 15; | |
else if (c == 'w' || c == 'm') w += 12; | |
else if (c == 'I' || c == 'i' || c == 'l' || c == 't' || c == 'f') w += 4; | |
else if (c == 'r') w += 8; | |
else if (c == c.toUpperCase()) w += 12; | |
else w += 10; | |
return w; | |
} |
# | |
# you might want to run this first: | |
# | |
# pip install pyproj mercantile | |
# | |
from pyproj import Proj | |
import mercantile | |
mercator = Proj('+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +over +no_defs') | |
albers = Proj('+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=sphere +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +nadgrids=@null') |
[{ | |
"file": "results", | |
"data": { | |
"AL": { | |
"fill": "#cc3d3d", | |
"stroke": false | |
}, | |
"AK": { | |
"fill": "#cc3d3d", | |
"stroke": false |
needs(dplyr, tidyr, readr, jsonlite) | |
trump_ratings <- read_csv('https://projects.fivethirtyeight.com/trump-approval-data/approval_topline.csv') %>% | |
filter(subgroup=='All polls') %>% | |
mutate(date=as.Date(modeldate, format='%m/%d/%Y'), | |
approve=as.numeric(approve_estimate), | |
disapprove=as.numeric(disapprove_estimate)) %>% | |
select(date, approve, disapprove, president) |
var multiCrowbar = (function() { | |
/* | |
* SVG Export | |
* converts html labels to svg text nodes | |
* will produce incorrect results when used with multi-line html texts | |
* | |
* Author: Gregor Aisch | |
* based on https://github.com/NYTimes/svg-crowbar/blob/gh-pages/svg-crowbar-2.js | |
*/ |
<h1>lazyload example</h1> | |
{#each [0,1,2,3,4,5,6,7,8,9] as i} | |
<p>Scroll down to load the images. Quo et qui laboriosam rerum. Animi et quia consequuntur quas sit eaque molestias. Accusamus voluptate nulla eligendi. Dolores labore ea asperiores ut voluptas dolorem. Cupiditate in enim quibusdam. Quas quae aliquam sed repellat laboriosam inventore est.</p> | |
<img alt="random image" use:lazyload src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAQAAABeK7cBAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=" data-src="https://picsum.photos/500/300/?image={i}" /> | |
{/each} | |
<script> | |
import { lazyload } from './lazyload.js'; | |
</script> |
#!/usr/bin/env python2.7 | |
import csv, shapefile, Polygon, Polygon.IO, math | |
# shapefile comes from here: | |
# http://epp.eurostat.ec.europa.eu/cache/GISCO/geodatafiles/NUTS_10M_2006_SH.zip | |
shpsrc = "eu-nuts-2.shp" | |
# zip code database comes from here: | |
# http://www.clearlyandsimply.com/files/2010/10/european_cities_and_postcodes_us_standard.zip |
SVG der Landkreise, erzeugt mit Kartograph.py aus diesem Shapefile.
kartograph -o landkreise.svg --pretty-print config.yaml
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title></title> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta name="robots" content="noindex, nofollow"> | |
<meta name="googlebot" content="noindex, nofollow"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet href="https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css"> |