Skip to content

Instantly share code, notes, and snippets.

View maptastik's full-sized avatar

Ryan Cooper maptastik

View GitHub Profile

Create a hexbin grid with equal-area and equilateral hexagons

Using hexbin grids is a great way to aggregate data. However, with the commonly used Web Mercator projection, it is impossible to balance the technical necessity of uniform area across all of the hexbins with the aesthetics of equilateralness for each hexbin in the grid. You can have one or the other, but not both. You'll need to use a different projection to help generate an appropriate compromise between the area and shape of hexbins. This walk-thru is meant to show how to make a map of Lexington, KY with equal-area hexbins. In particular, it explains how to create hexbins that are not only equal-area, but also equilateral.

Prerequisites

@maptastik
maptastik / add_to_gdb.py
Last active April 17, 2017 18:31
Add all the feature classes in an MXD to a geodatabase
'''
A Python script to take the feature classes in an MXD file and add them to a geodatabase
'''
import arcpy
# Specify MXD with data to send to GDB
# TODO Make this so you don't have to have ArcGIS open. User should be able to take a user input and export to GDB of choice
mxd = arcpy.mapping.MapDocument('CURRENT')
# Specify the data frame where your features are
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maptastik
maptastik / index.html
Last active March 22, 2018 17:23
Tangram Choropleth: Final
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TangramJS - Mixing with raster tiles</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;
@maptastik
maptastik / index.html
Last active March 22, 2018 17:21
Tangram Choropleth: Add Scene
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TangramJS - Add Scene to Map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;
@maptastik
maptastik / index.html
Last active March 22, 2018 17:22
Tangram Choropleth: Starter Files
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TangramJS - Mixing with raster tiles</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;
@maptastik
maptastik / index.html
Last active March 22, 2018 17:20
Playing w/ TangramJS: Raster tile labels and GeoJSON data
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TangramJS - Mixing with raster tiles</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;
@maptastik
maptastik / index.html
Created February 8, 2017 16:40
Loading External GeoJSON (Promises): Add data to map
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>A simple map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
@maptastik
maptastik / index.html
Created February 8, 2017 15:59
Loading External GeoJSON (Promises): .when() & .done()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Starter map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;
@maptastik
maptastik / index.html
Last active February 8, 2017 15:46
Loading external GeoJSON (Promises): Request data
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Starter map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;