Open Source Geospatial Geographic Data Technology Barry Rowlingson School of Health and Medicine, Lancaster University
Data Software is useless without data
The Earth Is Not Flat This may not come as a shock to most of you
Latitude
Latitude-Latitude
Latitude-Longitude
The Earth is Not a Sphere You probably knew this too
Not as much as this Asteroid Ida
My Earth is not Your Earth Nobody can agree on how not-spherical the earth is. N S
Disagreements Where is the North Pole anyway?
Disagreements Or how to measure latitude O N S ab
Meridian
Disagreements jcohen, flickr
Greenwich
Nothing is fixed anyway
EPSG
EPSG Database
Projections
WKT from the OGC Open Standard from the OGC Text format specifying coordinate systems and projections And lots of other things...
COMPD_CS["OSGB36 / British National Grid + ODN", PROJCS["OSGB 1936 / British National Grid", GEOGCS["OSGB 1936", DATUM["OSGB_1936", SPHEROID["Airy 1830", , ,AUTHORITY["EPSG","7001"]], TOWGS84[375,-111,431,0,0,0,0], AUTHORITY[["EPSG","6277"]], PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]], UNIT["DMSH", ,AUTHORITY["EPSG","9108"]], AXIS["Lat",NORTH], AXIS["Long",EAST], AUTHORITY[["EPSG","4277"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",49], PARAMETER["central_meridian",-2], PARAMETER["scale_factor", ], PARAMETER["false_easting",400000], PARAMETER["false_northing", ], UNIT["metre",1,AUTHORITY["EPSG","9001"]], AXIS["E",EAST], AXIS["N",NORTH], AUTHORITY[["EPSG","27700"]], VERT_CS["Newlyn", VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]], UNIT["metre",1,AUTHORITY["EPSG","9001"]], AXIS["Up",UP], AUTHORITY[["EPSG","5701"]], AUTHORITY[["EPSG","7405"]]
WKT point POINT( )
Simple Features (OGC-SFS) Five Points Three Lines Two Linear Rings Two Polygons One Linestring One MultiPolygon
WKT SFS representation Point(10 10) LineString(10 10, 20 20) LineString(10 10, 20 20, 30 40, 10 10) Polygon((10 10, 10 20, 20 20, 20 15, 10 10), (14 14, 16 16, 14 16, 14 14)) LineString(10 10, 20 20, 30 40, 50 50) MultiPolygon( ((10 10, 10 20, 20 20, 20 15, 10 10)), ((60 60, 70 70, 80 60, )) )
Attributes Feature s Field s
Attributes
Topology
A B C D E F G H J K L
Topology A B C D E F G H J K L
Topology A B C D E F G H J K L
Road Networks
Polygon Topology
a b c d e f g h i j C A B D E F
a b c d g A B E F
a b c d g A B E F
Raster Data
Continuous Data
DEM
Multi-band Rasters
Geo-referencing Where on earth are we?
Geo-referencing Where on earth are we? W N N E
On the edge? 25 W
Geo-referenced
File Formats
Text files ID,X,Y,Name,Population 1,23.3,0.3,Alphaville,1234 2,24.5,0.31,”Beta City”, ,22.2,0.28,Gammaton,66453 ID X Y Name Popn Alphaville Beta City Gammaton Comma- separated Fixed- width
ESRI Shapefile ESRI standard Points, Lines, Polygons Three or more files Database file No topology Optional CRS file (.prj)
Keyhole Markup Language Station A 3 target.png , ,0
GML Geography Markup Language 45.67, ,89.44 Defines 'Application Schemas': CityGML: urban building information CSML: climate science SensorML: e.g. weather stations CAAML: avalanche info
OGR C library code and tools Read and writes most vector files - GRASS, ESRI Shapefile, MapInfo File, UK.NTF, SDTS, TIGER, S57, DGN, VRT, AVCBin, REC, Memory, CSV, GML, KML, Interlis 1, Interlis 2, SQLite, ODBC, PGeo, OGDI, PostgreSQL, MySQL Provides info and conversion tools Can be used by other programs
ogr tools > ogrinfo scot_BNG.shp INFO: Open of `scot_BNG.shp' using driver `ESRI Shapefile' successful. Layer name: scot_BNG Geometry: Polygon Feature Count: 56 Extent: ( , ) - ( , ) Layer SRS WKT: PROJCS["OSGB 1936 / British National Grid", GEOGCS["OSGB 1936", DATUM["OSGB_1936",..... > ogr2ogr -f KML scotland.kml scotland.shp
Raster Files NCOLS 25 NROWS 24 CELLSIZE XLLCORNER YLLCORNER NODATA_value ESRI grid format
Raster Files Image + 'World' file x-cell size y-rotation x-rotation y-cell size x-upper-left y-upper-left raster.wld raster.png
KML for rasters Map Test Simple map overlay test rasterSmall.png
Raster files GeoTiff – a TIFF plus Geo OSGeo standard Multi-band Coordinate system-aware
GDAL C library code and tools Read and writes most raster files - GRASS Database Rasters (5.7+), Virtual Raster, GeoTIFF, National Imagery Transmission Format, Erdas Imagine Images (.img), CEOS SAR Image, CEOS Image, ELAS, Arc/Info Binary Grid, Arc/Info ASCII Grid, SDTS Raster, OGDI Bridge, DTED Elevation Raster, Portable Network Graphics, JPEG JFIF, In Memory Raster, Japanese DEM (.mem), Graphics Interchange Format (.gif), Envisat Image Format, Maptech BSB Nautical Charts, X11 PixMap Format, MS Windows Device Independent Bitmap, AirSAR Polarimetric Image, RadarSat 2 XML Product, PCIDSK Database File, PCRaster Raster File, ILWIS Raster Map, SGI Image File Format 1.0, Leveller heightfield, GMT NetCDF Grid Format, Network Common Data Format, Hierarchical Data Format Release 4, HDF4 Dataset, Portable Pixmap Format (netpbm), USGS DOQ (Old Style), USGS DOQ (New Style), ENVI.hdr Labelled, ESRI.hdr Labelled, PCI.aux Labelled, Vexcel MFF Raster, Vexcel MFF2 (HKV) Raster, Fuji BAS Scanner Image, GSC Geogrid, EOSAT FAST Format, VTP.bt (Binary Terrain) 1.3 Format, Erdas.LAN/.GIS, Convair PolGASP, Image Data and Analysis, NLAPS Data Format, DIPEx, USGS Astrogeology ISIS cube (Version 2), NASA Planetary Data System, JPEG-2000 part 1 (ISO/IEC ), NOAA Polar Orbiter Level 1b Data Set, FIT Image, Raster Matrix Format, OGC Web Coverage Service, Idrisi Raster A.1, Swedish Grid RIK (.rik), USGS Optional ASCII DEM (and CDED), GeoSoft Grid Exchange Format, Hierarchical Data Format Release 5 Provides info and conversion tools Can be used by other programs
GDAL tools > gdalinfo rasterSmall.png Driver: PNG/Portable Network Graphics Size is 28, 17 Coordinate System is `' Origin = ( , ) Pixel Size = ( , ) Corner Coordinates: Upper Left ( , ) Lower Left ( , ) Upper Right ( , ) Lower Right ( , ) Center ( , ) Band 1 Block=28x1 Type=Byte, ColorInterp=Red Band 2 Block=28x1 Type=Byte, ColorInterp=Green Band 3 Block=28x1 Type=Byte, ColorInterp=Blue
GDAL tools gdalwarp -t_srs '+proj=aea +lat_1=55 +lat_2=65 +lat_0=50 +lon_0=-154 +x_0=0 +y_0=0 +ellps=clrk66 +datum=NAD27' a1.tif a2.tif
Spatial Databases Sometimes files aren't good enough Need to share data in a group Need data integrity PostGIS SpatiaLite Client-server model
Client-Server model Send me all the polygons south of 50N where the population is less than 10,000. Please.
Client-Server model Sure. The first one has ID 343, the population is 526, and its coordinates are 44.23, ,
Client-Server model Thanks!
Client-Server model Can I have the coords of Lancaster please? What's the longest river in the world? okay Just a sec...
SQL and PostGIS DB table queries are spoken in SQL Standard DB query: SELECT region, pop FROM uk WHERE pop >
Spatial DB PostGIS stores geometry in the_geom SELECT region, pop, the_geom FROM uk WHERE pop >
Spatial DB AsEWKT SELECT region, pop, AsEWKT(the_geom) FROM uk WHERE pop >
Spatial Queries psql# SELECT "WID","NAME","ZONE_NAME" FROM woredas WHERE Intersects( geomfromtext('POINT( )',-1), the_geom ); WID | NAME | ZONE_NAME | Damot Weyde | Wolayita
Spatial Data Services Simplified databases, designed for maps OGC standards: WFS and WMS WMS query WFS query <gml:LineString gml:id="p21" srsName="urn:ogc:def:crs:EPSG:6.6:4326"> 45.67, ,89.44
Mapping Mashups Integration of multiple data sets... ? OSM Base layer WFS Polygon overlay GeoRSS news Weather map GPS data
The Future Location-based services Neogeography Web Maps = Where 2.0 A World Where Nobody Is Ever Lost
The Future Location-based services Neogeography Web Maps = Where 2.0 A World Where Nobody Is Ever Lost Except when their batteries run out