Where 2.0 Mapping Hacks Tutorial 1 Andrew Turner FortiusOne [email protected]Rabble ENTP [email protected]Welcome to Mapping the Mapping Hacks with Google, Yahoo, Open Street Map, and fellow travelers. I’m Rabble, i like to cause trouble, and think maps are fun. I don’t do this for a living. I’m Andrew, i like to build maps and i do do this for a living.
Tutorials on Hacking Map API's, OpenData formats, Mapstraction and more given at Where2.0 2009.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
This tutorial is divided up in to two parts. First half is the building and display of maps. Then we’ll have a break, and the second half will be about the data of maps.
How to build maps, and put them on the web. The scope of this tutorial is limited to web mapping.
Building Data
The second half of the workshop is how to get and manipulate mapping data. There’s a huge amount of geodata out there, the trick is getting it in to useful formats.
Building Data == Later == Part II
But that’s for the second half, after the break. Before we can get there, we need to be able to see it.
Building Maps On Other People’s API’s
It’s possible to use pure open source data and software to do mapping. For the more advanced examples we will use these tools. But the vast majority of mapping hacks today are built upon google maps, so we will start by walking through how to build on top of and extend google maps.
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
First, some terminology to help
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
First, some terminology to help
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
First, some terminology to help
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
First, some terminology to help
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
First, some terminology to help
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
<element attribute="value"> content</element>
First, some terminology to help
Terminology
•Vector
•Raster
•Feature
•Attributes
•XML
•REST
•Proprietary - Open
<element attribute="value"> content</element>
http://host/resource.format
First, some terminology to help
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Terminology: Geometries
• Point
• LineString
• Box
• Polygon
• MultiGeometry
• Coordinate Reference System (aka Projection)
Even with “location” there are several important types of geometries that are common. Almost all the formats we’ll talk about support all these geometry types. So we’ll show some examples, but assume you’ll need to know what’s appropriate, but that it’s probably supported.
Longitude is the X
Longitude
Latit
ude
[x,y]
Longitude is the XLa
titud
e
Longitude [x,y]
Google Maps
Web mapping has been around for a long time, but it was really the advent of google maps which got the masses hacking on web maps.
Mapstraction
Beyond our first demos we’ll get in to how to use the mapstraction library. It lets you easily move between mapping apis, it’s open source, and works with many data sources.
Mapstraction
OpenLayers
Then we’re going to end with some examples built in OpenLayers which give you the most flexibility in your map hacking.
Start Simple
Mapstraction Recipe
1.Include Javascripts
2.Create an HTML Map Div
3.Create a JavaScript Mapstraction object
4.Center the Map
5.Add Controls
6.Add Features - Markers, Polylines, Overlays, etc.
Hacking with Google, Virtual Earth and Yahoo's Maps API II
Data
Why does open, interoperable data matter?
We just went over how you can create markers with javascript, from a database. Why would you bother spending time and resources working with formats that man mean other people can use your data?
http
://w
ww
.flic
kr.c
om/p
hoto
s/bl
ah_o
h_w
ell/3
5220
3022
It’s not enough for a Web App to be Sticky...
Common design principles want to make a website “sticky”. To encourage users to stay at the site and return often.
But this is no longer sufficient - users want more.
Web applications need to be “Stringy” - they need to provide ways for users to move their data into, and out of the system. It needs to connect into the rest of their personal and corporate suite of tools, workflows, and expectations.
Traction is good - but won’t I be the only one doing this? How will it get you business?
phot
o cr
edits
.gov
let’s look at an actual use case for why this is important
phot
o cr
edits
.gov
phot
o cr
edits
Recovery.gov
Recovery.gov is a very new, and quickly conceived and implemented initiative to track all the stimulus dollars: from tax payer, to gov’t, to agency, to project, to tax payer.
phot
o cr
edits
A Chance for Change http://isd.ischool.berkeley.edu/stimulus/2009-029/
Given the new administration support for new initiatives and Transparency, it’s a chance for agencies, and citizens, to engage in rethinking how it’s all done.
They’re talking about GeoRSS AtomPub, KML, Linked Open Data, RDFa. All the hot topics on data sharing - the point of this workshop.
The UC Berkeley iSchool has published papers, example websites, and example feeds about how it *could* be done.
phot
o cr
edits
Data.gov
And it’s just the beginning. Data.gov will incorporate these ideas across the federal, and subsequently local, governments. This will be they ways in which information is spread in the US Government.
International Open Data
And it’s not just the US government, it also applies internationally to directives such as INSPIRE which is working in the EU to open data.
THEREFORE BE IT RESOLVED THAT the City of Vancouver endorses the principles of:•Open and Accessible Data - the City of
Vancouver will freely share with citizens, businesses and other jurisdictions the greatest amount of data possible while respecting privacy and security concerns;
•Open Standards - the City of Vancouver will move as quickly as possible to adopt prevailing open standards for data, documents, maps, and other formats of media;
motion, May 15, 2009Governments are enforcing data standards.
This is a big win from getting data for your system, as well as providing them technology that works within their ecosystem.
http
://w
ww
.flic
kr.c
om/p
hoto
s/bi
tter
lysw
eet/
3335
8201
Why is it so hard?
So if everyone is clamoring over open, sharable data - why has it been so hard?
"name","holepar","holeyardage","holenumber","address""Simple placemark","4.0","234.0","1.0","1517 N. Main St., Royal Oak, MI""Simple placemark 2","3.0","100.0","2.0","2200 Wilson Blvd., Arlington, VA"
can embed Lat,lon as columns - or WKB (well known binary) string
KML emerged as a commonly used format for sharing data. It meets the 80% case for geographic information, human-readable information, metadata, attributes, temporal, 3D, navigation and more. Surprisingly capable for a simple format.
KML
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.2"> <Placemark> <name>Simple placemark</name> <description>Attached to the ground. Intelligently places itself at the height of the underlying terrain.</description> <Point> <coordinates>-122.0822035425683,37.42228990140251,0</coordinates> </Point> </Placemark></kml>
Flickr photos can be exported using the GeoRSS (geoFeed) or KML links at the bottom of Flickr pages. This is useful for viewing in GoogleEarth.
KML Demo!
KMZ - Zipped KML
All the verbosity, 10% the size.
Cunning in the simplicity of assigning a Zip compression as an actual type. Makes it very easy to expose via RESTful services and mime-types.
Very useful when bundling multiple KML files and 3D models together.
Other Visualization Formats
•SLD - Styled Layer Descriptor
•Mapnik
•Cascadenik
SLD - an OGC specification. Uses bits of CSS and a lot of XMLMapnik - the mapnik map rendering library has it’s own styling XMLCascadenik - a CSS3-like map styling, with preprocesses for exporting to Mapnik styling
What tools will the user be using to consume or produce this information?
http
://w
ww
.flic
kr.c
om/p
hoto
s/sa
mik
sha/
4069
2844
0
What does the user understand?
What terms do they understand?
KML has done very well because people know what “GoogleEarth” is and means. They may have an “RSS Reader”, but they probably don’t have “ArcGIS Desktop” or QGIS. They almost all have Excel to read CSV.
KML has done very well because people know what “GoogleEarth” is and means. They may have an “RSS Reader”, but they probably don’t have “ArcGIS Desktop” or QGIS. They almost all have Excel to read CSV.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Starting a Business in San Francisco map</title> <link type="application/opensearchdescription+xml" title="Mapufacture" rel="search" href="http://geocommons.com/search.xml" /> <link type="application/atom+xml"
title="Mapufacture GeoRSS Feed for Starting a Business in San Francisco"rel="alternate" href="http://geocommons.com/maps/1621.atom" />
<link type="application/vnd.google-earth.kml+xml" title="Mapufacture KML for Starting a Business in San Francisco"rel="alternate" href="http://geocommons.com/maps/1621.kml" />
</head><body>...</body></html>
If you provide a link in your HTML page to the OpenSearch - browsers like Firefox, Safari, and Internet Explorer can embed these into browser search bars.
Even MS Windows 7 can connect OpenSearch providers into your *desktop search* to the web.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Starting a Business in San Francisco map</title> <link type="application/opensearchdescription+xml" title="Mapufacture" rel="search" href="http://geocommons.com/search.xml" /> <link type="application/atom+xml"
title="Mapufacture GeoRSS Feed for Starting a Business in San Francisco"rel="alternate" href="http://geocommons.com/maps/1621.atom" />
<link type="application/vnd.google-earth.kml+xml" title="Mapufacture KML for Starting a Business in San Francisco"rel="alternate" href="http://geocommons.com/maps/1621.kml" />
</head><body>...</body></html>
If you provide a link in your HTML page to the OpenSearch - browsers like Firefox, Safari, and Internet Explorer can embed these into browser search bars.
Even MS Windows 7 can connect OpenSearch providers into your *desktop search* to the web.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Starting a Business in San Francisco map</title> <link type="application/opensearchdescription+xml" title="Mapufacture" rel="search" href="http://geocommons.com/search.xml" /> <link type="application/atom+xml"
title="Mapufacture GeoRSS Feed for Starting a Business in San Francisco"rel="alternate" href="http://geocommons.com/maps/1621.atom" />
<link type="application/vnd.google-earth.kml+xml" title="Mapufacture KML for Starting a Business in San Francisco"rel="alternate" href="http://geocommons.com/maps/1621.kml" />
</head><body>...</body></html>
If you provide a link in your HTML page to the OpenSearch - browsers like Firefox, Safari, and Internet Explorer can embed these into browser search bars.
Even MS Windows 7 can connect OpenSearch providers into your *desktop search* to the web.