Skip to content

Instantly share code, notes, and snippets.

View mapmeld's full-sized avatar

Nick Doiron mapmeld

  • Chicago, IL
View GitHub Profile
@mapmeld
mapmeld / scraper-1
Created April 10, 2012 03:20
Scraping County GIS
get '/parcel' do
url = 'http://gis.co.bibb.ga.us/freeance/Server/Dzeims3.php'
url = URI.parse(url)
headers = {
"Accept" => "*/*",
"Accept-Charset" => "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
"Accept-Encoding" => "gzip,deflate,sdch",
"Accept-Language" => "en-US,en;q=0.8",
"Connection" => "keep-alive",
"Content-Length" => "409",
@mapmeld
mapmeld / fieldpapers-bookmarklet.js
Created April 19, 2012 06:04
Red Pen: experimental auto-marker for FieldPapers.org
/*
Red Pen turns red (and blue!) dots on Field Papers tiles into markers automatically
Tested with Sharpie and PaperMate ballpoint pens
Write a description to save the marker
I don't understand the server-side installation or the QR-scanning, so I'm using a bookmarklet
Client-side HTML5 Canvas for tile inspection
*/
// collect the most zoomed-in tiles from the scan
var zoomimgs = document.getElementsByTagName("img");
@mapmeld
mapmeld / CalGOLD-SC.rb
Created April 30, 2012 22:50
CalGOLD Search for Santa Cruz
get '/calgold' do
if params["kywd"] == "search"
return "<!DOCTYPE html>\n<html>\n<head>\n<link href='/bootstrap-mini.css' rel='stylesheet' type='text/css'/></head>\n<body>\n<div class='well'><h3>What is your business type?</h3>\n<form action='/calgold' method='get'><input name='kywd' value='' placeholder='Category'/><input type='submit' class='btn btn-info' value='Search' style='vertical-align:top;'/></form><br/><h4>Examples</h4><i>shoe store</i><br/><i>restaurant</i><br/><i>bowling alley</i><br/>or try <i>general business information</i><br/><a href='http://calgold.ca.gov/Default.asp?VW=OUT&TOP=N&KYWD=' target='_blank'>All Business Types</a></div>\n</body>\n</html>"
end
postparams = {"kywd" => params["kywd"], "VW" => "OUT"}
catquest = Net::HTTP.post_form(URI.parse('http://www.calgold.ca.gov/Default.asp?VW=OUT'), postparams)
categories = catquest.body.split("<input type='CHECKBOX'")
index = 0
linkout = ""
categories.each do |category|
@mapmeld
mapmeld / OpenBlock_EsriMap.html
Created May 3, 2012 02:19
OpenBlock with Esri Map
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style type="text/css">@media print { .gmnoprint { display:none }}@media screen { .gmnoscreen { display:none }}</style>
<title>Bibb County | OpenBlock Test</title>
<meta name="robots" content="noarchive">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<link rel="home" title="Home" href="http://demo.openblockproject.org/">
@mapmeld
mapmeld / parking-app-hnl.html
Created May 17, 2012 17:56
Parking App using HNL data, Esri maps
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"
/>
<title>Parcel Locator</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/esri/dijit/css/Popup.css">
@mapmeld
mapmeld / xyzwms.rb
Created June 10, 2012 21:06
XYZ tile to WMS
get '/countymap/:z/:x/:y' do
x = params[:x].to_i
y = params[:y].to_i
z = params[:z].to_i
maxExtent = {
"left" => -20037508.34,
"right" => 20037508.34,
"top" => 20037508.34,
"bottom" => -20037508.34
}
@mapmeld
mapmeld / buswrite.py
Created June 10, 2012 21:59
MTA Bus Mapper
from datetime import datetime, timedelta
m31 = open('June 1.csv','r')
buses = { }
def zap(content):
return content.replace('\x00','').replace('\r\n','')
firstline = 1
minutebyminute = timedelta(minutes=1)
@mapmeld
mapmeld / BusTimeTabler.py
Created June 17, 2012 12:28
BusTimeTabler
# Bus TimeTabler
# Imports CSV of Bus GPS points and KML of Bus Stops along a route.
# Helps create a complete timetable by recording when selected vehicles on this route approach the stop
import datetime
# import a day's worth of bus tracks
bustrackfile = open('May 30.csv', 'r')
bustrack = [ ]
for line in bustrackfile:
@mapmeld
mapmeld / signage.js
Created June 23, 2012 17:06
Macon-Bibb Sign Regulations
zonePermissions = [
{
zoneNames: [ "RR", "R-1AAA", "R-1AAAA", "R-1AA", "R-1A", "R-1", "MHR" ],
categories: [
{
name: "Single-family residential",
locations: [ "Freestanding", "Wall" ],
maxsigns: 1,
maxfreestanding: 1,
maxsize: 2,
@mapmeld
mapmeld / BusTimeTabler4.py
Created June 24, 2012 01:19
BusTimeTabler-Saturday
# Bus TimeTabler with Saturday routes
import datetime
# import a day's worth of bus tracks
bustrackfile = open('Jun 2.csv', 'r')
bustrack = [ ]
for line in bustrackfile:
bustrack.append(line)
bustrackfile.close()