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

An Evening with MongoDB- San Diego 2012: Get Your Spatial on with MongoDB in the Cloud

D8fc2580cfaca035f666d9e4ee79a7f7?s=47 mongodb
July 25, 2012
200

An Evening with MongoDB- San Diego 2012: Get Your Spatial on with MongoDB in the Cloud

Steve Citron-Pousty, Red Hat
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 IT dude 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 some data into MongoDB, show you how to handle spatial data, do some command line spatial operations, and finally plugin in some code to build a simple "Find the National Park Application". When you go home you will be able to amaze your friends and supervisors with some spatial magic goodness you can control.
Steve is a PaaS Dust Spreader (aka Developer Evangelist) with OpenShift. He goes around and shows off all the great work the OpenShift engineers do. He can teach you about PaaS with MongoDB, and also Java, PostgreSQL, mobile JavaScript, some Android, a little bit of iPhone, and even some Python. He has 11 years of Java programming expertise ranging from data processing and statistical analysis to ORM and web applications. He began doing geospatial work 19 years ago and has done geospatial programming work on multiple platforms using JavaScript, .NET, and Java. Before OpenShift, Steve was a developer evangelist for LinkedIn and deCarta. Steve holds a B.A. from Vassar College, an M.S. from University of Georgia and a Ph. D. in Ecology from University of Connecticut. He likes building interesting applications and helping developers create great solutions.

D8fc2580cfaca035f666d9e4ee79a7f7?s=128

mongodb

July 25, 2012
Tweet

Transcript

  1. 1 Get your Spatial on with MongoDB in the Cloud

    Steven Citron-Pousty PaaS Dust Spreader, Red Hat @TheSteve0
  2. 2 Agenda •  Learn a little spatial •  Load some

    spatial data into mongo •  Do a query or two SIGN UP CODE: MONGOSD
  3. 3 Assumptions 1)  You can use the command line 2) 

    You are comfortable with Mongo command line 3)  Please ask questions – though since we only have 30 minutes they may have to wait until the end or after the session
  4. 4 What is OpenShift? Red Hat’s free platform as a

    service for applications in the cloud.
  5. 5 Dalbera on Flickr

  6. 6 Kind of like Amazon, right? Nope.

  7. 7 Cook24v on Flickr

  8. 8

  9. 9 What’s supported?

  10. 10 Looks great, but what’s the catch? •  OpenShift is

    free-as-in-beer & free-as-in-freedom •  Three 512 MB RAM / 1 GB storage gears •  Need more resources, just ask! •  We are really in Developer Preview
  11. 11 On to spatial!

  12. 12 Spatial is fun The only spatial functionality Mongo currently

    has is: 1)  Near 2)  Containment All of it is laid out on one page: http://www.mongodb.org/display/DOCS/Geospatial +Indexing First link on a google search for “mongodb spatial indexing”
  13. 13 Caveats 1.  Assumes coords. are between -180 and 180

    2.  Can handle any 2D coordinates 3.  Has methods to handle curvature of the earth (spherical)
  14. 14 How to make it work 1)  Put your coordinates

    into an arrary { 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" } )!
  15. 15 Demo 1.  I have an app and a mongo

    instance running 2.  Load some spatial data in JSON format 3.  Make the 2d index 4.  Do some fun spatial and mongoDB work
  16. 16 Conclusion 1.  Spatial is easy and fun on Mongo

    2.  You can now build your own FourSquare or other checkin application. 3.  You can also build your own field data entry system. 4.  You can build and deploy your application quickly without having to think about infrastructure. SIGN UP CODE: MONGOSD http://openshift.redhat.com