cc-4010, bringing spatial love to your java application, by steven citron-pousty
DESCRIPTION
Presentation CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty at the AMD Developer Summit (APU13) November 11-13, 2013TRANSCRIPT
![Page 1: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/1.jpg)
APU13 - Bringing Spa-APU13 - Bringing Spa-tial Love to your Javatial Love to your Java
ApplicationApplicationhttp://talks.thesteve0.comhttp://talks.thesteve0.com
Presented by:
Steven PoustySteven Pousty@TheSteve0 on Twitter, IRC,@TheSteve0 on Twitter, IRC,
and Githuband Githubhttp://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 2: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/2.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 3: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/3.jpg)
AgendaAgendaA little about MongoDB Spatial1.Some JEE2.Learn a bit about PaaS3.See some demos4.
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 4: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/4.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 5: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/5.jpg)
AssumptionsAssumptionsYou write Java code1.You will ask questions2.
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 6: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/6.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 7: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/7.jpg)
Types of NoSQL datasTypes of NoSQL datastorestores
TYPE Document Key-Value Graph DataProcessing
EXAMPLE MongoDB,Couchbase
Redis,Riak,Memcahe
Neo4J Hadoop,Cassandra,Voldemort
USE-CASE Documentstorageand search
Cachingor ObjectStore
Relationshipsbetween"things"
Large dataprocessing
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 8: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/8.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 9: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/9.jpg)
On to MongoOn to Mongo
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 10: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/10.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 11: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/11.jpg)
A bit about MongoDBA bit about MongoDBA document is just a bunch of attributes andvalues - think of it like HashMapCan be nested - helps avoid joinsSchemalessReally good at fast writes - but you give upimmediate consistencyEasy to horizontally scale
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 12: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/12.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 13: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/13.jpg)
Now some spatialNow some spatialThe spatial functionality Mongo currently has is:
Near ($near)1.Containment ($geoWithin)2.Intersection ($geoIntersects )3.
It is all laid out here:It is all laid out here:
and here:and here:Geospatial Indexes and Queries
Geospatial Index Internals
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 14: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/14.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 15: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/15.jpg)
Two types of indices:Two types of indices:2D - for flat surfaces1.2dsphere - helps with coords on an earth likesphere
2.
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 16: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/16.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 17: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/17.jpg)
Good to KnowGood to KnowAssumes coords. are between [-180 and 180)Can handle any 2D coordinatesHas methods to handle curvature of the earth(spherical)
to human readable unitsFormula to convert
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 18: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/18.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 19: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/19.jpg)
How do you make itHow do you make itworkwork
1. Put coordinates into an array1. Put coordinates into an array{ loc : [ 50 , 30 ] }{ loc : { x : 50 , y : 30 } }{ loc : { foo : 50 , y : 30 } }{ loc : { lon : 40.739037, lat: 73.992964 } } If you use lattitude and longitude with a default
2. Make a 2D index2. Make a 2D index db.places.ensureIndex( { loc : "2d" } )
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 20: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/20.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 21: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/21.jpg)
JEE - CDI and JAX-RSJEE - CDI and JAX-RSContext Dependency Injection - allows you tomake classes availble whenever you need themand let the calling class decide which class it wantsJAX-RS - the antiSOAP (three cheers). Makes itsuper easy to write REST like architectures
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 22: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/22.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 23: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/23.jpg)
Let's look at some codeLet's look at some codeBuild a spatial checkin serviceBuild a spatial checkin service
for national parks in US andfor national parks in US andCanadaCanada
Java - JEE using CDI and JAX-RSJava - 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
![Page 24: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/24.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 25: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/25.jpg)
Let's spin up a JEELet's spin up a JEE(JBoss EAP) and Mon-(JBoss EAP) and Mon-
goDB servergoDB server
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 26: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/26.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 27: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/27.jpg)
One Source to BindOne Source to BindThem AllThem All
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 28: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/28.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 29: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/29.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 30: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/30.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 31: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/31.jpg)
But wait - there's moreBut wait - there's moreFree! No time limit1.3 gears (like servers) - each 512 Mb RAM, 1 Gbdisk
2.
Simple pricing3.
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 32: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/32.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 33: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/33.jpg)
Let's wrap it upLet's wrap it upOpenshift makes life great for you1.Spatial is easy and fun with MongoDB2.Free!3.
Come hang out with us:#openshift on freenode irc
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
![Page 34: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty](https://reader033.vdocuments.net/reader033/viewer/2022051314/54b90c974a79599c6b8b4666/html5/thumbnails/34.jpg)
http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf