2012 http://blog.adamfast.com/ Saturday, October 27, 12 Mostly a pep talk If you want to build a ship, don’t find people and assign them work - teach them to long for the sea. - Antoine de Saint Exupery Video from tutorial My blog
/ Google Maps • “experts” • ESRI / governments / architects • GIS day November 14 - check it out • Ft. Smith / Memphis / Lawrence and others Saturday, October 27, 12
http://www.cessna.com/single-engine/skyhawk/skyhawk-gallery.html Saturday, October 27, 12 Modern light aircraft are PACKED with GIS This is what attracted me to the field - I wanted to DIY my own Then the iPad happened, and while I have open sourced the core libraries, I never did display of data
(city/county/state) Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
(city/county/state) • data.gov Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
(city/county/state) • data.gov • GeoNames Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
(city/county/state) • data.gov • GeoNames • SimpleGeo Places JSON Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
(city/county/state) • data.gov • GeoNames • SimpleGeo Places JSON • http://s3.amazonaws.com/simplegeo-public/places_dump_20110628.zip Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
(city/county/state) • data.gov • GeoNames • SimpleGeo Places JSON • http://s3.amazonaws.com/simplegeo-public/places_dump_20110628.zip • Google for it Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
(city/county/state) • data.gov • GeoNames • SimpleGeo Places JSON • http://s3.amazonaws.com/simplegeo-public/places_dump_20110628.zip • Google for it • User generated Saturday, October 27, 12 TIGER/LINE - gathering this data is their job SimpleGeo shut down, you can find an API from factual.com or download the JSON uscampgrounds
Logging Saturday, October 27, 12 Be careful with usage of information you geocode Hardware loggers used by OSM, commonly available, or use a smartphone / tablet
Logging • Hardware / software Saturday, October 27, 12 Be careful with usage of information you geocode Hardware loggers used by OSM, commonly available, or use a smartphone / tablet
Logging • Hardware / software • GeoIP Saturday, October 27, 12 Be careful with usage of information you geocode Hardware loggers used by OSM, commonly available, or use a smartphone / tablet
Logging • Hardware / software • GeoIP • Manual entry Saturday, October 27, 12 Be careful with usage of information you geocode Hardware loggers used by OSM, commonly available, or use a smartphone / tablet
Logging • Hardware / software • GeoIP • Manual entry • HTML5 geolocation Saturday, October 27, 12 Be careful with usage of information you geocode Hardware loggers used by OSM, commonly available, or use a smartphone / tablet
Logging • Hardware / software • GeoIP • Manual entry • HTML5 geolocation • Provided latitude / longitude Saturday, October 27, 12 Be careful with usage of information you geocode Hardware loggers used by OSM, commonly available, or use a smartphone / tablet
new QueryData(); if ('lat' in getData) { } else { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function (ppos) { window.location.href = window.location.href + '?lat=' + ppos.coords.latitude + '&lon=' + ppos.coords.longitude; }, function (err) { switch(err.code) { case err.TIMEOUT: alert('Attempts to retrieve location timed out.') break; case err.POSITION_UNAVAILABLE: alert("Your browser doesn't know where you are.") break; case err.PERMISSION_DENIED: alert('You have to give us permission!') break; case err.UNKNOWN_ERROR: alert('Unknown error returned.') break; default: alert(err + ' ' + err.code) } } ); } } } </script> Saturday, October 27, 12 HTML5 geolocation - bounces you back to the URL with parameters WATCH OUT - will be FAR more precise than your GPS is. Remember significant figures
problems because my cache didn’t hit http://localhost:8000/campgrounds/?lat=38.9591749&lon=-95.32675689999999 Saturday, October 27, 12 block ins’t a formal unit 2 digits ~0.69 miles, 3 digits ~360ft, 4 digits ~36ft, 5 digits ~3.6ft
problems because my cache didn’t hit • This much precision (14 decimal places) is 1.1 nanometers, your computer CPU is likely a 32 nanometers process. Human hair 40,000 nanometers. http://localhost:8000/campgrounds/?lat=38.9591749&lon=-95.32675689999999 Saturday, October 27, 12 block ins’t a formal unit 2 digits ~0.69 miles, 3 digits ~360ft, 4 digits ~36ft, 5 digits ~3.6ft
problems because my cache didn’t hit • This much precision (14 decimal places) is 1.1 nanometers, your computer CPU is likely a 32 nanometers process. Human hair 40,000 nanometers. • Remember significant figures - GPS will barely give 1m http://localhost:8000/campgrounds/?lat=38.9591749&lon=-95.32675689999999 Saturday, October 27, 12 block ins’t a formal unit 2 digits ~0.69 miles, 3 digits ~360ft, 4 digits ~36ft, 5 digits ~3.6ft
67 deg W to 124 deg W Saturday, October 27, 12 This method includes 20 degrees (the height of the midwest) of results for a 20 mile query Then it uses Python to calculate a more accurate measurement and exclude as necessary
sense?” • Debug in Google Earth - slow, but good to visualize • Pre-filtering is the right idea • I would use GeoPy when calculating distances Saturday, October 27, 12
sense?” • Debug in Google Earth - slow, but good to visualize • Pre-filtering is the right idea • I would use GeoPy when calculating distances • It is BSD. Attribute / acknowledge and bundle. Saturday, October 27, 12
little variance here. a degree is approximately 69.172 miles def longitude_degrees(latitude, miles): return miles / (math.cos(math.radians(latitude)) * 69.172) # dist is cosine of the latitude mult by length of latitude def basic_bounding_box(center_lat, center_lon, radius_mi, wiggle_room=None): if wiggle_room is not None: radius_mi = radius_mi + wiggle_room off_center = radius_mi / 2 # since the center is the center, we only add 1/2 the range to each end start_lat = center_lat - latitude_degrees(off_center) end_lat = center_lat + latitude_degrees(off_center) start_lon = center_lon - longitude_degrees(center_lat, off_center) end_lon = center_lon + longitude_degrees(center_lat, off_center) return ( (start_lat, start_lon), (end_lat, end_lon), ) Saturday, October 27, 12 not going too deeply into this
There is a “hidden” Google Maps generator in GeoDjango, but it’s API v2 http://blog.adamfast.com/2011/11/on-the-map/ http://blog.adamfast.com/2011/11/mapping-better-google-maps-api-v3/ http://blog.adamfast.com/2011/11/polygons-and-overlays-with-google-maps-v3-api/ Saturday, October 27, 12
There is a “hidden” Google Maps generator in GeoDjango, but it’s API v2 • You’ll spend a LOT more time reading source code than you would doing a Google Maps v3 template http://blog.adamfast.com/2011/11/on-the-map/ http://blog.adamfast.com/2011/11/mapping-better-google-maps-api-v3/ http://blog.adamfast.com/2011/11/polygons-and-overlays-with-google-maps-v3-api/ Saturday, October 27, 12