couchdb day nyc 2017: using geospatial data in cloudant & couchdb
TRANSCRIPT
@rajrsinghWatson Data Platform
Using Geospatial Datain Cloudant & CouchDB
February, 2017
@rajrsinghWatson Data Platform
WhyGeospatial?
• Humans are wired by evolution to think spatially
• Location tells you a lot about your data
• Design with Nature (1969) pioneered the concept of ecological planning. Ian McHarg sets forth the basic concepts that were to develop later into geographic information systems. Courtesy Wikipedia
@rajrsinghWatson Data Platform
Faking GeowithCouchDB
• Secondary index on X and Y• Mango query X and Y• Pull data to the client, then…
• Use PouchDB + https://github.com/pouchdb/geopouch for bounding box queries
or
• http://turfjs.org for more complete geospatial analysis
@rajrsinghWatson Data Platform
Components of a great mobile mapping app Basemap tiles: Mapbox
API Query: all restaurants X meters from Y that serve Z
Web client: MapboxGL
Custom data: restaurants
@rajrsinghWatson Data Platform
Going Beyond the Bounding Box
@rajrsinghWatson Data Platform
Multipoint Polygons
@rajrsinghWatson Data Platform
GeoJSON Data Format
– geometry property• required: type property with a value such as
Point, LineString or Polygon• required: coordinates property
– properties property• all the other data• optional in Cloudant/CouchDB
– type property set to Feature
– http://geojson.org
@rajrsinghWatson Data Platform
GeoQueries
– base URL /<db>/_design/<ddocname>/_geo/<geoindexname>?
– bounding box bbox=minlon,minlat,maxlon,maxlat
– radiuslat=39.96&lon=-75.15&radius=300&relation=contains
polygonrelation=overlaps&g=POLYGON ((-71.0537124 42.3681995,-71.054399 42.3675178,-71.0522962 42.3667409,-71.051631 42.3659324,-71.051631 42.3621431,-71.0502148 42.3618577,-71.0505152 42.3660275,-71.0511589 42.3670263,-71.0537124 42.3681995))
@rajrsinghWatson Data Platform
Spatial Relationship Types
BBox ContainsCrosses Disjoint Equals
IntersectsOverlaps Touches Within
@rajrsinghWatson Data Platform
CrimeStats
http://crimedemos.mybluemix.net/?city=boston
@rajrsinghWatson Data Platform
FieldWork
https://fieldwork.mybluemix.net
@rajrsinghWatson Data Platform
SafetyPulse
https://safetypulse.mybluemix.net
@rajrsinghWatson Data Platform
Resources • Location Tracker tutorials• https://developer.ibm.com/clouddataservices/location-tra
cker/
• Cloudant Geo• Marketing overview
https://www.ibm.com/analytics/us/en/technology/location-based-apps/
• Technical docs https://docs.cloudant.com/geo.html
• Me• Twitter @rajrsingh• Email [email protected]