SlideShare a Scribd company logo
Using Python to Analyze
Spatial Data
Juan Carlos Méndez
CTO @gkudos
juan@gkudos.com
Topics
● Spatial Data?
● Python?
● Visualizing Geodata
● Analyzing Geodata (Basics)
About me
● Juan Carlos Méndez
○ CTO at @gkudos
○ GIS Consultant
○ Software Architect / Programmer / “Data Engineer”
○ https://github.com/dersteppenwolf
● Education
○ Systems Engineer- Universidad Nacional de Colombia, Bogotá
○ Telematics / eBusiness specialist - Escuela Colombiana de ingeniería
○ Information Engineering (Student) - Universidad de los Andes
https://github.com/dersteppenwolf/pycon
Requirements
● Qgis ( http://www.qgis.org/es/site/ )
pip install -r requirements.txt
brew install mapnik
brew install spatialindex
Spatial Data?
Location, location, location!
“You can buy the right
home in the wrong
location. You can change
the structure, remodel it or
alter the home's layout
but, ordinarily, you cannot
move it. It's attached to the
land”
http://bit.ly/2fz2ySD
Spatio-temporal data
“...in Google, about 25 PB of data is
being generated per day, and a
significant portion of the data falls into
the realm of spatio-temporal data...”
Lee, J.-G., & Kang, M. (2015). Geospatial Big Data:
Challenges and Opportunities. Big Data Research, 2(2),
74–81. http://doi.org/10.1016/j.bdr.2015.01.003
What for?
Using python to analyze spatial data
Using python to analyze spatial data
15 Global challenges
facing humanity
http://www.millennium-project.org/
millennium/challeng.html
How?
Using python to analyze spatial data
Using python to analyze spatial data
Using python to analyze spatial data
Using python to analyze spatial data
But...
What is Spatial Data?
Spatial Data
● Located on the surface of the
earth
● Coordinate Systems
GIS (Geographic Information
Systems)
● Body of Knowledge
● Tools
● Science
Spatial is special?
Yes:
● Multidimensional
● Voluminous
● Special methods for analysis
● Updating: Slow, complex and expensive
“Everything is related to everything else, but near
things are more related than distant things”
Tobler, W. 1970. A
Spatial is special?
No:
● “spatial is not special, it’s just another column in the
database...” Michael Terner
http://bit.ly/2jZAWav
Spatial Data: Vector vs Raster
Vector
http://gisgeography.com/spatial-data-types-vector-raster/
Spatial Data: Vector vs Raster
Map projection
“...formal process which
converts features between a
spherical or ellipsoidal surface
and a projection surface,
which is often flat…”
http://bit.ly/2bA9Szk
Using python to analyze spatial data
Using python to analyze spatial data
Spatial Data - File Formats
...lots… (open and proprietary)...
● Shapefile
● Geojson
● KML
● Filegeodatabase
● Geotiff
● Geopackage
● Spatialite
● … ...
Spatial is special?
...It can be complex...
… using python it will be more fun and easy…
Python?
Python for Geospatial Data
Lots of…
● Tools / Libraries
● Propietary / Open
● Desktop / Server
● Analysis / Visualization / ETL
Python for Geospatial Data
ESRI
● Arcpy
○ Desktop: Automation / Customization. E.g. CartoDB Toolbox : Import Data From
to Carto
○ Server: Geoprocessing as a “Web Service”
● Arcgis Web : ArcGIS API for Python (2017)
QGIS
● Open source desktop GIS Tool written in C++, Python, Qt
● QGIS API E.g. CartoDB Plugin for QGis
● PyQGIS: Scripting using Python
● Server: Qgis Server python plugins
Python for Geospatial Data
● CKAN - web-based open source management system for the storage and
distribution of open data (including geospatial data).
● GeoDjango - storing and manipulating geographic data using the Django ORM
● Geonode - web-based application and platform for developing geospatial
information systems (GIS) and for deploying spatial data infrastructures (SDI)
Python for Geospatial Data
● pyshp - For reading and writing shapefiles (in pure Python)
● pyproj - For conversions between projections
● shapely - For geometry handling
● fiona - For making it easy to read/write geospatial data formats
● ogr/gdal - For reading, writing, and transforming geospatial data formats *
● Rasterio - reads and writes geospatial raster datasets
Show me the code
Using python to analyze spatial data
Describe Data
data/world_borders
Using python to analyze spatial data
Using python to analyze spatial data
Fiona
● https://github.com/Toblerity/Fiona
● Fiona is OGR's neat and nimble API for Python programmers.
● Fiona does reading and writing data formats. For this it uses OGR, the most
popular open-source conversion system
● The OGR Simple Features Library is a C++ open source library providing read
(and sometimes write) access to a variety of vector file formats including ESRI
Shapefiles, S-57, SDTS, PostGIS, Oracle Spatial, and Mapinfo mid/mif and TAB
formats.
Using python to analyze spatial data
Data Format Conversion
From CSV to SHP
Shapely
● https://github.com/Toblerity/Shapely
● Manipulation and analysis of geometric objects in the Cartesian plane
● With Shapely, you can do things like buffers, unions, intersections, centroids,
convex hulls, and lots more.
Using python to analyze spatial data
Using python to analyze spatial data
Geocoding
What is geocoding?
● Geocoding is the process of transforming a description of a location—such as a
pair of coordinates, an address, or a name of a place—to a location on the
earth's surface. http://arcg.is/2kUedk7
GeoPy
● https://github.com/geopy/geopy
● geopy makes it easy for Python developers to locate the coordinates of
addresses, cities, countries, and landmarks across the globe using third-party
geocoders and other data sources
● geopy includes geocoder classes for the OpenStreetMap Nominatim, ESRI
ArcGIS, Google Geocoding API (V3), Baidu Maps, Bing Maps API, Mapzen
Search, Yandex, IGN France, GeoNames, NaviData, OpenMapQuest,
What3Words, OpenCage, SmartyStreets, geocoder.us, and GeocodeFarm
geocoder services.
Using python to analyze spatial data
Reverse Geocoding
Using python to analyze spatial data
Visualize?
Mapnik
● http://mapnik.org/
● the core of geospatial visualization & processing
● mapnik combines pixel-perfect image output with lightning-fast cartographic
algorithms, and exposes interfaces in C++, Python, and Node.
Mapnik
● Installing Mapnik on OS X with Homebrew
https://github.com/mapnik/mapnik/wiki/MacInstallation_Homebrew
○ brew install mapnik
● Python bindings for mapnik https://github.com/mapnik/python-mapnik
● Stacks built with mapnik: OpenStreetMap , Mapbox , CartoDB , Stamen ,
MapQuest , Kosmtik
Mapnik
Basics
Using python to analyze spatial data
Mapnik - XML
Using python to analyze spatial data
Mapnik
Complex Styles
Using python to analyze spatial data
Mapnik
Markers
Using python to analyze spatial data
Mapnik
Composite
Compositing operations affect the way
colors and textures of different elements
and styles interact with each other.
Two main categories: color and alpha
E.g. Multiply literally multiplies the color of
the top layer by the color of each layer
beneath, which usually means overlapping
areas become darker.
Using python to analyze spatial data
What is Spatial Analysis?
Spatial Analysis
Geospatial data is more than maps!
What is Geoprocessing:?
● Geoprocessing is any GIS operation used to manipulate data.
● A typical geoprocessing operation takes an input dataset, performs an
operation on that dataset, and returns the result of the operation as an output
dataset, also referred to as derived data.
● Common geoprocessing operations: geographic feature overlay, feature
selection and analysis, topology processing, and data conversion.
● Geoprocessing allows you to define, manage, and analyze geographic
information used to make decisions.
● http://bit.ly/2k8l3P8
Spatial Analysis
● Spatial analysis includes
any of the formal
techniques which study
entities using their
topological, geometric,
or geographic
properties.
Spatial Analysis
Using python to analyze spatial data
Using python to analyze spatial data
Jupyter
● http://jupyter.org/
● web application that allows you to create
and share documents that contain live
code, equations, visualizations and
explanatory text
● Uses include: data cleaning and
transformation, numerical simulation,
statistical modeling, machine learning
and much more
Geopandas
● https://github.com/geopandas/geopandas
● pandas is an open source, BSD-licensed library providing high-performance,
easy-to-use data structures and data analysis tools for the Python
programming language.
● GeoPandas is a project to add support for geographic data to pandas objects.
PySAL
● https://github.com/pysal/pysal
● PySAL: Python Spatial Analysis Library
● Sub-packages
pysal.cg – Computational Geometry
pysal.core — Core Data Structures and IO
pysal.esda — Exploratory Spatial Data Analysis
pysal.inequality — Spatial Inequality Analysis
pysal.region — Spatially Constrained Clustering
pysal.spatial_dynamics — Spatial Dynamics
pysal.spreg — Regression and Diagnostics
pysal.weights — Spatial Weights
pysal.network — Network Constrained Analysis
pysal.contrib – Contributed Modules
Using python to analyze spatial data
Using python to analyze spatial data
Using python to analyze spatial data
Geoprocessing
Geoprocessing
● Spatial Joins
● Data Clipping
● Data Enrichment
● Data filtering
● Spatial Analysis
data/ideca/Loca.shp
Localidades, Bogotá
data/ideca/sitios_interes.shp
Sitios de Interés, Bogotá
data/ideca/clasificacion_sitios_interes.csv
Using python to analyze spatial data
juan@gkudos.com http://gkudos.com/
info@gkudos.com
Thanks!!

More Related Content

PPTX
OpenLayer's basics
Oleksii Prohonnyi
 
PPTX
Python in geospatial analysis
Sakthivel R
 
PPTX
Introduction to gis
Habibur Rahman
 
PPTX
Open layers
Janak Parajuli
 
PPTX
TYBSC IT PGIS Unit I Chapter I- Introduction to Geographic Information Systems
Arti Parab Academics
 
PDF
Spatial Analysis and Geomatics
Rich Heimann
 
PDF
An introduction to geographic information systems (gis) m goulbourne 2007
Michelle Goulbourne @ DiaMind Health
 
PDF
GeoServer, an introduction for beginners
GeoSolutions
 
OpenLayer's basics
Oleksii Prohonnyi
 
Python in geospatial analysis
Sakthivel R
 
Introduction to gis
Habibur Rahman
 
Open layers
Janak Parajuli
 
TYBSC IT PGIS Unit I Chapter I- Introduction to Geographic Information Systems
Arti Parab Academics
 
Spatial Analysis and Geomatics
Rich Heimann
 
An introduction to geographic information systems (gis) m goulbourne 2007
Michelle Goulbourne @ DiaMind Health
 
GeoServer, an introduction for beginners
GeoSolutions
 

What's hot (20)

PPTX
GIS file types
Hans van der Kwast
 
PDF
Spatio-Temporal Database and Its Models: A Review
IOSR Journals
 
PPTX
Spatial Database
District Administration
 
PPTX
Introduction to OpenStreetMap
Kate Chapman
 
PDF
Spatial analysis and Analysis Tools
Swapnil Shrivastav
 
PDF
QGIS training class 3
Hiroaki Sengoku
 
PPT
Gis Day Presentation 2010 - ACCC - Expanded Version
pdcaris
 
PPTX
WEB GIS AND WEB MAP.pptx
Asim Pt
 
PDF
Components of Spatial Data Quality in GIS
Kaium Chowdhury
 
PPTX
Spatial Database and Database Management System
Lal Mohammad
 
PPTX
Spatial analysis and modeling
Tolasa_F
 
PDF
Introduction to-arc map
Ashok Peddi
 
PPTX
DATABASE & WEBGIS - GIS BOOTCAMP
Kevin Ng'eno
 
PPT
Introduction to Geographic Information System (GIS)
Shashank Singh
 
DOCX
Heads up digitization- ON THE FLY- GIS
Sadia Rahat
 
PPT
Accuracy of UAV Photogrammetry
baselinesurvey
 
PDF
Network analysis in gis , part 2 connectivity rules
Department of Applied Geology
 
PPTX
My ppt on gis
gargsonakshi1
 
PPT
GIS - lecture-1.ppt
sapna kinattinkara
 
GIS file types
Hans van der Kwast
 
Spatio-Temporal Database and Its Models: A Review
IOSR Journals
 
Spatial Database
District Administration
 
Introduction to OpenStreetMap
Kate Chapman
 
Spatial analysis and Analysis Tools
Swapnil Shrivastav
 
QGIS training class 3
Hiroaki Sengoku
 
Gis Day Presentation 2010 - ACCC - Expanded Version
pdcaris
 
WEB GIS AND WEB MAP.pptx
Asim Pt
 
Components of Spatial Data Quality in GIS
Kaium Chowdhury
 
Spatial Database and Database Management System
Lal Mohammad
 
Spatial analysis and modeling
Tolasa_F
 
Introduction to-arc map
Ashok Peddi
 
DATABASE & WEBGIS - GIS BOOTCAMP
Kevin Ng'eno
 
Introduction to Geographic Information System (GIS)
Shashank Singh
 
Heads up digitization- ON THE FLY- GIS
Sadia Rahat
 
Accuracy of UAV Photogrammetry
baselinesurvey
 
Network analysis in gis , part 2 connectivity rules
Department of Applied Geology
 
My ppt on gis
gargsonakshi1
 
GIS - lecture-1.ppt
sapna kinattinkara
 
Ad

Similar to Using python to analyze spatial data (20)

PDF
Pycon 2012 Taiwan
Dongpo Deng
 
PDF
那些年 Python 攻佔了 GIS / The Year Python Takes Over GIS
pycontw
 
PDF
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
Martin Christen
 
PDF
PyDX Presentation about Python, GeoData and Maps
Hannes Hapke
 
PPTX
Geographical information system
Naresh Kumar
 
PPTX
R programming language in spatial analysis
Abhiram Kanigolla
 
PDF
Spatial_Data_Analysis_with_open_source_softwares[1]
Joachim Nkendeys
 
PPT
GIS_Whirlwind_Tour.ppt
Fatima891926
 
PPT
GIS_Whirlwind_Tour.ppt
vikramvsu
 
PPT
GIS_Whirlwind_Tour.ppt
GodwinKingNyamador
 
PPT
GIS_Whirlwind_Tour.ppt
safayetmim1
 
PPTX
GIS Level 1 Introduction to GIS and Mapping
MohamudJama6
 
PDF
Unit3 slides
Larefa Bidoun
 
PDF
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
 
PPTX
Geo data analytics
Daniel Marcous
 
PPTX
Unit 4 Data Input and Analysis.pptx
e20ag004
 
PPTX
123_BASICSAND FUNDAMENTASL OF gisrs.pptx
ManjuT17
 
PDF
Introduction to Geospatial Data
NopphawanTamkuan
 
PPTX
Session 08 geospatial data
bodaceacat
 
PPTX
Session 08 geospatial data
Sara-Jayne Terp
 
Pycon 2012 Taiwan
Dongpo Deng
 
那些年 Python 攻佔了 GIS / The Year Python Takes Over GIS
pycontw
 
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
Martin Christen
 
PyDX Presentation about Python, GeoData and Maps
Hannes Hapke
 
Geographical information system
Naresh Kumar
 
R programming language in spatial analysis
Abhiram Kanigolla
 
Spatial_Data_Analysis_with_open_source_softwares[1]
Joachim Nkendeys
 
GIS_Whirlwind_Tour.ppt
Fatima891926
 
GIS_Whirlwind_Tour.ppt
vikramvsu
 
GIS_Whirlwind_Tour.ppt
GodwinKingNyamador
 
GIS_Whirlwind_Tour.ppt
safayetmim1
 
GIS Level 1 Introduction to GIS and Mapping
MohamudJama6
 
Unit3 slides
Larefa Bidoun
 
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
 
Geo data analytics
Daniel Marcous
 
Unit 4 Data Input and Analysis.pptx
e20ag004
 
123_BASICSAND FUNDAMENTASL OF gisrs.pptx
ManjuT17
 
Introduction to Geospatial Data
NopphawanTamkuan
 
Session 08 geospatial data
bodaceacat
 
Session 08 geospatial data
Sara-Jayne Terp
 
Ad

More from Kudos S.A.S (20)

PDF
AWS - Ingrese a la era de las bases de datos personalizadas: Encuentre la bas...
Kudos S.A.S
 
PDF
Miradas al exterior.
Kudos S.A.S
 
PDF
Bringing GEOSS services into Practice for Beginners: GeoNode Tutorial
Kudos S.A.S
 
PDF
Uso de Tecnologías Geoespaciales y Big Data para mejorar los procesos de actu...
Kudos S.A.S
 
PDF
Proyecto Mapa Nacional de Amenaza Relativa por Movimientos en Masa
Kudos S.A.S
 
PDF
Presentación software libre v2
Kudos S.A.S
 
PDF
A Web Application Designed to Publish Information of Surface Manifestations o...
Kudos S.A.S
 
PDF
Portafolio Empresarial Egresados Universidad Nacional de Colombia 2013
Kudos S.A.S
 
PDF
Conferencias ACIS: Análisis y visualización de información georreferenciada u...
Kudos S.A.S
 
PDF
Implementación de Fábricas de Software en el Sector Público Colombiano
Kudos S.A.S
 
PDF
Presentacion SNC : Sistema Nacional Catastral de Colombia
Kudos S.A.S
 
PDF
Analizando y visualizando información geoespacial utilizando cloud computing
Kudos S.A.S
 
PDF
Manejo de información raster_en_post_gis-2.0-
Kudos S.A.S
 
PDF
Crowd-sourcing free and open geographic data: information poverty solutions f...
Kudos S.A.S
 
PPT
Software libre y Sistemas de Información Geográfica
Kudos S.A.S
 
PPT
Modelamiento en Web de Geoinformación de la Amazonía Colombiana con el uso de...
Kudos S.A.S
 
PDF
Kudos Flashcamp Bogota 2009
Kudos S.A.S
 
PPT
Geo Marketing, ¿Herramienta o Gadget?:
Kudos S.A.S
 
PDF
Integración de Adobe Flex y Google Maps: Aplicaciones Geográficas Enriquecida...
Kudos S.A.S
 
PPT
Fundamentos VB - VBA
Kudos S.A.S
 
AWS - Ingrese a la era de las bases de datos personalizadas: Encuentre la bas...
Kudos S.A.S
 
Miradas al exterior.
Kudos S.A.S
 
Bringing GEOSS services into Practice for Beginners: GeoNode Tutorial
Kudos S.A.S
 
Uso de Tecnologías Geoespaciales y Big Data para mejorar los procesos de actu...
Kudos S.A.S
 
Proyecto Mapa Nacional de Amenaza Relativa por Movimientos en Masa
Kudos S.A.S
 
Presentación software libre v2
Kudos S.A.S
 
A Web Application Designed to Publish Information of Surface Manifestations o...
Kudos S.A.S
 
Portafolio Empresarial Egresados Universidad Nacional de Colombia 2013
Kudos S.A.S
 
Conferencias ACIS: Análisis y visualización de información georreferenciada u...
Kudos S.A.S
 
Implementación de Fábricas de Software en el Sector Público Colombiano
Kudos S.A.S
 
Presentacion SNC : Sistema Nacional Catastral de Colombia
Kudos S.A.S
 
Analizando y visualizando información geoespacial utilizando cloud computing
Kudos S.A.S
 
Manejo de información raster_en_post_gis-2.0-
Kudos S.A.S
 
Crowd-sourcing free and open geographic data: information poverty solutions f...
Kudos S.A.S
 
Software libre y Sistemas de Información Geográfica
Kudos S.A.S
 
Modelamiento en Web de Geoinformación de la Amazonía Colombiana con el uso de...
Kudos S.A.S
 
Kudos Flashcamp Bogota 2009
Kudos S.A.S
 
Geo Marketing, ¿Herramienta o Gadget?:
Kudos S.A.S
 
Integración de Adobe Flex y Google Maps: Aplicaciones Geográficas Enriquecida...
Kudos S.A.S
 
Fundamentos VB - VBA
Kudos S.A.S
 

Recently uploaded (20)

PPTX
EU POPs Limits & Digital Product Passports Compliance Strategy 2025.pptx
Certivo Inc
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PPT
Order to Cash Lifecycle Overview R12 .ppt
nbvreddy229
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PPTX
Services offered by Dynamic Solutions in Pakistan
DaniyaalAdeemShibli1
 
PPTX
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PDF
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
Michael624841
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
EU POPs Limits & Digital Product Passports Compliance Strategy 2025.pptx
Certivo Inc
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
Order to Cash Lifecycle Overview R12 .ppt
nbvreddy229
 
Exploring AI Agents in Process Industries
amoreira6
 
Services offered by Dynamic Solutions in Pakistan
DaniyaalAdeemShibli1
 
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
A REACT POMODORO TIMER WEB APPLICATION.pdf
Michael624841
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 

Using python to analyze spatial data

  • 1. Using Python to Analyze Spatial Data Juan Carlos Méndez CTO @gkudos [email protected]
  • 2. Topics ● Spatial Data? ● Python? ● Visualizing Geodata ● Analyzing Geodata (Basics)
  • 3. About me ● Juan Carlos Méndez ○ CTO at @gkudos ○ GIS Consultant ○ Software Architect / Programmer / “Data Engineer” ○ https://github.com/dersteppenwolf ● Education ○ Systems Engineer- Universidad Nacional de Colombia, Bogotá ○ Telematics / eBusiness specialist - Escuela Colombiana de ingeniería ○ Information Engineering (Student) - Universidad de los Andes
  • 4. https://github.com/dersteppenwolf/pycon Requirements ● Qgis ( http://www.qgis.org/es/site/ ) pip install -r requirements.txt brew install mapnik brew install spatialindex
  • 6. Location, location, location! “You can buy the right home in the wrong location. You can change the structure, remodel it or alter the home's layout but, ordinarily, you cannot move it. It's attached to the land” http://bit.ly/2fz2ySD
  • 7. Spatio-temporal data “...in Google, about 25 PB of data is being generated per day, and a significant portion of the data falls into the realm of spatio-temporal data...” Lee, J.-G., & Kang, M. (2015). Geospatial Big Data: Challenges and Opportunities. Big Data Research, 2(2), 74–81. http://doi.org/10.1016/j.bdr.2015.01.003
  • 11. 15 Global challenges facing humanity http://www.millennium-project.org/ millennium/challeng.html
  • 12. How?
  • 18. Spatial Data ● Located on the surface of the earth ● Coordinate Systems GIS (Geographic Information Systems) ● Body of Knowledge ● Tools ● Science
  • 19. Spatial is special? Yes: ● Multidimensional ● Voluminous ● Special methods for analysis ● Updating: Slow, complex and expensive “Everything is related to everything else, but near things are more related than distant things” Tobler, W. 1970. A
  • 20. Spatial is special? No: ● “spatial is not special, it’s just another column in the database...” Michael Terner http://bit.ly/2jZAWav
  • 21. Spatial Data: Vector vs Raster
  • 23. Spatial Data: Vector vs Raster
  • 24. Map projection “...formal process which converts features between a spherical or ellipsoidal surface and a projection surface, which is often flat…” http://bit.ly/2bA9Szk
  • 27. Spatial Data - File Formats ...lots… (open and proprietary)... ● Shapefile ● Geojson ● KML ● Filegeodatabase ● Geotiff ● Geopackage ● Spatialite ● … ...
  • 28. Spatial is special? ...It can be complex... … using python it will be more fun and easy…
  • 30. Python for Geospatial Data Lots of… ● Tools / Libraries ● Propietary / Open ● Desktop / Server ● Analysis / Visualization / ETL
  • 31. Python for Geospatial Data ESRI ● Arcpy ○ Desktop: Automation / Customization. E.g. CartoDB Toolbox : Import Data From to Carto ○ Server: Geoprocessing as a “Web Service” ● Arcgis Web : ArcGIS API for Python (2017) QGIS ● Open source desktop GIS Tool written in C++, Python, Qt ● QGIS API E.g. CartoDB Plugin for QGis ● PyQGIS: Scripting using Python ● Server: Qgis Server python plugins
  • 32. Python for Geospatial Data ● CKAN - web-based open source management system for the storage and distribution of open data (including geospatial data). ● GeoDjango - storing and manipulating geographic data using the Django ORM ● Geonode - web-based application and platform for developing geospatial information systems (GIS) and for deploying spatial data infrastructures (SDI)
  • 33. Python for Geospatial Data ● pyshp - For reading and writing shapefiles (in pure Python) ● pyproj - For conversions between projections ● shapely - For geometry handling ● fiona - For making it easy to read/write geospatial data formats ● ogr/gdal - For reading, writing, and transforming geospatial data formats * ● Rasterio - reads and writes geospatial raster datasets
  • 34. Show me the code
  • 40. Fiona ● https://github.com/Toblerity/Fiona ● Fiona is OGR's neat and nimble API for Python programmers. ● Fiona does reading and writing data formats. For this it uses OGR, the most popular open-source conversion system ● The OGR Simple Features Library is a C++ open source library providing read (and sometimes write) access to a variety of vector file formats including ESRI Shapefiles, S-57, SDTS, PostGIS, Oracle Spatial, and Mapinfo mid/mif and TAB formats.
  • 43. From CSV to SHP
  • 44. Shapely ● https://github.com/Toblerity/Shapely ● Manipulation and analysis of geometric objects in the Cartesian plane ● With Shapely, you can do things like buffers, unions, intersections, centroids, convex hulls, and lots more.
  • 48. What is geocoding? ● Geocoding is the process of transforming a description of a location—such as a pair of coordinates, an address, or a name of a place—to a location on the earth's surface. http://arcg.is/2kUedk7
  • 49. GeoPy ● https://github.com/geopy/geopy ● geopy makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources ● geopy includes geocoder classes for the OpenStreetMap Nominatim, ESRI ArcGIS, Google Geocoding API (V3), Baidu Maps, Bing Maps API, Mapzen Search, Yandex, IGN France, GeoNames, NaviData, OpenMapQuest, What3Words, OpenCage, SmartyStreets, geocoder.us, and GeocodeFarm geocoder services.
  • 54. Mapnik ● http://mapnik.org/ ● the core of geospatial visualization & processing ● mapnik combines pixel-perfect image output with lightning-fast cartographic algorithms, and exposes interfaces in C++, Python, and Node.
  • 55. Mapnik ● Installing Mapnik on OS X with Homebrew https://github.com/mapnik/mapnik/wiki/MacInstallation_Homebrew ○ brew install mapnik ● Python bindings for mapnik https://github.com/mapnik/python-mapnik ● Stacks built with mapnik: OpenStreetMap , Mapbox , CartoDB , Stamen , MapQuest , Kosmtik
  • 64. Mapnik Composite Compositing operations affect the way colors and textures of different elements and styles interact with each other. Two main categories: color and alpha E.g. Multiply literally multiplies the color of the top layer by the color of each layer beneath, which usually means overlapping areas become darker.
  • 66. What is Spatial Analysis?
  • 67. Spatial Analysis Geospatial data is more than maps! What is Geoprocessing:? ● Geoprocessing is any GIS operation used to manipulate data. ● A typical geoprocessing operation takes an input dataset, performs an operation on that dataset, and returns the result of the operation as an output dataset, also referred to as derived data. ● Common geoprocessing operations: geographic feature overlay, feature selection and analysis, topology processing, and data conversion. ● Geoprocessing allows you to define, manage, and analyze geographic information used to make decisions. ● http://bit.ly/2k8l3P8
  • 68. Spatial Analysis ● Spatial analysis includes any of the formal techniques which study entities using their topological, geometric, or geographic properties.
  • 72. Jupyter ● http://jupyter.org/ ● web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text ● Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more
  • 73. Geopandas ● https://github.com/geopandas/geopandas ● pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language. ● GeoPandas is a project to add support for geographic data to pandas objects.
  • 74. PySAL ● https://github.com/pysal/pysal ● PySAL: Python Spatial Analysis Library ● Sub-packages pysal.cg – Computational Geometry pysal.core — Core Data Structures and IO pysal.esda — Exploratory Spatial Data Analysis pysal.inequality — Spatial Inequality Analysis pysal.region — Spatially Constrained Clustering pysal.spatial_dynamics — Spatial Dynamics pysal.spreg — Regression and Diagnostics pysal.weights — Spatial Weights pysal.network — Network Constrained Analysis pysal.contrib – Contributed Modules
  • 79. Geoprocessing ● Spatial Joins ● Data Clipping ● Data Enrichment ● Data filtering ● Spatial Analysis
  • 80. data/ideca/Loca.shp Localidades, Bogotá data/ideca/sitios_interes.shp Sitios de Interés, Bogotá data/ideca/clasificacion_sitios_interes.csv