Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB

535 views

Published on

Since GeoJSON is a standard for storing geographic data in JSON format, it is a best practice to adhere to this format when storing geo-coordinates in Cloudant and CouchDB.

Published in: Software
  • Be the first to comment

CouchDB Day NYC 2017: Using Geospatial Data in Cloudant & CouchDB

  1. 1. @rajrsingh Watson Data Platform Using Geospatial Data in Cloudant & CouchDB February, 2017
  2. 2. @rajrsingh Watson Data Platform Why Geospatial? • 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
  3. 3. @rajrsingh Watson Data Platform Faking Geo with CouchDB • 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
  4. 4. @rajrsingh Watson Data Platform Components of a great mobile mapping app © Copyright IBM Corporation 2015 Basemap tiles: Mapbox API Query: all restaurants X meters from Y that serve Z Web client: MapboxGL Custom data: restaurants
  5. 5. @rajrsingh Watson Data Platform Going Beyond the Bounding Box
  6. 6. @rajrsingh Watson Data Platform Multipoint Polygons
  7. 7. @rajrsingh Watson 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
  8. 8. @rajrsingh Watson Data Platform Geo Queries – base URL /<db>/_design/<ddocname>/_geo/<geoindexname>? – bounding box bbox=minlon,minlat,maxlon,maxlat – radius lat=39.96&lon=-75.15&radius=300&relation=contains polygon relation=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))
  9. 9. @rajrsingh Watson Data Platform Spatial Relationship Types BBox Contains Crosses Disjoint Equals Intersects Overlaps Touches Within
  10. 10. @rajrsingh Watson Data Platform Crime Stats http://crimedemos.mybluemix.net/?city=boston
  11. 11. @rajrsingh Watson Data Platform Field Work https://fieldwork.mybluemix.net
  12. 12. @rajrsingh Watson Data Platform Safety Pulse https://safetypulse.mybluemix.net
  13. 13. @rajrsingh Watson Data Platform Resources • Location Tracker tutorials • https://developer.ibm.com/clouddataservices/location-tracker/ • 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 rrsingh@us.ibm.com

×