couchdb day nyc 2017: using geospatial data in cloudant & couchdb
TRANSCRIPT
![Page 1: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/1.jpg)
@rajrsinghWatson Data Platform
Using Geospatial Datain Cloudant & CouchDB
February, 2017
![Page 2: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/2.jpg)
@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
![Page 3: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/3.jpg)
@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
![Page 4: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/4.jpg)
@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
![Page 5: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/5.jpg)
@rajrsinghWatson Data Platform
Going Beyond the Bounding Box
![Page 6: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/6.jpg)
@rajrsinghWatson Data Platform
Multipoint Polygons
![Page 7: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/7.jpg)
@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
![Page 8: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/8.jpg)
@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))
![Page 9: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/9.jpg)
@rajrsinghWatson Data Platform
Spatial Relationship Types
BBox ContainsCrosses Disjoint Equals
IntersectsOverlaps Touches Within
![Page 10: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/10.jpg)
@rajrsinghWatson Data Platform
CrimeStats
http://crimedemos.mybluemix.net/?city=boston
![Page 11: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/11.jpg)
@rajrsinghWatson Data Platform
FieldWork
https://fieldwork.mybluemix.net
![Page 12: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/12.jpg)
@rajrsinghWatson Data Platform
SafetyPulse
https://safetypulse.mybluemix.net
![Page 13: CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022052418/58b897cc1a28ab3e3a8b6f4d/html5/thumbnails/13.jpg)
@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]