Skip to content

Instantly share code, notes, and snippets.

View calvinmetcalf's full-sized avatar

Calvin Metcalf calvinmetcalf

View GitHub Profile
@calvinmetcalf
calvinmetcalf / mbtiles.js
Created February 1, 2012 16:48
mbtiles
var app = require('express').createServer(),
mbtiles = require('mbtiles'),
tilelive = new (require('tilelive').Server)(mbtiles);
app.get('/:z/:x/:y.*', function(req, res) {
var options = {
x: req.param('x'),
y: req.param('y'),
z: req.param('z'),
format: req.params[0],
@calvinmetcalf
calvinmetcalf / esri2geo.js
Created July 13, 2012 14:08
script for turning esri json into geojson
function toGeoJSON(data){
var outPut = { "type": "FeatureCollection",
"features": []};
var fl = data.features.length;
var i = 0;
while(fl>i){
var ft = data.features[i];
/* as only ESRI based products care if all the features are the same type of geometry, check for geometry type at a feature level*/
var outFT = {
"type": "Feature",
@calvinmetcalf
calvinmetcalf / README.md
Created July 16, 2012 14:36
json demo with leaflet

Leaflet with json

the html is fairly basic boilerplate for a full screen map, but the JavaScript file includes the data as well as the code to display it, in production we'd probably want to serve that as jsonp. This can be entirely self hosted internally, except the tiles which are hosted by mapquest in this example and we'd have to render our own tiles if we wanted to host them.

@calvinmetcalf
calvinmetcalf / README.md
Created July 20, 2012 11:50
Using ESRI JSON in Leaflet

Basic example of taking an output from our server and putting it on a map. As leaflet allows you to add geoJSON directly, we convert it from esri's JSON format to a more standard one.

@calvinmetcalf
calvinmetcalf / README.md
Created July 20, 2012 13:38
chrome weirdness

large geojson dataset mapped using geojquery, in chrome, but weirdly enough, not in IE9 the overlay doesn't quite keep up with the map when it pans.

@calvinmetcalf
calvinmetcalf / README.md
Created July 20, 2012 15:22
bbox queries for large data sets

this is like the other example but since it has a larger dataset we start zoomed in farther, and reload the data every time the viewpoint changes instead of loading all of it when the map loads.

@calvinmetcalf
calvinmetcalf / readme.md
Created November 17, 2012 05:00
battle of the frameworks

design the new avid geo site in your framework of choice, can your rails beat the (Java|Coffee)script of the node hipsters? and what about all that smack talk I hear between the Django and Flask kids? bonus points for

  • Obscurity: CoffeeScript would get more points then JavaScript, Coco would get even more, but the framework you wrote that compiles Haskell to lolcode would win.
  • Hipsterocity: this is probably going to mean your going to need to involve mustaches
  • Overengineering: why use something as passe as nosql to store comments when you can write an Octree based storage engine where nodes communicate over a distributed hash table, or how about storing post tags as edges on a [hypergraph](http://en.wikipedia.org/wiki/Hyperg
@calvinmetcalf
calvinmetcalf / README.md
Created November 19, 2012 15:23
0 opacity lines

points show up for 0 opacity lines

with 0 opacity lines there seems to be point features that show up at lower zooms but go away when you zoom in

So your most likely going to be iterating through an array or an object, we'll start with an array;

var array = [1,2,3,4,5]; //your array

for(var i = 0; i<array.lengh; i++){
    doStuff(array[i]);
}

the only issue with that is that you are checking the length of the array every time, so instead you could do

@calvinmetcalf
calvinmetcalf / streetType.json
Created December 6, 2012 20:42
street types
{
"types":[
"ABBOTTSWOOD",
"ACCESS",
"ACRES",
"AFIELD",
"ALLEY",
"ANNEX",
"APPROACH",
"ARBORWAY",