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.

CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty

1,450 views

Published on

Presentation CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty at the AMD Developer Summit (APU13) November 11-13, 2013

Published in: Technology
  • Be the first to comment

  • Be the first to like this

CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty

  1. 1. APU13 - Bringing Spatial Love to your Java Application http:/ /talks.thesteve0.com Presented by: Steven Pousty @TheSteve0 on Twitter, IRC, and Github http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  2. 2. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  3. 3. Agenda 1. A little about MongoDB Spatial 2. Some JEE 3. Learn a bit about PaaS 4. See some demos http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  4. 4. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  5. 5. Assumptions 1. You write Java code 2. You will ask questions http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  6. 6. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  7. 7. Types of NoSQL datas tores TYPE Document Key-Value Graph D P EXAMPLE MongoDB, Redis, Neo4J Couchbase Riak, Memcahe H C V USE-CASE Document Caching Relationships L storage or Object between p and search Store "things" http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  8. 8. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  9. 9. On to Mongo http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  10. 10. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  11. 11. A bit about MongoDB A document is just a bunch of attributes and values - think of it like HashMap Can be nested - helps avoid joins Schemaless Really good at fast writes - but you give up immediate consistency Easy to horizontally scale http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  12. 12. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  13. 13. Now some spatial The spatial functionality Mongo currently has is 1. Near ($near) 2. Containment ($geoWithin) 3. Intersection ($geoIntersects ) It is all laid out here: Geospatial Indexes and Queries and here: Geospatial Index Internals http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  14. 14. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  15. 15. Two types of indices: 1. 2D - for flat surfaces 2. 2dsphere - helps with coords on an earth like sphere http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  16. 16. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  17. 17. Good to Know Assumes coords. are between [-180 and 180) Can handle any 2D coordinates Has methods to handle curvature of the earth (spherical) Formula to convert to human readable units http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  18. 18. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  19. 19. How do you make it work 1. Put coordinates into an array { { { { loc loc loc loc : : : : [ { { { 50 , 30 ] } x : 50 , y : 30 } } foo : 50 , y : 30 } } lon : 40.739037, lat: 73.992964 } } If you use lattitude and longitude with a defaul 2. Make a 2D index db.places.ensureIndex( { loc : "2d" } ) http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  20. 20. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  21. 21. JEE - CDI and JAX-RS Context Dependency Injection - allows you to make classes availble whenever you need them and let the calling class decide which class it wan JAX-RS - the antiSOAP (three cheers). Makes it super easy to write REST like architectures http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  22. 22. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  23. 23. Let's look at some cod Build a spatial checkin service for national parks in US and Canada Java - JEE using CDI and JAX-RS The full map front end app can be found here http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  24. 24. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  25. 25. Let's spin up a JEE (JBoss EAP) and MongoDB server http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  26. 26. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  27. 27. One Source to Bind Them All http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  28. 28. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  29. 29. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  30. 30. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  31. 31. But wait - there's more 1. Free! No time limit 2. 3 gears (like servers) - each 512 Mb RAM, 1 Gb disk 3. Simple pricing http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  32. 32. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  33. 33. Let's wrap it up 1. Openshift makes life great for you 2. Spatial is easy and fun with MongoDB 3. Free! Come hang out with us: #openshift on freenode irc OR users@lists.openshift.redhat.com http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
  34. 34. http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf

×