SlideShare a Scribd company logo
Looking into the past -
feature extraction from
historic maps using Python,
OpenCV and PostGIS.
ESRC ADRC-S
• Administrative Data Research Centre – Scotland (ADRC-S)
• part of the Administrative Data Research Network (ADRN)
• An ESRC Data Investment
• 12 ADRC-S Work Packages
• EDINA working on WP5 - Provision of Geocoding and Georeferencing
tools
What and Why?
• Prof(s) Chris Dibben and Jamie Pearce from UoE GeoSciences
• Effects of past environmental conditions on (longitudinal) population
cohorts
• Trains – where (and which populations) did they run alongside in the past
and bring their air pollution
• Urban - did past populations live in predominantly urban or rural locales –
were these same populations experiencing urbanisation
• Industry - where were particular types of (polluting) industry located?
• Greenspace and Bluespace – e.g. Parks and Water
Historic Maps – a record of
past landscapes
• ADRC`s remit is (all) of Scotland.
• Manual capture (digitising) of features from historic maps not going to
scale given resources available.
• Chris and Jamie`s challenge to EDINA – is it possible to automagically
capture features from historic maps?
• Historic maps in Digimap historic
• For the purpose of this work we are using (higher quality) full colour scans
of historic maps provided by Chris Fleet @ NLS
• Mainly been looking at 2 map series provided by NLS
• http://maps.nls.uk/geo/explore/#zoom=15&lat=55.9757&lon=-3.1799&laye
rs=168
• http://maps.nls.uk/geo/explore/#zoom=15&lat=55.9757&lon=-3.1799&laye
rs=10
Environment
• Linux (Ubuntu)
• Python (3)
• Virtualenv – isolated Python environments
• PyCharm Python IDE (Community Edition)
• OpenCV – Computer Vision / Image Processing / Image Analysis
• PostgreSQL - Datastore
• PostGIS – Spatial query (analysis) engine
• QGIS – Desktop GIS / PostGIS data viewer
• (a bit of) ArcGIS for ArcScan (Line vectorization)
OpenCV
OpenCV (Open Source Computer Vision) is a library of programming
functions mainly aimed at real-time computer vision
Python Libraries used
• numpy - numpy (array) data structures central to all other libraries where
we are manipulating image / raster datasets via python
• cv2 - python interface to OpenCV
• Shapely – (GEOS based) package for manipulation and analysis of
planar geometric objects.
• Fiona – (F)ile (i)nput (o)utput (n)o (a)nalysis. An alternative API to OGR to
access and write vector GIS datasets e.g. Shapefiles / GeoJSON.
• Rasterio – Raster (i)nput (o)utput. Rasteio is to raster GIS datasets as
Fiona is to vector GIS datasets.
• Snaql – Keep (templated) SQL query blocks seperate from python code
and render (with context) the query block when needed.
assuming PostGIS, if you add in a map renderer like mapnik, then this lot
gives you everything needed to do geospatial data analysis (raster and
vector), data conversion, data management and map automation.
Python OpenCV Demo
• Load image
• Changing colourspaces – convert colour image to greyscale
• Threshold image – partition greyscale image into bilevel foreground
(white) and background (black) regions to simplify things.
• Finding image contours. Contour (lines) seperate foreground regions
from background regions. Having traced contours we can describe
shape/size etc of foreground regions and relationship between
regions.
• Finding patterns / classifying features
Apply similar processes to
historic maps to extract
geographic features
(1) Water features (Bluespace)
(2) Railways
(3) Urban Form / Change
#15759 – extract 'bluespace'
(1) Water features (Bluespace)
Rivers / Canals / inland water shown as
blue lines or stippled blue areas.
Find contours – each
stipple mark / line forms a
contour
Threshold to isolate blue
pixels
Contours form a
hierarchy. Parents that
hold child contours are
water regions.
Method 2
Process breaks down when water regions are
not entirely bound by blue lines or broken by
other features (bridges).
So (alternative method) find every individual
stipple and then forming groups of these gives
water regions.
Apply either of these methods of
capturing blue stippled regions
to other stippled regions e.g.
green stippled regions (parks -
greenspace)
Change - old Edinburgh quarries change to
shopping centres or from bluespace to
greenspace!
Chris@NLS provided James
Reid with 6 NLS OS 25K 1937-
61 sheets.
First a diversion - threshold
by colour seperation
In QGIS digitised polygons
covering groups of features of
interest so we can explore
values of RGB in the underlying
pixels and use to inform colour
seperation processing.
Load the training polygons and NLS 3 band
raster into PostGIS and do spatial analysis to
find pixel values in each polygon.
Calculate aggregate
min/max values of
RGB (BGR in
opencv!) across each
feature group and use
these in OpenCV
Python algorithm to
do colour seperation
on the source 25k
image. More pre/post
processing needed.
Pixels corresponding to (grey)
buildings
Pixels corresponding to (black)
important buildings (and railway
lines)
Pixels corresponding to
(orange) main roads
(2) Extracting Railways
Source 1:25,000 NLS Historic Map “black” pixels extracted after
running colour seperation process.
Isolates dashes in railway lines (but
also text/buildings)
From dashes to (railway) lines
So do contour tracing and apply
size/shape constraints to isolate the
dashes in the railway lines only.
Join up neighbouring dash
candidates to form railway lines
Complications…Process needs refined
to cope with noisier,
more complicated
regions of the map
Not helped that some
small buildings exhibit
similar size/shape
characteristics as
dashes in railway
lines.
A refinement might be
to introduce a look-
ahead constraint that
minimises change in
line direction as
candidates are
grouped since railway
lines don`t make sharp
90 degree turns.
All lines
captured
from
different
historic NLS
ca1900
Map series
Left with lines corresponding
to hatched building regions
Spatial
analysis
(3) Urban Form / Change
Current building footprints
held in OS MasterMap
Lines from historic map
selected as corresponding to
hatched building areas
overlain against OSMM
building footprints
New vs Old (Buildings)
The locale of the
Fort public housing
project.
West Bowling
Green Street &
Bowling Green
Street
Examples of
change in
Edinburgh between
ca1900 and today
All change
Discrete building areas
Dissolve
is_building = Yes / No
Overlay a 100m x 100m
sampling grid
% Building = Higher
% Building = Lower
A measure of urbaness
1. All lines pulled by
from NLS historic map
sheet. No intelligence
about what each line
represents.
Spaghetti!
2. Form groups of hatch
lines.
Criteria for group
membership is: spatial
proximity; direction
(azimuth);
lines are spatially
disjoint; lines are parallel
to one another.
3. Final set of line
groups. These
correspond to building
footprint. Other lines
from the historic map did
not meet group
membership criteria and
thus make no further
contribution to analysis.
4. Derive a pseudo
building polygon for
each group.
Could place an MBR
around them but
instead...
5. … form a Convex
Hull around the lines to
provide a polygon for
this group. For the
historic maps this is the
equivalent of the
building footprint
provided by the OS
MasterMap data.
6. Repeat the % Building
analysis for the complete
set of convex hull
polygons formed from all
groups of hatch lines.
From hatch lines to buildings
End product would be a grid describing % building (built-up) across each 100m x
100m standard grid square in ca1900. Data could be aggregated upwards e.g. to
produce a 1km x 1km grid. Using the same sampling grid could compute the same
measure for modern data (I`ve used OS MasterMap but other OS OpenData could
be used). Could then calculate + / - change between ca1900 and today / other
time periods for which historic maps available.
Output data products
Process repeated for
whole of Edinburgh
using all 19 NLS map
sheets – urban form
of Edinburgh ca1900.
Scaling up
Same 100m x 100m
grid across Edinbrugh
as a whole in ca1900

More Related Content

Viewers also liked

Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.
Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.
Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.
Eduardo S. Pereira
 
Introduction to OpenCV
Introduction to OpenCVIntroduction to OpenCV
Introduction to OpenCV
Luigi De Russis
 
Introduction to OpenCV with python (at taichung.py)
Introduction to OpenCV with python (at taichung.py)Introduction to OpenCV with python (at taichung.py)
Introduction to OpenCV with python (at taichung.py)
Max Lai
 
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDKHow to Build & Use OpenCL on OpenCV & Android NDK
Using openCV 3.1.0 with vs2015
Using openCV 3.1.0 with vs2015Using openCV 3.1.0 with vs2015
Using openCV 3.1.0 with vs2015
Wei-Wen Hsu
 
Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++
Wei-Wen Hsu
 
Mining Smartphone Data (with Python)
Mining Smartphone Data (with Python)Mining Smartphone Data (with Python)
Mining Smartphone Data (with Python)
Neal Lathia
 
OpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapOpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the Roadmap
Eugene Khvedchenya
 
Geopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kidGeopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kid
Andrea Antonello
 
Face Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learnFace Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learn
Shiqiao Du
 
OpenCV Workshop
OpenCV WorkshopOpenCV Workshop
OpenCV Workshop
Lentin Joseph
 
OpenCV Introduction
OpenCV IntroductionOpenCV Introduction
OpenCV Introduction
Zachary Blair
 
Text analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlText analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco Control
Ben Healey
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
Edge AI and Vision Alliance
 
Image Processing with OpenCV
Image Processing with OpenCVImage Processing with OpenCV
Image Processing with OpenCV
debayanin
 
Computer Vision, Deep Learning, OpenCV
Computer Vision, Deep Learning, OpenCVComputer Vision, Deep Learning, OpenCV
Computer Vision, Deep Learning, OpenCV
Farshid Pirahansiah
 
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Jimmy Lai
 
Automated Face Detection System
Automated Face Detection SystemAutomated Face Detection System
Automated Face Detection System
Abhiroop Ghatak
 
Using openCV 3.2.0 with CodeBlocks
Using openCV 3.2.0 with CodeBlocksUsing openCV 3.2.0 with CodeBlocks
Using openCV 3.2.0 with CodeBlocks
Wei-Wen Hsu
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Farshid Pirahansiah
 

Viewers also liked (20)

Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.
Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.
Do Cosmos a Terra: Usando Python para desvendar os mistérios do Universo.
 
Introduction to OpenCV
Introduction to OpenCVIntroduction to OpenCV
Introduction to OpenCV
 
Introduction to OpenCV with python (at taichung.py)
Introduction to OpenCV with python (at taichung.py)Introduction to OpenCV with python (at taichung.py)
Introduction to OpenCV with python (at taichung.py)
 
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDKHow to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDK
 
Using openCV 3.1.0 with vs2015
Using openCV 3.1.0 with vs2015Using openCV 3.1.0 with vs2015
Using openCV 3.1.0 with vs2015
 
Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++
 
Mining Smartphone Data (with Python)
Mining Smartphone Data (with Python)Mining Smartphone Data (with Python)
Mining Smartphone Data (with Python)
 
OpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapOpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the Roadmap
 
Geopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kidGeopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kid
 
Face Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learnFace Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learn
 
OpenCV Workshop
OpenCV WorkshopOpenCV Workshop
OpenCV Workshop
 
OpenCV Introduction
OpenCV IntroductionOpenCV Introduction
OpenCV Introduction
 
Text analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlText analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco Control
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
Image Processing with OpenCV
Image Processing with OpenCVImage Processing with OpenCV
Image Processing with OpenCV
 
Computer Vision, Deep Learning, OpenCV
Computer Vision, Deep Learning, OpenCVComputer Vision, Deep Learning, OpenCV
Computer Vision, Deep Learning, OpenCV
 
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
 
Automated Face Detection System
Automated Face Detection SystemAutomated Face Detection System
Automated Face Detection System
 
Using openCV 3.2.0 with CodeBlocks
Using openCV 3.2.0 with CodeBlocksUsing openCV 3.2.0 with CodeBlocks
Using openCV 3.2.0 with CodeBlocks
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
 

Similar to Looking into the past - feature extraction from historic maps using Python, OpenCV and PostGIS

Urban Network Analysis: A Toolbox for ArcGIS10
Urban Network Analysis: A Toolbox for ArcGIS10Urban Network Analysis: A Toolbox for ArcGIS10
Urban Network Analysis: A Toolbox for ArcGIS10
asevtsuk
 
The Matrix: connecting and re-using digital records of archaeological investi...
The Matrix: connecting and re-using digital records of archaeological investi...The Matrix: connecting and re-using digital records of archaeological investi...
The Matrix: connecting and re-using digital records of archaeological investi...
Keith.May
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
Fatima891926
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
safayetmim1
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
GodwinKingNyamador
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
vikramvsu
 
GIS and QGIS training notes
GIS and QGIS training notesGIS and QGIS training notes
GIS and QGIS training notes
Arnold Kilaini
 
Analysing OpenStreetMap Data with QGIS
Analysing OpenStreetMap Data with QGISAnalysing OpenStreetMap Data with QGIS
Analysing OpenStreetMap Data with QGIS
SK53
 
OSM and QGIS
OSM and QGISOSM and QGIS
OSM and QGIS
QGIS UK
 
CensusGIV - Geographic Information Visualisation of Census Data
CensusGIV - Geographic Information Visualisation of Census DataCensusGIV - Geographic Information Visualisation of Census Data
CensusGIV - Geographic Information Visualisation of Census Data
CASA, UCL
 
GIS Data Types
GIS Data TypesGIS Data Types
GIS Data Types
John Reiser
 
GIS Introduction.ppt
GIS Introduction.pptGIS Introduction.ppt
GIS Introduction.ppt
misterjis
 
Gis capabilities on Big Data Systems
Gis capabilities on Big Data SystemsGis capabilities on Big Data Systems
Gis capabilities on Big Data Systems
Ahmad Jawwad
 
Astronomical Data Processing on the LSST Scale with Apache Spark
Astronomical Data Processing on the LSST Scale with Apache SparkAstronomical Data Processing on the LSST Scale with Apache Spark
Astronomical Data Processing on the LSST Scale with Apache Spark
Databricks
 
Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...
Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...
Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...
Safe Software
 
Euro30 2019 - Benchmarking tree approaches on street data
Euro30 2019 - Benchmarking tree approaches on street dataEuro30 2019 - Benchmarking tree approaches on street data
Euro30 2019 - Benchmarking tree approaches on street data
Fabion Kauker
 
Moving Objects and Spatial Data Computing
Moving Objects and Spatial Data ComputingMoving Objects and Spatial Data Computing
Moving Objects and Spatial Data Computing
Kwang Woo NAM
 
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Accumulo Summit
 
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy LansleyUsing R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Guy Lansley
 
Automated schematization using open standards, by Nottingham Uni
Automated schematization using open standards, by Nottingham UniAutomated schematization using open standards, by Nottingham Uni
Automated schematization using open standards, by Nottingham Uni
British Cartographic Society
 

Similar to Looking into the past - feature extraction from historic maps using Python, OpenCV and PostGIS (20)

Urban Network Analysis: A Toolbox for ArcGIS10
Urban Network Analysis: A Toolbox for ArcGIS10Urban Network Analysis: A Toolbox for ArcGIS10
Urban Network Analysis: A Toolbox for ArcGIS10
 
The Matrix: connecting and re-using digital records of archaeological investi...
The Matrix: connecting and re-using digital records of archaeological investi...The Matrix: connecting and re-using digital records of archaeological investi...
The Matrix: connecting and re-using digital records of archaeological investi...
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
 
GIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.pptGIS_Whirlwind_Tour.ppt
GIS_Whirlwind_Tour.ppt
 
GIS and QGIS training notes
GIS and QGIS training notesGIS and QGIS training notes
GIS and QGIS training notes
 
Analysing OpenStreetMap Data with QGIS
Analysing OpenStreetMap Data with QGISAnalysing OpenStreetMap Data with QGIS
Analysing OpenStreetMap Data with QGIS
 
OSM and QGIS
OSM and QGISOSM and QGIS
OSM and QGIS
 
CensusGIV - Geographic Information Visualisation of Census Data
CensusGIV - Geographic Information Visualisation of Census DataCensusGIV - Geographic Information Visualisation of Census Data
CensusGIV - Geographic Information Visualisation of Census Data
 
GIS Data Types
GIS Data TypesGIS Data Types
GIS Data Types
 
GIS Introduction.ppt
GIS Introduction.pptGIS Introduction.ppt
GIS Introduction.ppt
 
Gis capabilities on Big Data Systems
Gis capabilities on Big Data SystemsGis capabilities on Big Data Systems
Gis capabilities on Big Data Systems
 
Astronomical Data Processing on the LSST Scale with Apache Spark
Astronomical Data Processing on the LSST Scale with Apache SparkAstronomical Data Processing on the LSST Scale with Apache Spark
Astronomical Data Processing on the LSST Scale with Apache Spark
 
Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...
Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...
Spatial decision support and analytics on a campus scale: bringing GIS, CAD, ...
 
Euro30 2019 - Benchmarking tree approaches on street data
Euro30 2019 - Benchmarking tree approaches on street dataEuro30 2019 - Benchmarking tree approaches on street data
Euro30 2019 - Benchmarking tree approaches on street data
 
Moving Objects and Spatial Data Computing
Moving Objects and Spatial Data ComputingMoving Objects and Spatial Data Computing
Moving Objects and Spatial Data Computing
 
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
 
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy LansleyUsing R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
 
Automated schematization using open standards, by Nottingham Uni
Automated schematization using open standards, by Nottingham UniAutomated schematization using open standards, by Nottingham Uni
Automated schematization using open standards, by Nottingham Uni
 

Recently uploaded

Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Aggregage
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
javier ramirez
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
xclpvhuk
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
vikram sood
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
nyfuhyz
 
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
wyddcwye1
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
v7oacc3l
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
AndrzejJarynowski
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
roli9797
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
apvysm8
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Fernanda Palhano
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
bopyb
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
Learn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queriesLearn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queries
manishkhaire30
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
ElizabethGarrettChri
 

Recently uploaded (20)

Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
 
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
Learn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queriesLearn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queries
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
 

Looking into the past - feature extraction from historic maps using Python, OpenCV and PostGIS

  • 1. Looking into the past - feature extraction from historic maps using Python, OpenCV and PostGIS.
  • 2. ESRC ADRC-S • Administrative Data Research Centre – Scotland (ADRC-S) • part of the Administrative Data Research Network (ADRN) • An ESRC Data Investment • 12 ADRC-S Work Packages • EDINA working on WP5 - Provision of Geocoding and Georeferencing tools
  • 3. What and Why? • Prof(s) Chris Dibben and Jamie Pearce from UoE GeoSciences • Effects of past environmental conditions on (longitudinal) population cohorts • Trains – where (and which populations) did they run alongside in the past and bring their air pollution • Urban - did past populations live in predominantly urban or rural locales – were these same populations experiencing urbanisation • Industry - where were particular types of (polluting) industry located? • Greenspace and Bluespace – e.g. Parks and Water
  • 4. Historic Maps – a record of past landscapes • ADRC`s remit is (all) of Scotland. • Manual capture (digitising) of features from historic maps not going to scale given resources available. • Chris and Jamie`s challenge to EDINA – is it possible to automagically capture features from historic maps? • Historic maps in Digimap historic • For the purpose of this work we are using (higher quality) full colour scans of historic maps provided by Chris Fleet @ NLS • Mainly been looking at 2 map series provided by NLS • http://maps.nls.uk/geo/explore/#zoom=15&lat=55.9757&lon=-3.1799&laye rs=168 • http://maps.nls.uk/geo/explore/#zoom=15&lat=55.9757&lon=-3.1799&laye rs=10
  • 5. Environment • Linux (Ubuntu) • Python (3) • Virtualenv – isolated Python environments • PyCharm Python IDE (Community Edition) • OpenCV – Computer Vision / Image Processing / Image Analysis • PostgreSQL - Datastore • PostGIS – Spatial query (analysis) engine • QGIS – Desktop GIS / PostGIS data viewer • (a bit of) ArcGIS for ArcScan (Line vectorization)
  • 6. OpenCV OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision
  • 7. Python Libraries used • numpy - numpy (array) data structures central to all other libraries where we are manipulating image / raster datasets via python • cv2 - python interface to OpenCV • Shapely – (GEOS based) package for manipulation and analysis of planar geometric objects. • Fiona – (F)ile (i)nput (o)utput (n)o (a)nalysis. An alternative API to OGR to access and write vector GIS datasets e.g. Shapefiles / GeoJSON. • Rasterio – Raster (i)nput (o)utput. Rasteio is to raster GIS datasets as Fiona is to vector GIS datasets. • Snaql – Keep (templated) SQL query blocks seperate from python code and render (with context) the query block when needed. assuming PostGIS, if you add in a map renderer like mapnik, then this lot gives you everything needed to do geospatial data analysis (raster and vector), data conversion, data management and map automation.
  • 8. Python OpenCV Demo • Load image • Changing colourspaces – convert colour image to greyscale • Threshold image – partition greyscale image into bilevel foreground (white) and background (black) regions to simplify things. • Finding image contours. Contour (lines) seperate foreground regions from background regions. Having traced contours we can describe shape/size etc of foreground regions and relationship between regions. • Finding patterns / classifying features
  • 9. Apply similar processes to historic maps to extract geographic features (1) Water features (Bluespace) (2) Railways (3) Urban Form / Change
  • 10. #15759 – extract 'bluespace' (1) Water features (Bluespace) Rivers / Canals / inland water shown as blue lines or stippled blue areas. Find contours – each stipple mark / line forms a contour Threshold to isolate blue pixels Contours form a hierarchy. Parents that hold child contours are water regions.
  • 11. Method 2 Process breaks down when water regions are not entirely bound by blue lines or broken by other features (bridges). So (alternative method) find every individual stipple and then forming groups of these gives water regions. Apply either of these methods of capturing blue stippled regions to other stippled regions e.g. green stippled regions (parks - greenspace)
  • 12. Change - old Edinburgh quarries change to shopping centres or from bluespace to greenspace!
  • 13. Chris@NLS provided James Reid with 6 NLS OS 25K 1937- 61 sheets. First a diversion - threshold by colour seperation
  • 14. In QGIS digitised polygons covering groups of features of interest so we can explore values of RGB in the underlying pixels and use to inform colour seperation processing.
  • 15. Load the training polygons and NLS 3 band raster into PostGIS and do spatial analysis to find pixel values in each polygon. Calculate aggregate min/max values of RGB (BGR in opencv!) across each feature group and use these in OpenCV Python algorithm to do colour seperation on the source 25k image. More pre/post processing needed.
  • 16. Pixels corresponding to (grey) buildings
  • 17. Pixels corresponding to (black) important buildings (and railway lines)
  • 19. (2) Extracting Railways Source 1:25,000 NLS Historic Map “black” pixels extracted after running colour seperation process. Isolates dashes in railway lines (but also text/buildings)
  • 20. From dashes to (railway) lines So do contour tracing and apply size/shape constraints to isolate the dashes in the railway lines only. Join up neighbouring dash candidates to form railway lines
  • 21. Complications…Process needs refined to cope with noisier, more complicated regions of the map Not helped that some small buildings exhibit similar size/shape characteristics as dashes in railway lines. A refinement might be to introduce a look- ahead constraint that minimises change in line direction as candidates are grouped since railway lines don`t make sharp 90 degree turns.
  • 22. All lines captured from different historic NLS ca1900 Map series Left with lines corresponding to hatched building regions Spatial analysis (3) Urban Form / Change
  • 23. Current building footprints held in OS MasterMap Lines from historic map selected as corresponding to hatched building areas overlain against OSMM building footprints New vs Old (Buildings)
  • 24. The locale of the Fort public housing project. West Bowling Green Street & Bowling Green Street Examples of change in Edinburgh between ca1900 and today All change
  • 25. Discrete building areas Dissolve is_building = Yes / No Overlay a 100m x 100m sampling grid % Building = Higher % Building = Lower A measure of urbaness
  • 26. 1. All lines pulled by from NLS historic map sheet. No intelligence about what each line represents. Spaghetti! 2. Form groups of hatch lines. Criteria for group membership is: spatial proximity; direction (azimuth); lines are spatially disjoint; lines are parallel to one another. 3. Final set of line groups. These correspond to building footprint. Other lines from the historic map did not meet group membership criteria and thus make no further contribution to analysis. 4. Derive a pseudo building polygon for each group. Could place an MBR around them but instead... 5. … form a Convex Hull around the lines to provide a polygon for this group. For the historic maps this is the equivalent of the building footprint provided by the OS MasterMap data. 6. Repeat the % Building analysis for the complete set of convex hull polygons formed from all groups of hatch lines. From hatch lines to buildings
  • 27. End product would be a grid describing % building (built-up) across each 100m x 100m standard grid square in ca1900. Data could be aggregated upwards e.g. to produce a 1km x 1km grid. Using the same sampling grid could compute the same measure for modern data (I`ve used OS MasterMap but other OS OpenData could be used). Could then calculate + / - change between ca1900 and today / other time periods for which historic maps available. Output data products
  • 28. Process repeated for whole of Edinburgh using all 19 NLS map sheets – urban form of Edinburgh ca1900. Scaling up
  • 29. Same 100m x 100m grid across Edinbrugh as a whole in ca1900