Skip to content

Instantly share code, notes, and snippets.

View pdbartsch's full-sized avatar

Paul Bartsch pdbartsch

  • UC Santa Barbara
  • 93455
View GitHub Profile
@pdbartsch
pdbartsch / gist:2482241
Created April 24, 2012 18:15
TileMill Icons based on type field and zoom level
#activitiesgeojson {
[zoom >= 0][zoom <=10] {
[type = "bike"] {point-file: url(icons/mountainbiking-2.png); }
[type = "hike"] {point-file: url(icons/hiking-2.png); }
}
[zoom = 11] {
[type = "bike"] {point-file: url(icons/mountainbiking-1.png); }
[type = "hike"] {point-file: url(icons/hiking-1.png); }
}
[zoom > 11][zoom <=14] {
@pdbartsch
pdbartsch / gist:2482197
Created April 24, 2012 18:11
TileMill Icons in Legend
<div class='my-legend'>
<div class='title'>Activity Type<br></div>
<div class='scale'>
<ul class='labels'>
<li><img src="https://s3.amazonaws.com/pdb.www/hiking-3.png" />Hiking</li>
<li><img src="https://s3.amazonaws.com/pdb.www/mountainbiking-3.png" />Biking</li>
</ul>
</div>
</div>
@pdbartsch
pdbartsch / gist:5032363
Last active December 14, 2015 04:59
Overpass export from OpenStreetMap (not working yet)
wget -O buildingSchool.osm http://overpass.osm.rambler.ru/cgi/xapi?node[building=school][bbox=-120.722519,34.288326,-119.405861,35.133329][@meta]
wget -O buildingUniversity.osm http://overpass.osm.rambler.ru/cgi/xapi?node[building=university][bbox=-120.722519,34.288326,-119.405861,35.133329][@meta]
wget -O amenitySchool.osm http://overpass.osm.rambler.ru/cgi/xapi?node[amenity=school][bbox=-120.722519,34.288326,-119.405861,35.133329][@meta]
wget -O amenityUniversity.osm http://overpass.osm.rambler.ru/cgi/xapi?node[amenity=university][bbox=-120.722519,34.288326,-119.405861,35.133329][@meta]
wget -O UCSB_hydrants.osm http://overpass.osm.rambler.ru/cgi/xapi?node[emergency=fire_hydrant][bbox=-119.8908,34.3994,-119.8333,34.4283][@meta]
@pdbartsch
pdbartsch / gist:5043561
Created February 27, 2013 00:01
OpenStreetMap Overpass export example
wget -O UCSB_hydrants.osm http://overpass.osm.rambler.ru/cgi/xapi?node[emergency=fire_hydrant][bbox=-119.8908,34.3994,-119.8333,34.4283][@meta]
@pdbartsch
pdbartsch / gist:5258017
Last active December 15, 2015 12:09
Grab data from OpenStreetMap . Some specific examples that I reuse.
#key = building
wget -O goleta_buildings.osm http://overpass.osm.rambler.ru/cgi/xapi?way[building=yes][bbox=-119.919272,34.401164,-119.802431,34.44535][@meta]
#grabs points
#amenity = school
wget -O SBco_schools.osm http://overpass.osm.rambler.ru/cgi/xapi?node[amenity=school][bbox=-120.701335,34.369261,-119.418620,35.176881][@meta]
#grabs lines and points
#building = school
@pdbartsch
pdbartsch / gist:5259037
Last active December 15, 2015 12:19
My most commonly used bounding boxes.
Santa Barbara County: [bbox=-120.701335,34.369261,-119.418620,35.176881]
UC Santa Barbara: [bbox=-119.8908,34.3994,-119.8333,34.4283]
Goleta: [bbox=-119.919272,34.401164,-119.802431,34.44535]
@pdbartsch
pdbartsch / query.sql
Last active December 16, 2015 08:29
Searching gis.stackexchange for users local to me http://data.stackexchange.com/gis/query/108984/users-in-california
-- users in California
-- with a reputation > 1
-- that have accessed site in past year
SELECT
ROW_NUMBER() OVER(ORDER BY Reputation DESC) AS [#],
Id AS [User Link],
Reputation,
Location,
LastAccessDate,
@pdbartsch
pdbartsch / gist:5407740
Last active December 16, 2015 08:39
Twitter geolocation searches cheat sheet
-- search twitter for any tweets mentioning #gis within 100 miles of Figueroa Mountain Brewery
#gis geocode:34.609423,-120.202115,100mi
-- happening within a mile of my UCSB office
geocode:34.42028,-119.85260,1mi
@pdbartsch
pdbartsch / DataScienceToolkitOpenRefineTutorial
Last active December 20, 2015 00:09
Using the Data Science Toolkit with OpenRefine to make your data more interesting. Geocode. Coordinates to statistics.
##Data Science Toolkit & OpenRefine Tutorial
1. Download, Setup, and start up [OpenRefine][OpenRefine]
2. Get some data. I recommend starting with a small dataset. I'll be using [this sample data][sampledata]. Extract the zip file. You now have 500.csv.
3. Load the data into OpenRefine by clicking 'Create Project' and then 'Choose Files', navigate to 500.csv. Then click 'Next', stay with the defaults and then 'Create Project'.
4. We'll first need to concatenate the address data down into a single field. Click the dropdown arrow at the top of the existing 'Address' field, then select 'Edit column' > 'Add column based on this column'.
* Enter a name for your new column. I'll go with 'AddressCombined' in the 'New column name' box
@pdbartsch
pdbartsch / map.geojson
Last active December 21, 2015 13:29
MTB Locations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.