This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w{rubygems flickraw yaml}.each {|gem| require gem} | |
options = {:per_page => 100, :tags => "baytobreakers", :woe_id => 2487956, :min_taken_date => "2007-05-20", :max_taken_date => "2007-05-21"} | |
list = flickr.photos.search({:page => 1}.merge(options)) | |
puts list.pages | |
kml = %Q{<?xml version="1.0" encoding="UTF-8"?> | |
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> | |
<Document> | |
<name>Bay to Breakers</name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct coloriser | |
{ | |
explicit coloriser(mapnik::Color const& c) | |
: c_(c) {} | |
template <typename PixelType> | |
void operator() ( PixelType & p) | |
{ | |
// use c to modify p | |
p[0] = c_.red(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prj = Projection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over") | |
c0 = prj.forward(Coord(ll[0],ll[1])) | |
c1 = prj.forward(Coord(ll[2],ll[3])) | |
bbox = Envelope(c0.x,c0.y,c1.x,c1.y) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
tag = "ASD" | |
### Don't need to edit below here | |
%w{ rubygems hpricot open-uri }.each {|gem| require gem} | |
next_url = "http://search.twitter.com/search.atom?tag=#{tag}&lang=all&rpp=50" | |
fields = ["id","title", "published","author/name","author/uri"] | |
entries = [fields.join(",") + ",link"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE Map> | |
<Map bgcolor="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over"> | |
<FontSet name="DejaVu Sans Book"> | |
<Font face_name="DejaVu Sans Book" /> | |
<Font face_name="unifont Medium" /> | |
</FontSet> | |
<FontSet name="DejaVu Sans Oblique"> | |
<Font face_name="DejaVu Sans Oblique" /> | |
<Font face_name="unifont Medium" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zipMarkers = { | |
93536 => {'zipcode' => 93536, 'name' => 'Lancaster/Quartz Hill', 'number of installations' => '17', 'size' => '77.406', 'cost' => '670991.4', 'incentives' => '187572.39', 'lat' => 34.77131, 'lng' => -118.47496}, | |
93534 => {'zipcode' => 93534, 'name' => 'Lancaster', 'number of installations' => '3', 'size' => '15.176', 'cost' => '149260', 'incentives' => '37486.56', 'lat' => 34.73728, 'lng' => -118.15001}, | |
93523 => {'zipcode' => 93523, 'name' => 'Edwards AFB', 'number of installations' => '1', 'size' => '2.075', 'cost' => '21000', 'incentives' => '4563', 'lat' => 34.80315, 'lng' => -117.95937}, | |
93535 => {'zipcode' => 93535, 'name' => 'Hi Vista', 'number of installations' => '9', 'size' => '42.582', 'cost' => '381678.07', 'incentives' => '98170.06', 'lat' => 34.69016, 'lng' => -117.88353}, | |
91384 => {'zipcode' => 91384, 'name' => 'Castaic', 'number of installations' => '13', 'size' => '80.314', 'cost' => '737545.1', 'incentives' => '188829.17', 'lat' => 34.53395, 'lng' => -118.67296}, | |
9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Download the GeoNames gazetteer | |
curl -O -G http://earth-info.nga.mil/gns/html/geonames_dd_dms_date_20090428.zip | |
unzip geonames_dd_dms_date_20090428.zip | |
# Remove all the non-English placenames | |
awk -F '\t' '/ADM|PPL/ {if($20 == "") print $0}' geonames_dd_dms_date_20090428.txt | sed "s/'//g" > geonames_ppl.txt | |
echo "DELETE FROM planet_osm_point WHERE osm_id=1;INSERT INTO planet_osm_point (osm_id,name,place,way) VALUES " > geonames_ppl.sql | |
# Generate SQL statements into an OSM database |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open Data | |
Use the current initiatives in the governments opening up data. | |
h1. Overview | |
What do you do with data? | |
* Visualize | |
* Analyze | |
* Links |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# description: given a KML file or URL this script caches all the remote files to a local directory and creates a KMZ (zipped KML) | |
# usage: cache_kml.rb "http://maps.nanaimo.ca/data/property/109332.kml" | |
%w{ rubygems open-uri uri }.each {|gem| require gem} | |
kml = ARGV[0] | |
filename = URI.parse(kml).path.split("/").last | |
dir = filename.gsub(/\.\w+/,'') | |
file = open(kml).read |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Link to URL datasource | |
Finder can register data source URL's from the internet or a network. This allows users to define data sources that will be continually updated, aggregated and archived in GeoCommons. | |
To register a datasource, provide the URL to a file type that is supported in GeoCommons and POST using the overlay[wild_url] parameter to /overlays.xml. | |
curl -i -X POST -u "yourusername:yourpassword" -d "overlay[wild_url]=http://earthquake.usgs.gov/eqcenter/catalogs/1day-M2.5.xml" http://finder.geocommons.com/overlays.xml | |
URL's can only be registered once in GeoCommons. So if the URL has already been registered by a user, you will receive a redirect to this existing Overlay. You can make a copy of that overlay if you want to modify the metadata. |
OlderNewer