SlideShare a Scribd company logo
1 of 44
Handling Geospatial Data
INAFU6513 Lecture 8b
Lab 8: Your 5-7 things:
• Geospatial data
• Geospatial data tools
• Vector map data
• Raster map data
• Geospatial calculations
Geospatial Data
Geospatial Data
o Geographical: related to the Earth’s surface
o Spatial: about space (locations, distances etc)
o Data: yep, this is also data
o Usually handled by Geographical Information Systems (GIS) tools
o …many of which are written in Python…
Printed Maps
Georeferenced satellite and aerial data
Vector Map
Adding features to a vector map
Abstract Schematics
Schematics
Map Projections
Coordinate systems
• WGS84 (GIS)
• OSGB36 (UK)
• ED50 (Nato)
• Etc.
Mapping Tools
Tableau: Symbol Maps
Tableau: Choropleth maps
Geospatial data tools
• Google Maps
• OpenStreetMap
• QGIS
• CartoDB
• ArcGIS
• LeafletJS
• MapBox
Python libraries:
• GDAL toolset
• Shapely
• Fiona
• Basemap
QGIS
QGIS: reading shapefiles
QGIS: Tanzania Wards
QGIS: Looking at the dataset
QGIS: Attribute Table
QGIS: Reading Raster map data
QGIS: Getting Raster Map information
QGIS: Raster map histogram
Vector Map Data
Vector data formats
• Spreadsheet (.csv, .xls)
• Shapefile (.shp)
• Keyhole markup language (.kml, .kmz)
• Geojson and Topojson (.json)
• GPS exchange format (.gpx)
• OSM output files (.osm.bz2)
Shapefiles
• .shp: feature geometry (e.g. your dataset)
• .shx: shape index
• .dbf: shape attributes
• .prj: projection
• .shp.xml: metadata
The GDAL toolset
Example terminal-line tools:
• OGR2OGR: convert between vector formats
• GDALwarp: cookie-cut raster files
• gdal_polygonize: convert raster to vector
Python libraries:
• gdal, ogr2ogr etc
• fiona (“pythonic GDAL”)
Reading shapefiles: the Fiona library
from fiona import collection
with collection('example_data/TZwards/TZwards.shp', 'r') as input:
for f in input:
print(f)
Convert vector file formats: OGR2OGR
From the terminal window:
ogr2ogr f GeoJSON where "ADM0_A3 = 'YEM'" outfile.json
ne_10m_admin_1_states_provinces.shp
Raster Map Data
Why raster data?
Raster Data Formats
• GeoTiff (.tif)
• Jpeg (.jpg)
• NITF
• HTF5
Geotiff features
Reading raster map data with GDAL
import gdal
import numpy as np
dataset = gdal.Open(infile, GA_ReadOnly)
cols = dataset.RasterXSize
rows = dataset.RasterYSize
nbands = dataset.RasterCount
driver = dataset.GetDriver().LongName
geotransform = dataset.GetGeoTransform()
for b in range(1,nbands+1):
band = dataset.GetRasterBand(b)
bandtype = gdal.GetDataTypeName(band.DataType)
banddata = band.ReadAsArray(0,0,band.XSize, band.YSize).astype(np.float)
Raster + Vector: cookie-cut a raster map
From the command line, type
gdalwarp cutline yourshapefile.shp yourgeotiff.tif yourresult.tif
GIS data Calculations
Vector data calculations
• Point location (e.g. lat/long from address)
• Area and area overlap sizes (e.g. overlap between village and protected area)
• Belonging (e.g. finding which district a lat/long is in)
• Straight-line distance between points (e.g. great circles)
• Practical distance and time between points (e.g. using roads)
Geopy: get lat/ longs from addresses
from geopy.geocoders import Nominatim
from geopy.geocoders import GoogleV3
geolocator = Nominatim()
googlocator = GoogleV3()
address = '1600 Pennsylvania Ave NW, Washington, DC'
result = geolocator.geocode(address, timeout=10)
if result is None:
result = googlocator.geocode(address, timeout=10)
if result is None:
latlon = (0.0, 0.0)
else:
latlon = (float(result.latitude), float(result.longitude))
Geopy: Calculate distance
from geopy.distance import vincenty
dist = vincenty(loc1, loc2)
Fiona point-in-polygon: finding “belonging”
import fiona
Import shapely
mapdata = fiona.open(‘map_data/nyc_neighbourhoods_wgs84.shp’, 'r')
for f in mapdata:
props = f['properties']
geom = shapely.geometry.asShape(f['geometry'])
neighs[props['NTACode']] = geom
stationpt = Point(stationlon, stationlat)
for neigh, neighshape in neighs.iteritems():
if neighshape.contains(stationpt):
stationneigh = neigh
Basemap: Map visualisations in Python
%matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
fig = plt.figure(figsize=(8, 8))
usmap = Basemap(projection='lcc', resolution=None,
width=8000000, height=8000000,lat_0=45, lon_0=-100,)
usmap.etopo(scale=0.5, alpha=0.5)
Exercises
If this interested you…
There’s more in workbooks 8.x

More Related Content

What's hot

Processing Geospatial at Scale at LocationTech
Processing Geospatial at Scale at LocationTechProcessing Geospatial at Scale at LocationTech
Processing Geospatial at Scale at LocationTechRob Emanuele
 
RasterFrames: Enabling Global-Scale Geospatial Machine Learning
RasterFrames: Enabling Global-Scale Geospatial Machine LearningRasterFrames: Enabling Global-Scale Geospatial Machine Learning
RasterFrames: Enabling Global-Scale Geospatial Machine LearningAstraea, Inc.
 
Using Deep Learning to Derive 3D Cities from Satellite Imagery
Using Deep Learning to Derive 3D Cities from Satellite ImageryUsing Deep Learning to Derive 3D Cities from Satellite Imagery
Using Deep Learning to Derive 3D Cities from Satellite ImageryAstraea, Inc.
 
ePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
ePOM - Intro to Ocean Data Science - Raster and Vector Data FormatsePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
ePOM - Intro to Ocean Data Science - Raster and Vector Data FormatsGiuseppe Masetti
 
FOSDEM 2015: Distributed Tile Processing with GeoTrellis and Spark
FOSDEM 2015: Distributed Tile Processing with GeoTrellis and SparkFOSDEM 2015: Distributed Tile Processing with GeoTrellis and Spark
FOSDEM 2015: Distributed Tile Processing with GeoTrellis and SparkRob Emanuele
 
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHubEuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHubMartin Christen
 
Plugins in QGIS and its uses
Plugins in QGIS and its usesPlugins in QGIS and its uses
Plugins in QGIS and its usesMayuresh Padalkar
 
Big Data and Geospatial with HPCC Systems
Big Data and Geospatial with HPCC SystemsBig Data and Geospatial with HPCC Systems
Big Data and Geospatial with HPCC SystemsHPCC Systems
 
Building maps for apps in the cloud - a Softlayer Use Case
Building maps for  apps in the cloud - a Softlayer Use CaseBuilding maps for  apps in the cloud - a Softlayer Use Case
Building maps for apps in the cloud - a Softlayer Use CaseTiman Rebel
 
Introduction to Digital Image Processing _ 2014
Introduction to Digital Image Processing _ 2014Introduction to Digital Image Processing _ 2014
Introduction to Digital Image Processing _ 2014Atiqa khan
 
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGISGeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGISRoland Hansson
 
Regularised Cross-Modal Hashing (SIGIR'15 Poster)
Regularised Cross-Modal Hashing (SIGIR'15 Poster)Regularised Cross-Modal Hashing (SIGIR'15 Poster)
Regularised Cross-Modal Hashing (SIGIR'15 Poster)Sean Moran
 
Introduction of open source gis
Introduction of open source gisIntroduction of open source gis
Introduction of open source gisHiroaki Sengoku
 
Amin tayyebi: Big Data and Land Use Change Science
Amin tayyebi: Big Data and Land Use Change ScienceAmin tayyebi: Big Data and Land Use Change Science
Amin tayyebi: Big Data and Land Use Change Scienceknowdiff
 

What's hot (20)

Processing Geospatial at Scale at LocationTech
Processing Geospatial at Scale at LocationTechProcessing Geospatial at Scale at LocationTech
Processing Geospatial at Scale at LocationTech
 
RasterFrames: Enabling Global-Scale Geospatial Machine Learning
RasterFrames: Enabling Global-Scale Geospatial Machine LearningRasterFrames: Enabling Global-Scale Geospatial Machine Learning
RasterFrames: Enabling Global-Scale Geospatial Machine Learning
 
Using Deep Learning to Derive 3D Cities from Satellite Imagery
Using Deep Learning to Derive 3D Cities from Satellite ImageryUsing Deep Learning to Derive 3D Cities from Satellite Imagery
Using Deep Learning to Derive 3D Cities from Satellite Imagery
 
ePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
ePOM - Intro to Ocean Data Science - Raster and Vector Data FormatsePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
ePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
 
GIS fundamentals - raster
GIS fundamentals - rasterGIS fundamentals - raster
GIS fundamentals - raster
 
FOSDEM 2015: Distributed Tile Processing with GeoTrellis and Spark
FOSDEM 2015: Distributed Tile Processing with GeoTrellis and SparkFOSDEM 2015: Distributed Tile Processing with GeoTrellis and Spark
FOSDEM 2015: Distributed Tile Processing with GeoTrellis and Spark
 
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHubEuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
 
GIS
GISGIS
GIS
 
Plugins in QGIS and its uses
Plugins in QGIS and its usesPlugins in QGIS and its uses
Plugins in QGIS and its uses
 
Big Data and Geospatial with HPCC Systems
Big Data and Geospatial with HPCC SystemsBig Data and Geospatial with HPCC Systems
Big Data and Geospatial with HPCC Systems
 
QGIS training class 3
QGIS training class 3QGIS training class 3
QGIS training class 3
 
Building maps for apps in the cloud - a Softlayer Use Case
Building maps for  apps in the cloud - a Softlayer Use CaseBuilding maps for  apps in the cloud - a Softlayer Use Case
Building maps for apps in the cloud - a Softlayer Use Case
 
Introduction to Digital Image Processing _ 2014
Introduction to Digital Image Processing _ 2014Introduction to Digital Image Processing _ 2014
Introduction to Digital Image Processing _ 2014
 
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGISGeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
 
Diaz Collect Earth remote sensing activity data Nov 10 2014
Diaz Collect Earth remote sensing activity data Nov 10 2014Diaz Collect Earth remote sensing activity data Nov 10 2014
Diaz Collect Earth remote sensing activity data Nov 10 2014
 
QGIS - Free alternative to ArcMap
QGIS - Free alternative to ArcMapQGIS - Free alternative to ArcMap
QGIS - Free alternative to ArcMap
 
Regularised Cross-Modal Hashing (SIGIR'15 Poster)
Regularised Cross-Modal Hashing (SIGIR'15 Poster)Regularised Cross-Modal Hashing (SIGIR'15 Poster)
Regularised Cross-Modal Hashing (SIGIR'15 Poster)
 
Os Racicot
Os RacicotOs Racicot
Os Racicot
 
Introduction of open source gis
Introduction of open source gisIntroduction of open source gis
Introduction of open source gis
 
Amin tayyebi: Big Data and Land Use Change Science
Amin tayyebi: Big Data and Land Use Change ScienceAmin tayyebi: Big Data and Land Use Change Science
Amin tayyebi: Big Data and Land Use Change Science
 

Viewers also liked

Power point assignment choice #1_module 6
Power point assignment choice #1_module 6Power point assignment choice #1_module 6
Power point assignment choice #1_module 6ellie0890
 
Kati_Harrison_Resume
Kati_Harrison_ResumeKati_Harrison_Resume
Kati_Harrison_ResumeKati Harrison
 
Àsterix i Obèlix
Àsterix i ObèlixÀsterix i Obèlix
Àsterix i ObèlixJaime P
 
Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017
Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017
Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017Autismiliitto
 
Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017
Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017
Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017Autismiliitto
 
Astèrix i Obèlix
Astèrix i ObèlixAstèrix i Obèlix
Astèrix i ObèlixJaime P
 
Presentación círculos de calidad
Presentación círculos de calidadPresentación círculos de calidad
Presentación círculos de calidadKevin Prestelo
 
Sensibilización a Docentes
Sensibilización a DocentesSensibilización a Docentes
Sensibilización a Docentesquchito20
 

Viewers also liked (14)

Power point assignment choice #1_module 6
Power point assignment choice #1_module 6Power point assignment choice #1_module 6
Power point assignment choice #1_module 6
 
Kati_Harrison_Resume
Kati_Harrison_ResumeKati_Harrison_Resume
Kati_Harrison_Resume
 
Ακρόπολη
ΑκρόποληΑκρόπολη
Ακρόπολη
 
Best Hospitals In India 2007
Best Hospitals In India 2007Best Hospitals In India 2007
Best Hospitals In India 2007
 
Àsterix i Obèlix
Àsterix i ObèlixÀsterix i Obèlix
Àsterix i Obèlix
 
Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017
Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017
Pekka Larkela, autismikirjon parisuhteen äärellä, Autismin talvipäivät 2017
 
Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017
Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017
Heta Pukki, tytöt ja naiset autismin kirjolla, Autismin talvipäivät 2017
 
Blossoms NME
Blossoms NMEBlossoms NME
Blossoms NME
 
Astèrix i Obèlix
Astèrix i ObèlixAstèrix i Obèlix
Astèrix i Obèlix
 
Vtu KOM Notes module 1
Vtu KOM Notes module   1Vtu KOM Notes module   1
Vtu KOM Notes module 1
 
Arte renascentista
Arte renascentistaArte renascentista
Arte renascentista
 
Presentación círculos de calidad
Presentación círculos de calidadPresentación círculos de calidad
Presentación círculos de calidad
 
Ningujeme
NingujemeNingujeme
Ningujeme
 
Sensibilización a Docentes
Sensibilización a DocentesSensibilización a Docentes
Sensibilización a Docentes
 

Similar to Session 08 geospatial data

Gis fandamentals -1
Gis fandamentals -1Gis fandamentals -1
Gis fandamentals -1RJRANJEET1
 
gislec1.ppt
gislec1.pptgislec1.ppt
gislec1.pptfelip19
 
Introduction to Geographic Information Systems (GIS).pptx
Introduction to Geographic Information Systems (GIS).pptxIntroduction to Geographic Information Systems (GIS).pptx
Introduction to Geographic Information Systems (GIS).pptxUniversity of Colombo
 
Introduction to arc gis
Introduction to arc gisIntroduction to arc gis
Introduction to arc gisMohamed Hamed
 
Gis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal Ogudah
Gis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal OgudahGis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal Ogudah
Gis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal OgudahMichael Kimathi
 
What is Geography Information Systems (GIS)
What is Geography Information Systems (GIS)What is Geography Information Systems (GIS)
What is Geography Information Systems (GIS)John Lanser
 
Getting started with GIS
Getting started with GISGetting started with GIS
Getting started with GISEsri India
 
Introduction and Application of GIS
Introduction and Application of GISIntroduction and Application of GIS
Introduction and Application of GISSatish Taji
 
Play with Vector and Make Map
Play with Vector and Make MapPlay with Vector and Make Map
Play with Vector and Make MapNopphawanTamkuan
 
Geographic Information System unit 1
Geographic Information System   unit 1Geographic Information System   unit 1
Geographic Information System unit 1sridevi5983
 
Exploratory Analysis Part1 Coursera DataScience Specialisation
Exploratory Analysis Part1 Coursera DataScience SpecialisationExploratory Analysis Part1 Coursera DataScience Specialisation
Exploratory Analysis Part1 Coursera DataScience SpecialisationWesley Goi
 
Geographic information system(GIS) and its applications in agriculture
Geographic information system(GIS) and its applications in agricultureGeographic information system(GIS) and its applications in agriculture
Geographic information system(GIS) and its applications in agricultureKiranmai nalla
 
MODS_Training_January_2015.pptx
MODS_Training_January_2015.pptxMODS_Training_January_2015.pptx
MODS_Training_January_2015.pptxSMFORHADTASFI
 

Similar to Session 08 geospatial data (20)

Gislec1
Gislec1Gislec1
Gislec1
 
LS1.pptx
LS1.pptxLS1.pptx
LS1.pptx
 
Gis fandamentals -1
Gis fandamentals -1Gis fandamentals -1
Gis fandamentals -1
 
gislec1.ppt
gislec1.pptgislec1.ppt
gislec1.ppt
 
Introduction to Geographic Information Systems (GIS).pptx
Introduction to Geographic Information Systems (GIS).pptxIntroduction to Geographic Information Systems (GIS).pptx
Introduction to Geographic Information Systems (GIS).pptx
 
Introduction to arc gis
Introduction to arc gisIntroduction to arc gis
Introduction to arc gis
 
Data_Sources
Data_SourcesData_Sources
Data_Sources
 
Gis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal Ogudah
Gis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal OgudahGis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal Ogudah
Gis and Ruby 101 at Ruby Conf Kenya 2017 by Kamal Ogudah
 
What is Geography Information Systems (GIS)
What is Geography Information Systems (GIS)What is Geography Information Systems (GIS)
What is Geography Information Systems (GIS)
 
Getting started with GIS
Getting started with GISGetting started with GIS
Getting started with GIS
 
Introduction and Application of GIS
Introduction and Application of GISIntroduction and Application of GIS
Introduction and Application of GIS
 
Play with Vector and Make Map
Play with Vector and Make MapPlay with Vector and Make Map
Play with Vector and Make Map
 
Geographic Information System unit 1
Geographic Information System   unit 1Geographic Information System   unit 1
Geographic Information System unit 1
 
Fundamentals of GIS
Fundamentals of GISFundamentals of GIS
Fundamentals of GIS
 
Exploratory Analysis Part1 Coursera DataScience Specialisation
Exploratory Analysis Part1 Coursera DataScience SpecialisationExploratory Analysis Part1 Coursera DataScience Specialisation
Exploratory Analysis Part1 Coursera DataScience Specialisation
 
Geographic information system(GIS) and its applications in agriculture
Geographic information system(GIS) and its applications in agricultureGeographic information system(GIS) and its applications in agriculture
Geographic information system(GIS) and its applications in agriculture
 
MODS_Training_January_2015.pptx
MODS_Training_January_2015.pptxMODS_Training_January_2015.pptx
MODS_Training_January_2015.pptx
 
Mobile LBS
Mobile LBSMobile LBS
Mobile LBS
 
GIS and Its Components.pptx
GIS and Its Components.pptxGIS and Its Components.pptx
GIS and Its Components.pptx
 
Introduction To GIS
Introduction To GISIntroduction To GIS
Introduction To GIS
 

More from Sara-Jayne Terp

Distributed defense against disinformation: disinformation risk management an...
Distributed defense against disinformation: disinformation risk management an...Distributed defense against disinformation: disinformation risk management an...
Distributed defense against disinformation: disinformation risk management an...Sara-Jayne Terp
 
Risk, SOCs, and mitigations: cognitive security is coming of age
Risk, SOCs, and mitigations: cognitive security is coming of ageRisk, SOCs, and mitigations: cognitive security is coming of age
Risk, SOCs, and mitigations: cognitive security is coming of ageSara-Jayne Terp
 
disinformation risk management: leveraging cyber security best practices to s...
disinformation risk management: leveraging cyber security best practices to s...disinformation risk management: leveraging cyber security best practices to s...
disinformation risk management: leveraging cyber security best practices to s...Sara-Jayne Terp
 
Cognitive security: all the other things
Cognitive security: all the other thingsCognitive security: all the other things
Cognitive security: all the other thingsSara-Jayne Terp
 
The Business(es) of Disinformation
The Business(es) of DisinformationThe Business(es) of Disinformation
The Business(es) of DisinformationSara-Jayne Terp
 
2021-05-SJTerp-AMITT_disinfoSoc-umaryland
2021-05-SJTerp-AMITT_disinfoSoc-umaryland2021-05-SJTerp-AMITT_disinfoSoc-umaryland
2021-05-SJTerp-AMITT_disinfoSoc-umarylandSara-Jayne Terp
 
2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...
2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...
2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...Sara-Jayne Terp
 
2021-02-10_CogSecCollab_UBerkeley
2021-02-10_CogSecCollab_UBerkeley2021-02-10_CogSecCollab_UBerkeley
2021-02-10_CogSecCollab_UBerkeleySara-Jayne Terp
 
Using AMITT and ATT&CK frameworks
Using AMITT and ATT&CK frameworksUsing AMITT and ATT&CK frameworks
Using AMITT and ATT&CK frameworksSara-Jayne Terp
 
2020 12 nyu-workshop_cog_sec
2020 12 nyu-workshop_cog_sec2020 12 nyu-workshop_cog_sec
2020 12 nyu-workshop_cog_secSara-Jayne Terp
 
2019 11 terp_mansonbulletproof_master copy
2019 11 terp_mansonbulletproof_master copy2019 11 terp_mansonbulletproof_master copy
2019 11 terp_mansonbulletproof_master copySara-Jayne Terp
 
BSidesLV 2018 talk: social engineering at scale, a community guide
BSidesLV 2018 talk: social engineering at scale, a community guideBSidesLV 2018 talk: social engineering at scale, a community guide
BSidesLV 2018 talk: social engineering at scale, a community guideSara-Jayne Terp
 
Social engineering at scale
Social engineering at scaleSocial engineering at scale
Social engineering at scaleSara-Jayne Terp
 
engineering misinformation
engineering misinformationengineering misinformation
engineering misinformationSara-Jayne Terp
 
Online misinformation: they're coming for our brainz now
Online misinformation: they're coming for our brainz nowOnline misinformation: they're coming for our brainz now
Online misinformation: they're coming for our brainz nowSara-Jayne Terp
 
Sj terp ciwg_nyc2017_credibility_belief
Sj terp ciwg_nyc2017_credibility_beliefSj terp ciwg_nyc2017_credibility_belief
Sj terp ciwg_nyc2017_credibility_beliefSara-Jayne Terp
 
Belief: learning about new problems from old things
Belief: learning about new problems from old thingsBelief: learning about new problems from old things
Belief: learning about new problems from old thingsSara-Jayne Terp
 
risks and mitigations of releasing data
risks and mitigations of releasing datarisks and mitigations of releasing data
risks and mitigations of releasing dataSara-Jayne Terp
 
Session 10 handling bigger data
Session 10 handling bigger dataSession 10 handling bigger data
Session 10 handling bigger dataSara-Jayne Terp
 

More from Sara-Jayne Terp (20)

Distributed defense against disinformation: disinformation risk management an...
Distributed defense against disinformation: disinformation risk management an...Distributed defense against disinformation: disinformation risk management an...
Distributed defense against disinformation: disinformation risk management an...
 
Risk, SOCs, and mitigations: cognitive security is coming of age
Risk, SOCs, and mitigations: cognitive security is coming of ageRisk, SOCs, and mitigations: cognitive security is coming of age
Risk, SOCs, and mitigations: cognitive security is coming of age
 
disinformation risk management: leveraging cyber security best practices to s...
disinformation risk management: leveraging cyber security best practices to s...disinformation risk management: leveraging cyber security best practices to s...
disinformation risk management: leveraging cyber security best practices to s...
 
Cognitive security: all the other things
Cognitive security: all the other thingsCognitive security: all the other things
Cognitive security: all the other things
 
The Business(es) of Disinformation
The Business(es) of DisinformationThe Business(es) of Disinformation
The Business(es) of Disinformation
 
2021-05-SJTerp-AMITT_disinfoSoc-umaryland
2021-05-SJTerp-AMITT_disinfoSoc-umaryland2021-05-SJTerp-AMITT_disinfoSoc-umaryland
2021-05-SJTerp-AMITT_disinfoSoc-umaryland
 
2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...
2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...
2021 IWC presentation: Risk, SOCs and Mitigations: Cognitive Security is Comi...
 
2021-02-10_CogSecCollab_UBerkeley
2021-02-10_CogSecCollab_UBerkeley2021-02-10_CogSecCollab_UBerkeley
2021-02-10_CogSecCollab_UBerkeley
 
Using AMITT and ATT&CK frameworks
Using AMITT and ATT&CK frameworksUsing AMITT and ATT&CK frameworks
Using AMITT and ATT&CK frameworks
 
2020 12 nyu-workshop_cog_sec
2020 12 nyu-workshop_cog_sec2020 12 nyu-workshop_cog_sec
2020 12 nyu-workshop_cog_sec
 
2020 09-01 disclosure
2020 09-01 disclosure2020 09-01 disclosure
2020 09-01 disclosure
 
2019 11 terp_mansonbulletproof_master copy
2019 11 terp_mansonbulletproof_master copy2019 11 terp_mansonbulletproof_master copy
2019 11 terp_mansonbulletproof_master copy
 
BSidesLV 2018 talk: social engineering at scale, a community guide
BSidesLV 2018 talk: social engineering at scale, a community guideBSidesLV 2018 talk: social engineering at scale, a community guide
BSidesLV 2018 talk: social engineering at scale, a community guide
 
Social engineering at scale
Social engineering at scaleSocial engineering at scale
Social engineering at scale
 
engineering misinformation
engineering misinformationengineering misinformation
engineering misinformation
 
Online misinformation: they're coming for our brainz now
Online misinformation: they're coming for our brainz nowOnline misinformation: they're coming for our brainz now
Online misinformation: they're coming for our brainz now
 
Sj terp ciwg_nyc2017_credibility_belief
Sj terp ciwg_nyc2017_credibility_beliefSj terp ciwg_nyc2017_credibility_belief
Sj terp ciwg_nyc2017_credibility_belief
 
Belief: learning about new problems from old things
Belief: learning about new problems from old thingsBelief: learning about new problems from old things
Belief: learning about new problems from old things
 
risks and mitigations of releasing data
risks and mitigations of releasing datarisks and mitigations of releasing data
risks and mitigations of releasing data
 
Session 10 handling bigger data
Session 10 handling bigger dataSession 10 handling bigger data
Session 10 handling bigger data
 

Recently uploaded

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Onlineanilsa9823
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxolyaivanovalion
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 

Recently uploaded (20)

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 

Session 08 geospatial data

  • 2. Lab 8: Your 5-7 things: • Geospatial data • Geospatial data tools • Vector map data • Raster map data • Geospatial calculations
  • 4. Geospatial Data o Geographical: related to the Earth’s surface o Spatial: about space (locations, distances etc) o Data: yep, this is also data o Usually handled by Geographical Information Systems (GIS) tools o …many of which are written in Python…
  • 8. Adding features to a vector map
  • 12. Coordinate systems • WGS84 (GIS) • OSGB36 (UK) • ED50 (Nato) • Etc.
  • 16. Geospatial data tools • Google Maps • OpenStreetMap • QGIS • CartoDB • ArcGIS • LeafletJS • MapBox Python libraries: • GDAL toolset • Shapely • Fiona • Basemap
  • 17. QGIS
  • 20. QGIS: Looking at the dataset
  • 23. QGIS: Getting Raster Map information
  • 24. QGIS: Raster map histogram
  • 26. Vector data formats • Spreadsheet (.csv, .xls) • Shapefile (.shp) • Keyhole markup language (.kml, .kmz) • Geojson and Topojson (.json) • GPS exchange format (.gpx) • OSM output files (.osm.bz2)
  • 27. Shapefiles • .shp: feature geometry (e.g. your dataset) • .shx: shape index • .dbf: shape attributes • .prj: projection • .shp.xml: metadata
  • 28. The GDAL toolset Example terminal-line tools: • OGR2OGR: convert between vector formats • GDALwarp: cookie-cut raster files • gdal_polygonize: convert raster to vector Python libraries: • gdal, ogr2ogr etc • fiona (“pythonic GDAL”)
  • 29. Reading shapefiles: the Fiona library from fiona import collection with collection('example_data/TZwards/TZwards.shp', 'r') as input: for f in input: print(f)
  • 30. Convert vector file formats: OGR2OGR From the terminal window: ogr2ogr f GeoJSON where "ADM0_A3 = 'YEM'" outfile.json ne_10m_admin_1_states_provinces.shp
  • 33. Raster Data Formats • GeoTiff (.tif) • Jpeg (.jpg) • NITF • HTF5
  • 35. Reading raster map data with GDAL import gdal import numpy as np dataset = gdal.Open(infile, GA_ReadOnly) cols = dataset.RasterXSize rows = dataset.RasterYSize nbands = dataset.RasterCount driver = dataset.GetDriver().LongName geotransform = dataset.GetGeoTransform() for b in range(1,nbands+1): band = dataset.GetRasterBand(b) bandtype = gdal.GetDataTypeName(band.DataType) banddata = band.ReadAsArray(0,0,band.XSize, band.YSize).astype(np.float)
  • 36. Raster + Vector: cookie-cut a raster map From the command line, type gdalwarp cutline yourshapefile.shp yourgeotiff.tif yourresult.tif
  • 38. Vector data calculations • Point location (e.g. lat/long from address) • Area and area overlap sizes (e.g. overlap between village and protected area) • Belonging (e.g. finding which district a lat/long is in) • Straight-line distance between points (e.g. great circles) • Practical distance and time between points (e.g. using roads)
  • 39. Geopy: get lat/ longs from addresses from geopy.geocoders import Nominatim from geopy.geocoders import GoogleV3 geolocator = Nominatim() googlocator = GoogleV3() address = '1600 Pennsylvania Ave NW, Washington, DC' result = geolocator.geocode(address, timeout=10) if result is None: result = googlocator.geocode(address, timeout=10) if result is None: latlon = (0.0, 0.0) else: latlon = (float(result.latitude), float(result.longitude))
  • 40. Geopy: Calculate distance from geopy.distance import vincenty dist = vincenty(loc1, loc2)
  • 41. Fiona point-in-polygon: finding “belonging” import fiona Import shapely mapdata = fiona.open(‘map_data/nyc_neighbourhoods_wgs84.shp’, 'r') for f in mapdata: props = f['properties'] geom = shapely.geometry.asShape(f['geometry']) neighs[props['NTACode']] = geom stationpt = Point(stationlon, stationlat) for neigh, neighshape in neighs.iteritems(): if neighshape.contains(stationpt): stationneigh = neigh
  • 42. Basemap: Map visualisations in Python %matplotlib inline import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap fig = plt.figure(figsize=(8, 8)) usmap = Basemap(projection='lcc', resolution=None, width=8000000, height=8000000,lat_0=45, lon_0=-100,) usmap.etopo(scale=0.5, alpha=0.5)
  • 44. If this interested you… There’s more in workbooks 8.x

Editor's Notes

  1. Note that spatial data doesn’t have to be geographical: it could be at much smaller (e.g. building) or larger (e.g. universe) level. There’s an estimate floating around GIS circles that at least 80% of data has a geospatial component.
  2. Printed maps are images depicting an area, that are often carefully created by hand (yes, there are people who spend hours working how to get those labels in just the right places). Road maps are a great example of the art of making map data easily readable by humans. Note, for instance, how the label “Tioga State Forest” has been carefully placed around the roads in the bottom left corner of this map. The University of Texas has a great raster map collection online, e.g. the Libya image is at http://www.lib.utexas.edu/maps/libya.html Road map is from http://www.austinques.com/znz-9683-poxq.htm For many places, the only detailed maps available are still printed maps. Many of the older maps were created by surveyors triangulating (as in forming triangles out of survey points and using the angles between them to estimate new distances) their way across countries, marking heights and features of interest. More recently, maps have been created using satellite-based positions, either from georeferenced satellite images (e.g. the satellite images have been stretched to match the lat-longs on an area, then roads etc have been traced onto the map) or by geographers using hand-held GPS units to mark the locations of places and features of interest.
  3. Left: An example of an aerial map. This image is from https://www.flickr.com/photos/jeffreywarren/4774701213/ - Jeff is part of PublicLab, a group that amongst other great citizen science projects, creates aerial maps using balloons, kites, ordinary cameras and rubber bands. You’re probably already aware of the satellite images in e.g. Google Maps, Bing maps etc. If you look closely, the PublicLab balloon maps are included in GoogleMaps etc too. Right: NASA satellite data for Tanzania, showing trees. NASA openly releases a *lot* of satellite data for the earth, at many different wavelengths, only one of which is visible light. The tree data is from a satellite that measures differences in height at the earth’s surface using radar; this was originally intended to measure polar ice depths, but turned out to be useful for measuring tree heights too. Other satellite data includes infrared, other radars (including wavelengths tuned to water frequencies), visible light, at intervals ranging from hourly. More at https://earthdata.nasa.gov
  4. Vector maps represent the world as a series of labelled points (e.g. the labelled subway stations in this map), lines (e.g. the roads in this map), and polygons (e.g. the building outlines in this map). Vector maps are easier to update and use than printed maps; most of the major vector maps (e.g. OpenStreetMap, GoogleMaps) also have APIs that you can use to find map features, feature locations and details.
  5. Some maps are community-based. For example, anyone can add or edit features on OpenStreetMap. Here, I’m using the ID editor to add buildings to an OpenStreetMap, as part of Humanitarian OpenStreetMap task http://tasks.hotosm.org/project/1686#task/48. HOT OSM puts out requests for editing (and verifying) help like this on the HOT tasking manager, http://tasks.hotosm.org.
  6. Some geospatial data images don’t map their features to the underlying lat/longs. The classic geospatial schematic is the London Underground map, shown here, which was created (using an electronics diagram as a template) to be easy to use by people looking for where they should change between underground lines to get between two points. Plotting the London Underground map so it’s realistic about lat/longs produces something a lot messier and harder for most people to read.
  7. You can add your own datapoints to both maps and schematics. Here’s the New York subway map, with the nearest good coffee shop (subjective!) to each subway station. Image: http://www.businessinsider.com/nyc-best-coffee-shops-by-subway-stop-2014-2
  8. Maps, like datasets, are intensely political, and when you look at a map, you need to ask similar questions to when you look at a dataset: who created this, what did they create it for, what were their biases, what was important to them. One of the things you need to be aware of is map projections: “projection” because you’re trying to represent all or part of an oblate spheroid (squished ball) as a flat image. Here are two maps of the world, from http://geoawesomeness.com/map-distortions/ The one on the left uses the Mercator projection: designed for sailors, so when they wanted to sail between two points on the world, they could read the angle (direction) they needed to sail in from the map. This is great for sailors, but terrible for geopolitics: it shows the USA as much larger than Africa, South America and Australia, all of which, in reality, are huge. The map on the right uses the Gall-Peters projection: this would be terrible for sailors, but does a much better job at showing the relative area size of each continent. Note incidentally that both maps are north-up and centred on the UK, which splits the Pacific Ocean in two.
  9. Projections also matter on a smaller scale. When you’re dealing with map data, you also need to know the coordinate system it’s in. Maps, and the coordinate systems they’re in, are created by fitting a flat plane to the world in one of 3 ways (it helps at this point to think about how you’d wrap a ball using a sheet of paper): a tangent plane that touches the world at a specific location on earth, a cylinder wrapped around the world, or a cone wrapped around part of the world, with its point at a specific location on earth. Each of these will produce different lat/long numbers for the same point on the earth’s surface – which means that, in most GPS coordinate systems, the Greenwich Meridian (the 0 line from north pole to south pole) is about 100m to the West. To make this even more complicated, parts of the Earth are also moving (blame the tectonic plates…). QGIS can convert between coordinate systems, if you’re combining GIS data from different ones. Image from http://www.movable-type.co.uk/scripts/latlong-convert-coords.html More: https://en.wikipedia.org/wiki/Geographic_coordinate_system
  10. And we’re done with map views… except we’re not, because Tableau only contains country outlines and USA outline data. If we want to cover other places in the world, we’re going to need another tool.
  11. QGIS is a map data viewer, but it’s Python-based, and also has GIS data tools hidden inside it.
  12. File used here is TZwards.shp
  13. This uses data file Tzwards.shp
  14. Right-click on the name of the layer (e.g. TzWards), then select “open attribute table”
  15. Here’s your dataset. You can also change what’s displayed using the “Properties” option, and save this layer to a different data format (e.g. CSV).
  16. File is TreeCover_250m_MODIS_Tanzania_2010.tif
  17. Shapefiles are very common vector map formats. KMZ files are zipped versions of KML files. OpenStreetMap uses GPX as its internal data representation. Geojson and Topojson are commonly used in D3 GIS code.
  18. For most tools, you’ll only need the .shp and .shx file. For some tools, you need the .shp, .shx and .dbf. More about all those files: https://en.wikipedia.org/wiki/Shapefile
  19. List of GDAL tools at http://www.gdal.org/gdal_utilities.html. Get these from http://www.gdal.org, unless you’re a mac user, in which case try http://www.kyngchaos.com/software/archive#gdal
  20. Fiona needs both the .shp and .shx file. You’ll recognise the output as a dictionary. Intro to Fiona and Shapely: http://www.macwright.org/2012/10/31/gis-with-python-shapely-fiona.html
  21. OGR2OGR is part of the GDAL toolset. This code filters and converts a shapefile to geojson. Ne_10m_admin_1_states_provinces.shp is a shapefile from the NaturalEarth.com shapefile collection: this file has all the provinces (states) in all the countries in the world in it. You can also do this in Python, e.g. import ogr2ogr ogr2ogr.main([‘’,'­f','GeoJSON','test2.json',‘TZwards.shp'])” The Ogr2ogr formats list is: http://www.gdal.org/ogr_formats.html
  22. Most of the time, you’ll see tif and jpg images. If you’re handling satellite data, NITF and HTF5 are common. More at https://www.bluemarblegeo.com/products/global-mapper-formats-raster.php Most raster data files have “bands” in them: often 1 band (e.g. those tree heights), but sometimes 3 (red/green/blue) or more (e.g. monthly rainfall numbers).
  23. If you zoom into a Geotiff file, you’ll see something like this. Lots of pixels, with a greyscale (usually between 0 and 127) value for each pixel. This is just like an image file – and you can using image processing code on geotiff files too.
  24. You need: A shapefile with the outline in it: both the .shp and .shx files a Geotiff (or other) file that needs cookie­cutting, IN THE SAME COORDINATE SYSTEM as the shapefile. The result is in file yourresult.tif. The GDAL library has cookie­cutters as part of its Gdalwarp library. Shapefile restriction applies to other tech too, e.g. Arcview won’t display a shape if you don’t give it .shp, .shx and .dbf files. where yourshapefile.shp is the shapefile you’re using as an outline, and yourgeotiff.tif is the file that you want to cookie­cut. You can also cookie-cut with QGIS: see http://www.qgistutorials.com/en/docs/raster_mosaicing_and_clipping.html
  25. You can also use postcodes, e.g. Country = ‘US’ Postcode = ‘20500’ result = googlocator.geocode(‘’, components={'postal_code': postcode, 'country': country}, timeout=10)
  26. Great circle distances: map straight lines aren’t shortest paths Nautical miles aren’t land miles – and aren’t constant lengths
  27. This is an extract from a larger file: it won’t run on its own (you need the station lat/longs, in stationlat and stationlon).
  28. You can also do choropleths in Python: http://matplotlib.org/basemap/api/basemap_api.html#mpl_toolkits.basemap.Basemap.contour