Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bringing Spatial Love to Your Application

Bringing Spatial Love to Your Application

You have seen the stuff that FourSquare has done with spatial and you want some of that hotness for your app. But, where to start? Have no fear - by the end of this session you will have all the pieces necessary to write your own location based app. The OpenShift platform already has MongoDB plus the spatial bits installed, so there is no need to find a VPS or convince your OPs staff to install stuff. What's OpenShift? It's Red Hat's free auto-scaling Platform as a Service. This session will start with a quick intro on firing up an OpenShift instance with MongoDB. Then we will load and query spatial data to and from MongoDB using simple Ruby web application. When you go home you will be able to amaze your friends and supervisors with some spatial magic goodness you can control.

Marek Jelen

February 26, 2013
Tweet

More Decks by Marek Jelen

Other Decks in Programming

Transcript

  1. 2 Agenda • Learn a bit of spatial • See

    the code • Use it on server • MAKE YOU A ROCKSTAR!!
  2. 3 i. familiar with the command line ii. familiar with

    MongoDB command line iii. Questions are not good! iv. Questions are awesome! Expectations
  3. 4 What is OpenShift? Red Hat's free, auto-scaling Platform as

    a Service (PaaS) for applications in the cloud.
  4. 7 Looks great, but what’s the catch? • OpenShift is

    free-as-in-beer & free-as-in-freedom • Three times 0.5GB RAM/1GB storage • Need more resources, just ask! • We are in Developer Preview • Sign up at openshift.com • Promo code: MongoDBBerlin
  5. 9 The spatial functionality MongoDB provides 1) near 2) within

    All of it is laid out on one page: http://www.mongodb.org/display/DOCS/Geospatial+Indexing First link on Google for “MongoDB spatial indexing” Spatial is fun!
  6. 10 1) Put your coordinates into the document { loc

    : [ 50 , 30 ] } //SUGGESTED OPTION { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } { loc : { lon : 40.739037, lat: 73.992964 } } 2) Make a 2d index db.places.ensureIndex( { loc : "2d" } ) How to make it work
  7. 11 1. Demo MongoDB command line 2. Demo the expected

    result 3. Create an OpenShift application 4. Import the code from Github • https://github.com/openshift-quickstart/spatial-ruby-openshift-quickstart 5. Demo the deployed application Demo
  8. 12 1. Spatial is easy and fun on MongoDB! 2.

    You can now build your own FourSquare 3. You can build and deploy your application quickly without having to think about infrastructure. 4. Sign up for OpenShift with “MongoDBBerlin” promo code 5. Come to talk to the table Conclusion