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
rclark / TileLayer.Bing.js
Created Mar 11, 2012 — forked from pagameba/TileLayer.Bing.js
Leaflet Bing layer
View TileLayer.Bing.js
L.TileLayer.Bing = L.TileLayer.extend({
supportedTypes: ['Road', 'Aerial', 'AerialWithLabels'],
attributionTemplate: '<span style="display:inline-block">' +
'<a target="_blank" href="">' +
'<img src="{logo}" /></a><br><span>{copyrights}' +
'<a style="white-space: nowrap" target="_blank" '+
'href="">' +
'Terms of Use</a></span></span>',
rclark /
Created Dec 14, 2012
Convert Jade files to JavaScript functions
fs = require 'fs'
pathutil = require 'path'
jade = require 'jade'
parseFiles = (dirname) ->
filenames = fs.readdirSync dirname
for file in filenames
continue if file.slice(0,1) is '.'
path = pathutil.join dirname, file
stats = fs.statSync pathutil.join dirname, path
rclark /
Created Dec 21, 2012
Watch a directory of Jade files and write them out to JavaScript functions.
watch = require 'watch'
fs = require 'fs'
pathutil = require 'path'
jade = require 'jade'
watchDir = process.argv[2] || '.'
outFile = process.argv[3] || './templates.js'
namespace = process.argv[4] || 'Templates'
isJadeFile = (fileOrDir) ->
rclark / owslib-metadata-mapping.json
Last active Sep 18, 2019
Mapping from ISO19139XML to owslib.iso:MD_Metadata
View owslib-metadata-mapping.json
"identifier": "gmd:fileIdentifier/gco:CharacterString",
"parentidentifier": "gmd:parentIdentifier/gco:CharacterString",
"language": "gmd:language/gco:CharacterString",
"dataseturi": "gmd:dataSetURI/gco:CharacterString",
"languagecode": "gmd:language/gmd:LanguageCode",
"datestamp": "gmd:dateStamp/gco:Date or gmd:dateStamp/gco:DateTime",
"charset": "gmd:characterSet/gmd:MD_CharacterSetCode/@codeListValue",
"hierarchy": "gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue",
"contact": {
root = @
L.GeoJSON.d3 = L.GeoJSON.extend
initialize: (geojson, options) ->
@geojson = geojson # This needs to be a FeatureCollection
# unlike L.GeoJSON layer, this won't work unless GeoJSON is passed up-front
# Make sure there's an options object
options = options or {}
rclark / L.TopoJSON.js
Last active May 22, 2019
TopoJSON-aware Leaflet layer
View L.TopoJSON.js
You'll need something like this in your HTML:
<script src=""></script>
L.TopoJSON = L.GeoJSON.extend({
addData: function(jsonData) {
if (jsonData.type === "Topology") {
for (key in jsonData.objects) {
geojson = topojson.feature(jsonData, jsonData.objects[key]);
rclark / index.html
Last active Dec 18, 2015
TopoJSON was made for geologic maps.
View index.html
<!DOCTYPE html>
<html lang="en" style="height:100%; width:100%; padding:0; margin:0;">
<link rel="stylesheet" href="">
<body style="height:100%; width:100%; padding:0; margin:0;">
<div id="map" style="height:100%; width:100%; padding:0; margin:0;"></div>
<script src=""></script>
<script src=""></script>
<script src="style.js"></script>
rclark / L.TileLayer.GeoJSON.js
Last active Dec 18, 2015
Leaflet + Github-hosted vector-tiles
View L.TileLayer.GeoJSON.js
/* If you haven't included JSTS, it'll still work, but won't try and merge features
* across tile boundaries. You DO have to include:
* jQuery
var jsts = jsts || null;
L.Cache = L.GeoJSON.extend({
mergeData: function mergeData(geojson) {
rclark /
Last active Dec 19, 2015
CKAN + CSW code
from sqlalchemy import Column, Table, String, Text, Integer, types, ForeignKey
from sqlalchemy.orm import relationship
from ckan import model
from ckan.model import meta, Package
from shapely.geometry import asShape
import json
import logging
rclark / L.TileLayer.EsriImageExports.js
Last active Mar 12, 2018
Access dynamic ESRI service layers via "export"
View L.TileLayer.EsriImageExports.js
/* When creating a layer pass the ESRI Service's Export URL. e.g.:
L.TileLayer.EsriImageExports = L.TileLayer.WMS.extend({
getTileUrl: function (tilePoint) {
// Get the URL if this was just a WMS
var wmsUrl =, tilePoint),
base = wmsUrl.split("?")[0],
params = wmsUrl.split("?")[1].split("&");
You can’t perform that action at this time.