Skip to content

Instantly share code, notes, and snippets.

Ryan Clark rclark

  • Mapbox
  • Tucson, AZ
Block or report user

Report or block rclark

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 backfill.md
      |                                           |                                       |                                                     |                                                         |
      |                                           |                                       |                                                     |                                                         |
      |--------- really no time at all -----------|------------ 7 to 14 days -------------|-------------- really no time at all ----------------|----------------- shouldn't be too long -----------------|
      |                                           |                                       |                                                     |                                                         |
      |                                           |                                       |                                                     |                                                         |
View primer.md

You're going to start up a Linux EC2, set up its firewall rules, and connect to it.

  • If you're not doing production work always try and use the sandbox account, so log into sandbox account.

  • The first thing you need is an AMI, which is like a snapshot that is the starting point for your machine. Go to https://cloud-images.ubuntu.com/locator/ec2/ to find ubuntu AMIs. These are like from-scratch instances that are kept up-to-date with security patches. If you search for 14.04 that'll be the latest stable ubuntu release, then you're looking for one that's in the right region (generally that's us-east-1), the right architecture (usually amd64) and the right instance type (usually that's instance-store). Copy the

  • Clicking on one of the ami-12345 links will pop you over to the AWS EC2 console and start you down the road of creating the instance.

  • First you'll have to choose an instance type. You'll want the smallest (i.e. cheapest) one th

View rds-troubles.md

Import times with osm2pgsql

I imported tucson.osm.pbf, a 3.4MB OSM extract.

Where is PostgreSQL Machine Specs Import time
Local 4 CPU, 16GB RAM Macbook Pro 18 seconds
Local i2.4xlarge EC2 76 seconds
Remote m1.medium EC2 > db.m1.large 500GB : 2000 IOPS 112 seconds
Remote i2.4xlarge EC2 > db.m2.4xlarge 1000GB : 10000 IOPS 82 seconds
@rclark
rclark / min-ckan.json
Created Nov 21, 2013
Bare-minimum CKAN Package
View min-ckan.json
{
"license_title": "License Not Specified",
"maintainer": "",
"relationships_as_object": [],
"private": false,
"maintainer_email": "",
"revision_timestamp": "2013-11-21T00:22:03.676324",
"id": "f1a90774-c8d0-4c73-947b-63803c2d7525",
"metadata_created": "2013-11-21T00:21:38.099774",
"owner_org": null,
@rclark
rclark / map.js
Created Oct 29, 2013
little code review
View map.js
function onEachFeature(feature, layer) {
/* From the perspective of reading this function, it would be easier if you think about it in a linear fashion
What does this function do?
1) get a single feature
2) parse some specific properties out of the feature
3) use those properties to generate a string of HTML
4) build a popup from that HTML
Right now its a little hard to read because you're jumping around between those steps a bit
*/
@rclark
rclark / color-map.csv
Created Oct 25, 2013
Grand Canyon Units
View color-map.csv
unit colors
Cba #ffebeb,#99b380
Cm #ebebcc,#ffccde
Ct #ffb3cc,#ccde66
Dtb #664dff
H20 #ebffff
IPMs #99ebde
Jc #ccffde
Je #cccc00
Jk #99de99
View node-mapnik-isntall.sh
WeeSofty:tm2 r$ npm install mapnik
npm WARN package.json dirty@0.9.7 No repository field.
npm WARN package.json tilejson@0.3.4 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm http GET https://registry.npmjs.org/mapnik
npm http 304 https://registry.npmjs.org/mapnik
npm http GET https://registry.npmjs.org/mapnik-vector-tile
npm http 304 https://registry.npmjs.org/mapnik-vector-tile
> mapnik-vector-tile@0.3.2 install /Users/r/gh/mapbox/tm2/node_modules/mapnik/node_modules/mapnik-vector-tile
@rclark
rclark / index.html
Last active Dec 25, 2015
Streaming EQ data
View index.html
<!doctype html>
<html>
<head>
<title>Streaming GeoJSON</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<style type="text/css">html, body, #map { height: 100%; width: 100%; margin: 0px; }</style>
@rclark
rclark / index.html
Last active Dec 25, 2015
Hover interactions
View index.html
<!doctype html>
<html>
<head>
<title>grid-interaction</title>
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.6.0/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.6.0/mapbox.css' rel='stylesheet' />
<style>
html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
</head>
@rclark
rclark / Issues.md
Last active Nov 12, 2019
Leaflet WMS + GetFeatureInfo
View Issues.md

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
You can’t perform that action at this time.