Skip to content

Instantly share code, notes, and snippets.

View maptastik's full-sized avatar

Ryan Cooper maptastik

View GitHub Profile
@maptastik
maptastik / README.md
Last active September 18, 2015 15:33
Linkify your URLs!

Regular link

<a href="URL GOES HERE">Let's go to a new page!</a>

So <a href="http://maptime.io/lexington/">maptimeLEX!</a> becomes maptimeLEX!

Link that opens in a new tab!

<a href="URL GOES HERE" target="_blank">Let's go to a new page in a new tab!</a>

@maptastik
maptastik / clipToRasterExtent.py
Last active August 15, 2023 19:59
Clip a raster to the extent of another raster using arcpy and convert it to a TIFF
# Load arcpy
import arcpy
# Set workspace
arcpy.env.workspace = "<some filepath for your working environment>"
scratch = "<some scratch location for intermediate files>"
# Specify the data you'll be clipping and the area you want to clip that data by
myClip = "<location of raster to be clipped>"
clipArea = "<location of raster to clip by>"
@maptastik
maptastik / README.md
Last active October 8, 2015 13:35
Add a WMS layer to GeoJSON.io

Add a WMS layer from an ArcGIS REST Service to GeoJSON.io

Note: This is a pretty roundabout way to do this. After some discussion on Twitter, it seems you can just add these sorts of layers directly in GeoJSON.io

httP://.../MapServer/tile/{z}/{y}/{x} (Add the bold part to the service URI

Introduction

GeoJSON.io allows you to use its console API to access Leaflet/Mapbox.js methods. This means you can add layers from external sources. This works great with your tile map service from the likes of Stamen, CartoDB, or Mapbox, but adding layers from a WMS is a little different. Apparently you can work with WMS layers using Leaflet with L.tileLayer.wms(), but I've not ever successfully done this with straigh-up Leaflet. I have been able to access WMS layers using esri-leaflet. In this little note

@maptastik
maptastik / index.html
Last active September 28, 2015 19:14
LEX GRAPI
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Percentage of population w/ GRAPI >30%</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/calvinmetcalf/leaflet-ajax/gh-pages/dist/leaflet.ajax.min.js"></script>
<!-- <script type="text/javascript" src="leaflet.ajax.min.js"></script> -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css" />
@maptastik
maptastik / grapi.geojson
Created September 28, 2015 19:12
grapi-data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maptastik
maptastik / facebook-likes-extract.py
Created October 12, 2015 19:49
A little script to extract the names of people who like the GSCPC Facebook page
# first, you'll need to login to facebook and go to the fans page
# https://www.facebook.com/browse/page_fans/?page_id=868110399935068
# navigate down the page until there are no more like to load
# open developer tools and copy the page html
# paste it into an html file and save
# in the command prompt, navigate to the directorty with your facebook html file
# start a local server `python -m SimpleHTTPServer`
# this uses lxml and requests
@maptastik
maptastik / index.html
Last active October 19, 2015 02:39
gronked
<!DOCTYPE html>
<html>
<head>
<title>Gronked</title>
</head>
<body>
<pre style="font: 2px/1px monospace;">
Map {
background-color: #000;
}
#counties {
line-color:#FFCC99;
line-opacity:1;
polygon-opacity:0.15;
polygon-fill:#FFF;
line-join: round;
2these are the officials that have political power in the usa that are associated with either bronies or my little pony related. addresses will not be released so nobody gets it in their mind to take out their own justice against them.
Brought to you by some asshole:
1.United States Senator From North Carolina: Thomas Tillis aka Thom Tillis: Age 55: Wife Susan Tillis, Both living in: Cornelius, North Carolina.Known bronies Affiliated group:United Northern and Southern bronies of the friends of equestria. Thornton.
2.United States Senator From Texas: John Cornyn: Age 63: Wife Sandy Cornyn, Both living in: Austin,Texas: Known bronies Affiliated Group: United rainbow bronies Of The friends of equestria.
3.United States Senator From Georgia: John Hardy Isakson: Age 70: Wife Dianne Davison: Both Living in: Marietta, Georgia. Known bronies Affiliated Group: Original twilight sparklers Of the bronies.

In the Field Calculator:

  1. Select "Python" as your parser

  2. Check "Show code block".

  3. Paste the following into the code block

def leadZero(val):