+ All Categories
Home > Technology > CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty

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

Date post: 16-Jan-2015
Category:
Upload: amd-developer-central
View: 407 times
Download: 3 times
Share this document with a friend
Description:
Presentation CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty at the AMD Developer Summit (APU13) November 11-13, 2013
Popular Tags:
34
APU13 - Bringing Spa- APU13 - Bringing Spa- tial Love to your Java tial Love to your Java Application Application http://talks.thesteve0.com http://talks.thesteve0.com Presented by: Steven Pousty Steven Pousty @TheSteve0 on Twitter, IRC, @TheSteve0 on Twitter, IRC, and Github and Github http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf
Transcript
Page 1: CC-4010, Bringing Spatial Love to your Java Application, by Steven Citron-Pousty

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[email protected]

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

http://presentations-thesteve0.rhcloud.com/amdjavamongo/index.html?print-pdf


Recommended