Slide 1

Slide 1 text

1 Get your Spatial on with MongoDB in the Cloud Steven Citron-Pousty PaaS Dust Spreader, Red Hat @TheSteve0

Slide 2

Slide 2 text

2 Agenda •  Learn a little spatial •  Load some spatial data into mongo •  Do a query or two SIGN UP CODE: MONGOSD

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

4 What is OpenShift? Red Hat’s free platform as a service for applications in the cloud.

Slide 5

Slide 5 text

5 Dalbera on Flickr

Slide 6

Slide 6 text

6 Kind of like Amazon, right? Nope.

Slide 7

Slide 7 text

7 Cook24v on Flickr

Slide 8

Slide 8 text

8

Slide 9

Slide 9 text

9 What’s supported?

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

11 On to spatial!

Slide 12

Slide 12 text

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”

Slide 13

Slide 13 text

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)

Slide 14

Slide 14 text

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" } )!

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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