An overview of mapping and location based applications
James Milner
@JamesLMilner
Software Developer
A bit about me....
- Studied a Masters at UCL
- Went on to be a developer evangelist at Esri UK
- Started working for the Ordnance Survey just over a year ago
- I am leaving next month to work for a startup!
- UKs National Mapping Agency
- Formed in 1791
- Granular, current mapping data for the UK
- 500+ million geographical features in our database
Geovation
Purpose
- Bit of history about the geo industry
- Overview of geo technology
- Libraries and frameworks for handling geo data
I'll start with a story time
Jon Snow was one of the first people to analyse geo data to solve a problem
Over time this field was formalised into an subject entitled 'Geographic Information Science/Systems' (GIS)
GIS are systems for organising, storing, retrieving, editing and analyzing spatial data
Wrangling spatial data can have many outputs, but the most common is maps
But, we can also do other things with data other than plot it
GIS is often considered to have formalised in the 1960s/1970s with the advent of modern computing
New Tools
Mobile and sub 100m positioning
Source: Andreessen Horowitz, 2015
We can approximate that about 70% of smartphone devices have a GPS chip
Lots of startups have embraced spatial data
Embracing Services and APIs
The Geospatial Stack
Firstly, Data Formats
- Shapefile
- GeoJSON
- KML
- GML
- CSV (points!)
All parts of the architecture will need to be spatially capable
Spatial Architectures
Lets start at the backend
Understanding Spatial Web Services
- Maps
- Geocoding
- Reverse Geocoding
- Routing (A to B, Travelling Salesman etc)
- Points of Interest
- Boundaries
Services
Roll Your Own
- Bring your own data
- Maintain your own infrastructure
- More granular control
- Requires knowhow
- Pay for infrastructure and dev time
- Generally has content
- Generally just use simple web interfaces (i.e. REST)
- Docs may vary
- Pay per request or annual/monthly fee
Spatial Web Services
Spatial Databases
SELECT ST_Intersection(s.geom, r.geom), s.state, r.river
FROM usa_states as s, usa_rivers as r
WHERE s.state = 'Texas'
Spatial databases leverage spatial indexes
How might a spatial service look under the hood?
What about the frontend?
Open Source Web Mapping Libraries
Fast, small, consistent API, good docs
Comprehensive, powerful, longstanding
Niche, more oriented around 'data viz' community
// Create map in our page, with a div with an id of mapid
var mymap = L.map('mapid').setView([51.505, -0.09], 13);
// Add a basemap
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png', {
attribution: "Insert mapbox attribution here"
maxZoom: 18,
id: 'your.mapbox.project.id',
accessToken: 'your.mapbox.public.access.token'
}).addTo(mymap);
// Example of adding a marker
var marker = L.marker([51.5, -0.09]).addTo(mymap);
// Example of some events
function onMapClick(e) {
alert("You clicked the map at " + e.latlng);
}
mymap.on('click', onMapClick);
A more complex Leaflet example
Closed Source Web Mapping Libraries
Well known, lots of questions online, hard to understand T&Cs
Comprehensive, powerful, hard to understand T&Cs
What if I just want to do stuff on my machine?
Local Tools
- Shapely
- Fiona
- GeoPy
- Ogr/GDLA Bindings
- PyQGIS
- ArcPy (closed)
Questions?
An overview of mapping and location based applications
By James Milner
An overview of mapping and location based applications
For GitHub Campus Experts
- 1,380