Skip to content

Instantly share code, notes, and snippets.

View rclark's full-sized avatar

Ryan Clark rclark

View GitHub Profile
@rclark
rclark / map.geojson
Created August 23, 2013 23:52
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"responseHeader": {
"status": 0,
"QTime": 2,
"params": {
"q": "Kentucky Geothermal References",
"wt": "json"
}
},
"response": {
@rclark
rclark / map.geojson
Created August 19, 2013 05:46
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rclark
rclark / map.geojson
Created August 19, 2013 05:49
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rclark
rclark / countries.geojson
Created August 15, 2013 21:37
Countries
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rclark
rclark / index.html
Created August 6, 2013 22:20
via:geojson.io
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
@rclark
rclark / parse-fema.js
Created August 1, 2013 00:32
Trying to mine data from FEMA National Flood Hazard Layer
var fs = require("fs"),
_ = require("underscore"),
request = require("request"),
baseUrl = "https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer/28",
outEsri = JSON.stringify({"displayFieldName":"DFIRM_ID","fieldAliases":{"FLD_ZONE":"FLD_ZONE","ZONE_SUBTY":"ZONE_SUBTY"},"fields":[{"name":"FLD_ZONE","type":"esriFieldTypeString","alias":"FLD_ZONE","length":17},{"name":"ZONE_SUBTY","type":"esriFieldTypeString","alias":"ZONE_SUBTY","length":57}]}),
outFile = fs.createWriteStream("fema-get-all-esri.json");
outFile.write(outEsri + ",features:[");
request(baseUrl + "?f=json", function (err, response, information) {
@rclark
rclark / error.log
Created July 31, 2013 17:23
Error running TileMill 2 on OSX
WeeSofty:tm2 ryan$ brew upgrade mapnik
Error: mapnik-2.2.0 already installed
WeeSofty:tm2 ryan$ brew upgrade protobuf
Error: protobuf-2.5.0 already installed
WeeSofty:tm2 ryan$ brew upgrade node
Error: node-0.10.15 already installed
WeeSofty:tm2 ryan$ node index.js
module.js:356
Module._extensions[extension](this, filename);
@rclark
rclark / failed-polygonize.js
Created July 28, 2013 20:35
Example of jsts.operation.polygonize not working on arbitrary "spaghetti" lines
var jsts = require("jsts"),
spaghetti = [
"LINESTRING(-108.6328125 32.54681317351517,-117.7734375 44.33956524809713,-91.0546875 50.51342652633956,-92.46093749999999 30.751277776257812)",
"LINESTRING(-120.58593749999999 25.48295117535531,-106.5234375 42.032974332441405,-78.046875 40.713955826286046)"
],
reader = new jsts.io.WKTReader(),
polygonizer = new jsts.operation.polygonize.Polygonizer(),
polygons, dangles, cutEdges, invalidRingLines;
spaghetti.forEach(function (line) {
@rclark
rclark / test_some_actions.py
Created July 17, 2013 23:57
Little action testing example
from ckanext.ngds.tests.ngds_test_case import NgdsTestCase
class MyActionTestCase(NgdsTestCase):
def test_gobbledee_action(self):
# Generate your POST body
post_body = {
"turkeys": 12,
"gobbles": ["gobble", "gobble"]
}