Everyone loves maps. An Introduction to GIS for Taunton Developers Meetup.
Me: Dave Rowe. Microsoft Developer, Open Data Geek with love of maps.
This is a very high level overview of map technologies.
Wikipedia: Geographic coordinate systems
A geographic coordinate system is a coordinate system that enables every location on the Earth to be specified by a set of numbers or letters, or symbols.[n 1] The coordinates are often chosen such that one of the numbers represents vertical position, and two or three of the numbers represent horizontal position. A common choice of coordinates is latitude, longitude and elevation.
Coordinate type | X | Y |
---|---|---|
Longitude and Latitude. | -3.106849 | 51.015344 |
Eastings and Northings. | 322454 | 124580 |
Wikipedia: Spatial Reference System.
A spatial reference system (SRS) or coordinate reference system (CRS) is a coordinate-based local, regional or global system used to locate geographical entities.
Reference System | Coordinates used | Who by |
---|---|---|
British National Grid | Eastings/Northings | Ordnance Survey |
World Geodetic System 84 | Longitude/Latitude | GPS |
Why do we have different spatial reference systems?
A spatial reference systems defines how to to plot features on the curved surface of the earth to a flat paper or computer screen. As the earth is different in different parts of the world we need different spatial reference systems.
Geocoding and reverse geocoding are ways of matching address and location data with geo-coordinates.
- Geocoding: Address -> Geo-coordinates. Usage example: Plotting a user address search onto a map.
- Reverse geocoding: Geo-coordinates -> Address. Usage example: taking coordinates retrieved from GPS to determine current location.
- Geofencing: A feature in a software program that uses the global positioning system (GPS) or radio frequency identification (RFID) to define geographical boundaries. A geofence is a virtual barrier.
- Go to Batch Geocoder
- Copy data from file SomersetLibraryAddresses.csv into input field.
- Press geocode.
- Go to Batch reverse geocoder
- Copy data from file /data/SomersetLibraryCoordinates.csv
- Press reverse geocode.
Typically when dealing with geo-spatial data, this will be in the form of Points, Lines, and Polygons.
- Points - Individual locations made up of a single coordinate set.
- Lines - Linear features made up of coordinates such as route lines.
- Polygons - Bounded areas (shapes) made up of coordinates such as local authority boundaries and geofences.
There are many different formats for storing geo data. These are a few of them.
Format | Description | Example |
---|---|---|
GeoJSON | JavaScript Object Notation (JSON) style geo data. | [/data/Somerset School Catchment Areas 2014-15.geojson](Somerset School Catchment Areas) |
Shapefiles | Format developed by ESRI for storing geospatial data. More than one file! | /data/ |
KML | XML type format for storing geospatial data. Used by Google Earth and Google fusion tables. | SomersetLibraries |
The traditional way of working with GIS data is through Desktop applications
- ESRI ArcDesktop - World leader for GIS software
- MapInfo - Acquired by Pitney Bowes Business Insight
- Quantum GIS - Open Source option. Brilliant.
Download and install: Quantum GIS
- Open up QGIS
- Choose Layer > Add layer > Add vector layer
- Select the file [Somerset School Catchment Areas 2014-15](/data/Somerset School Catchment Areas 2014-15.geojson)
WMS and WFS are ways of dealing with geo data through web services.
WMS - Web Map Service. Typically used to provide map images (typically as raster tiles) WFS - Web Feature Service. Provides feature information, then used to display on a map.
Most modern databases have some element of 'spatial' capability.
- SQL Server
- mySQL
- Oracle
- PostGIS
Download and install: PostgreSQL - Open Source database Download and install: PostGIS - Spatial functionality for PostgreSQL
Take a database table: Libraries
Name | Authority | Latitude | Longitude |
---|---|---|---|
Taunton Library | Somerset | ||
Bath Central Library | Bath and North East Somerset | ||
Box | Wiltshire | ||
Newcastle Central Library | Newcastle |
An individual is a member of Somerset. Find all libraries in their authority.
SELECT Name FROM Libraries WHERE Authority = 'Somerset'
How about the query: Find all libraries within 5 miles of an individual?
SELECT Name FROM Libraries
WHERE ST_DWithin(
ST_SetSRID(ST_MakePoint(Longitude,Latitude), 4326)::geography,
ST_SetSRID(ST_MakePoint(-3.106849,51.015344), 4326)::geography
, 8046)
- ST_MakePoint - Constructs a Point (from the latitude and longitude)
- ST_SetSRID - Instructs the database which spatial reference system we're using.
- ST_DWithin - Returns true if the two geometries are within the specified distance of one another (8046 metres - 5 miles)
There are many JavaScript libraries for creating maps that allow for full integration with web development projects.
- Leaflet - An open source option.
- OpenLayers - Another open source option. Can be more confusing!
- Google maps - Allows you to use Google's map tiles layer and other plugins.
- Bing maps - The same but from Microsoft.
- Go to the Leaflet quick start guide
- Follow instructions for creating your first map.
- See Example Here for completed map.
If you're not a web developer, but still want to create online maps that as a content editor you can embed or publish, then there are plenty of options.
Create account: Mapbox Create account: Carto
(Assumes having created a Carto account)
- Login to Carto and select to import a new data file.
- Select the file PostalArea.zip and allow Carto to upload it.
- Play with the resulting data and create a map!