SlideShare a Scribd company logo
GeoTuple
FOSS4G 2017, Boston
a Framework for Web Based Geo-
Analytics with R and PostGIS
By Roland Hansson Nova Spatial
@RolandHansson | geotuple.org
What is GeoTuple?
tuple
/ˈtjʊpəl; ˈtʌpəl/
noun
1. (computing) a row of values in a relational database
RoadSnacks.net
Useful?
What is GeoTuple?
Framework providing “exploratory analysis” tools in R
● Reveal patterns among geographic features
● Perform spatial analytics / statistics / analysis
Integrates a set of OSS components
Web app and API service
Open Data
● Census
● Voting
● Environmental
● ...
How does GeoTuple work?
OpenCPU
● RStudio Server
Client
● Javascript (D3 + Leaflet)
● JSON API
PostGIS database
● Multiple scales (resolutions)
Cloud server (Ubuntu Linux / GCE)
HTTP
R (packages)
Apache web server
Code Javascript
R
pgSQL
//--------------------------------------------
src="scripts/opencpu-0.5.js"
var req = ocpu.rpc("getPoints", {
sw : bnds._southWest,
ne : bnds._northEast,
zoom : zoom, style: style, themes: themes
}, function(data) {
points = data[0];
draw(points, map, markerLayer);
#---------------------------------------------
library(opencpu)
library(RPostgreSQL)
getPoints <- function (sw, ne, zoom, style,
themes) {
df <- queryDbPoints(sw, ne, zoom, themes)
data <- list(df, min(df[,3]), mean(df[,3]),
max(df[,3]))
----------------------------------------------
SELECT ST_X(geog::geometry) AS x,
ST_Y(geog::geometry) AS y, %s
FROM grid
WHERE %s.geom @ ST_MakeEnvelope(. . .)
github.com/rhansson
Point Database
Grid starting at 250 meters interval
Each point holds
multiple values - themes
Database Themes
Land Cover classification Population Density
Why points?
● Integrate data from different spatial units:
○ Census blocks, zip codes, voting districts, etc ..
● Scalable and efficient
● Aggregate at desired resolution
Points (table) + R (data frame) =
That’s a lot of points!
Yes, but:
San Fransisco:
20 * 15 km
3,000 total points
3000
Spatial Aggregation - Multiple Scales (zoom levels)
250 meters (14) 500 m (13)
1 km (12) ...
+ +
+ +
+
+ + + +
+ + + +
+ + + +
+ + + +
+ +
+ +
+ + + +
+ + + +
+ + + +
+ + + +
Equal Area
Equidistant
Flexible
Projections
Data Aggregation - Values
Frequency (Land Cover class)
A B
C A
A
=
10 20
30 40
25
=
85
10 20
30 40
50 50
100 100
+ =
Weighted Average (Income per Capita)
(Population Density + Income)
Average (Population Density)
250m -> 500m -> 1km Census Block ->
Bl. Group -> Tract
Information
loss!
GeoTuple API requests
cURL (snippet)
$ /api_getpoint/json -H "Content-Type: application/json" 
-d '{"lon":"-122.2729", "lat":"37.8021", "themes":"vote_trump"}'
[{ "dist": 49,
"vote_trump": 14
}]
$ /api_getpoints/json -H "Content-Type: application/json" 
-d '{"sw_lon":"-121.552", "sw_lat":"38.543", "ne_lon":"-121.44",
"ne_lat":"38.61", "zoom":"10", "themes":["z", "vote_trump"], "key":"API_KEY"}'
[{ "x": -121.5152,
"y": 38.5698,
"z": 7
"vote_trump": 14
},
...
Theme Operation Equal Interval Classification
Data Domain
Min Average Max
Data Domain
Variables (themes) Analysis
Scatterplot
Summary Report
Highlight: Income > 70000 AND Elevation < 100
Income Inequality < 10km Difference >
$100,000
Income per
Capita
Comparing Themes vs Income
Visually:
a)
b)
c)
Strength of relationship
with Income for themes:
● Race (white)
● Voting Trump/Clinton
● Distance Starbucks
● Population Density
● Environment /
pollution
r = Correlation coefficient
Looking Ahead
@RolandHansson | geotuple.org
Better Statistical Modeling
● Spatial Autocorrelation
● Transforming non-linear relationships
● Interpolation
More Data
● Import custom data
● Sustainability Index (access to public transport, amenities ...)
Focused Solutions
● Improved and streamlined UI
● Redistricting, health studies
Big Data
● GPU + Analytics + Machine Learning

More Related Content

PPTX
La R Users Group Survey Of R Graphics
ODP
Lost In The Clouds
PDF
Demo week three_thurs
PDF
Geo_DC Meetup talk: Mapping a marathon
PPT
Os Racicot
PDF
Pgrouting_foss4guk_ross_mcdonald
PPT
hadoop introduce
PDF
The National Digital Stewardship Residency at PBS
La R Users Group Survey Of R Graphics
Lost In The Clouds
Demo week three_thurs
Geo_DC Meetup talk: Mapping a marathon
Os Racicot
Pgrouting_foss4guk_ross_mcdonald
hadoop introduce
The National Digital Stewardship Residency at PBS

What's hot (20)

PDF
Creating and indoor routable network with QGIS and pgRouting
PDF
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
PPT
Thematic mapping at AGU 2008
PDF
MapMyCab Presentation
PDF
Analysing OpenStreetMap Data with QGIS
PPT
Python Coding Examples for Drive Time Analysis
PDF
Apache flink: data streaming as a basis for all analytics by Kostas Tzoumas a...
DOCX
treemap package in R and examples.
PDF
Three Functional Programming Technologies for Big Data
PDF
Introduction to spatial data analysis in r
ODP
OSM Cycle Map
PPTX
What are customers building with new Bing Maps capabilities
PPTX
Googlevis examples
PDF
OpenHistoricMap: overview
DOCX
R Data Visualization-Spatial data and Maps in R: Using R as a GIS
PPTX
Python en la Plataforma ArcGIS
PDF
Flyby: Improved Dense Matrix Multiplication-(Tom Vacek, Thomson Reuters)
PDF
Two's a Crowd: Crowdsourcing Addresses for OpenStreetMap in the UK
PPTX
Team3 presentation
Creating and indoor routable network with QGIS and pgRouting
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
Thematic mapping at AGU 2008
MapMyCab Presentation
Analysing OpenStreetMap Data with QGIS
Python Coding Examples for Drive Time Analysis
Apache flink: data streaming as a basis for all analytics by Kostas Tzoumas a...
treemap package in R and examples.
Three Functional Programming Technologies for Big Data
Introduction to spatial data analysis in r
OSM Cycle Map
What are customers building with new Bing Maps capabilities
Googlevis examples
OpenHistoricMap: overview
R Data Visualization-Spatial data and Maps in R: Using R as a GIS
Python en la Plataforma ArcGIS
Flyby: Improved Dense Matrix Multiplication-(Tom Vacek, Thomson Reuters)
Two's a Crowd: Crowdsourcing Addresses for OpenStreetMap in the UK
Team3 presentation
Ad

Similar to GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS (20)

PDF
Using python to analyze spatial data
PPTX
Esri Uc Fgdc
PDF
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
PPTX
Geo data analytics
PDF
Powerful geographic web framework GeoDjango
PDF
PyDX Presentation about Python, GeoData and Maps
PPTX
Geo spatial python princeton pug
ODP
Citizen science, vgi, geo crowd sourcing, big geo data how they matter to th...
PDF
FOSS4G 2017 - Geonotebook: an extension to the jupyter notebook for explora...
PPTX
Introduction to GeoNode
PDF
GeoNode intro and demo
KEY
Handling Real-time Geostreams
KEY
Handling Real-time Geostreams
PDF
Human Mobility (with Mobile Devices)
PDF
State of the Art Web Mapping with Open Source
PPT
Bob Barr: What are Core Reference Geographies?
PDF
thesis.compressed
PDF
State of GeoNode 2019
PDF
Representing and Querying Geospatial Information in the Semantic Web
PDF
Geographic Data and Leaflet.js
Using python to analyze spatial data
Esri Uc Fgdc
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
Geo data analytics
Powerful geographic web framework GeoDjango
PyDX Presentation about Python, GeoData and Maps
Geo spatial python princeton pug
Citizen science, vgi, geo crowd sourcing, big geo data how they matter to th...
FOSS4G 2017 - Geonotebook: an extension to the jupyter notebook for explora...
Introduction to GeoNode
GeoNode intro and demo
Handling Real-time Geostreams
Handling Real-time Geostreams
Human Mobility (with Mobile Devices)
State of the Art Web Mapping with Open Source
Bob Barr: What are Core Reference Geographies?
thesis.compressed
State of GeoNode 2019
Representing and Querying Geospatial Information in the Semantic Web
Geographic Data and Leaflet.js
Ad

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
sap open course for s4hana steps from ECC to s4
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
A comparative analysis of optical character recognition models for extracting...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine Learning_overview_presentation.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Review of recent advances in non-invasive hemoglobin estimation
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...

GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS

  • 1. GeoTuple FOSS4G 2017, Boston a Framework for Web Based Geo- Analytics with R and PostGIS By Roland Hansson Nova Spatial @RolandHansson | geotuple.org
  • 2. What is GeoTuple? tuple /ˈtjʊpəl; ˈtʌpəl/ noun 1. (computing) a row of values in a relational database
  • 4. What is GeoTuple? Framework providing “exploratory analysis” tools in R ● Reveal patterns among geographic features ● Perform spatial analytics / statistics / analysis Integrates a set of OSS components Web app and API service Open Data ● Census ● Voting ● Environmental ● ...
  • 5. How does GeoTuple work? OpenCPU ● RStudio Server Client ● Javascript (D3 + Leaflet) ● JSON API PostGIS database ● Multiple scales (resolutions) Cloud server (Ubuntu Linux / GCE) HTTP R (packages) Apache web server
  • 6. Code Javascript R pgSQL //-------------------------------------------- src="scripts/opencpu-0.5.js" var req = ocpu.rpc("getPoints", { sw : bnds._southWest, ne : bnds._northEast, zoom : zoom, style: style, themes: themes }, function(data) { points = data[0]; draw(points, map, markerLayer); #--------------------------------------------- library(opencpu) library(RPostgreSQL) getPoints <- function (sw, ne, zoom, style, themes) { df <- queryDbPoints(sw, ne, zoom, themes) data <- list(df, min(df[,3]), mean(df[,3]), max(df[,3])) ---------------------------------------------- SELECT ST_X(geog::geometry) AS x, ST_Y(geog::geometry) AS y, %s FROM grid WHERE %s.geom @ ST_MakeEnvelope(. . .) github.com/rhansson
  • 7. Point Database Grid starting at 250 meters interval Each point holds multiple values - themes
  • 8. Database Themes Land Cover classification Population Density
  • 9. Why points? ● Integrate data from different spatial units: ○ Census blocks, zip codes, voting districts, etc .. ● Scalable and efficient ● Aggregate at desired resolution Points (table) + R (data frame) =
  • 10. That’s a lot of points! Yes, but: San Fransisco: 20 * 15 km 3,000 total points 3000
  • 11. Spatial Aggregation - Multiple Scales (zoom levels) 250 meters (14) 500 m (13) 1 km (12) ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Equal Area Equidistant Flexible Projections
  • 12. Data Aggregation - Values Frequency (Land Cover class) A B C A A = 10 20 30 40 25 = 85 10 20 30 40 50 50 100 100 + = Weighted Average (Income per Capita) (Population Density + Income) Average (Population Density)
  • 13. 250m -> 500m -> 1km Census Block -> Bl. Group -> Tract Information loss!
  • 14. GeoTuple API requests cURL (snippet) $ /api_getpoint/json -H "Content-Type: application/json" -d '{"lon":"-122.2729", "lat":"37.8021", "themes":"vote_trump"}' [{ "dist": 49, "vote_trump": 14 }] $ /api_getpoints/json -H "Content-Type: application/json" -d '{"sw_lon":"-121.552", "sw_lat":"38.543", "ne_lon":"-121.44", "ne_lat":"38.61", "zoom":"10", "themes":["z", "vote_trump"], "key":"API_KEY"}' [{ "x": -121.5152, "y": 38.5698, "z": 7 "vote_trump": 14 }, ...
  • 15. Theme Operation Equal Interval Classification Data Domain
  • 18. Highlight: Income > 70000 AND Elevation < 100
  • 19. Income Inequality < 10km Difference > $100,000
  • 21. Comparing Themes vs Income Visually: a) b) c)
  • 22. Strength of relationship with Income for themes: ● Race (white) ● Voting Trump/Clinton ● Distance Starbucks ● Population Density ● Environment / pollution r = Correlation coefficient
  • 23. Looking Ahead @RolandHansson | geotuple.org Better Statistical Modeling ● Spatial Autocorrelation ● Transforming non-linear relationships ● Interpolation More Data ● Import custom data ● Sustainability Index (access to public transport, amenities ...) Focused Solutions ● Improved and streamlined UI ● Redistricting, health studies Big Data ● GPU + Analytics + Machine Learning

Editor's Notes

  • #22: http://andrewgelman.com/2011/04/04/irritating_pseu/ Andrew Gelman, Professor, Columbia University