SlideShare a Scribd company logo
1 of 30
Download to read offline
GeoSpatial Search
                                                                                     in

                                        Amazon CloudSearch

                                                                            Tom Hill
                                                                  January 30, 2013




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Agenda
!        What is GeoSpatial search?
!        Why do we care?
!        Computing distance
!        Geospatial Search in CloudSearch




    © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
What is GeoSpatial Search?
!   Using location & distance as factors in search




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
What's this "Geo", anyway?
!   Spatial                                                                                   !   Geographic
          •  Simple distance                                                                            •  On the earth




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
How do we use distance?
!   Limit to an Area
       •  Box
       •  Circle
       •  Polygon*
!   Sort by Distance

!   Include distance in score

                                                                                                                                         *not yet!
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Why Do You Care?
!   People care about things near them.
       •  Pizza, Classified Ads, etc.
       •  Find a Doctor, Lawyer,…
!   Mobile is a key driver




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
What can you do with CloudSearch?




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Computing Distance
!   Many Formulas
       •      Rectangular distance
       •      Equirectangular projection
       •      Spherical Law of Cosines
       •      Haversine Formula
       •      Vincenty's Formula
!   Speed Vs. Accuracy
       •  Speed: Rectangular distance
       •  Accuracy: Vincenty's Formula


© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Why So Many Ways to Compute Distance?

The earth isn't flat!                                                                                                  It isn't a sphere either.




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Is the Earth Flat?
!   If it's flat
        •  distance = sqrt((lat1-lat2)^2 + (lon1-lon2)^2)
!   If it's not




 © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
How Much Accuracy?

!   "Pizza, 1 Mile"
! Haversine is more accurate
       •  If you are a bird
!   Any distance is approximate




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Comparing Distance Computations
    !   Four computations: Haversine, Cosines, EquiRrect, Rect.
    !   Different computations – Different Results
    !   How accurate do you need to be?

    	 Haversine      Cosines     EuqiRect         Rect                                    -  CosErr EquErr RecErr 	
    	 994.79893    994.79893    995.25921   1044.40926                                    -   0.000  0.000  0.050  Fort Lauderdale, FL to                                  Anniston, AL	
    	 624.04339   3624.04339   3642.98321   4163.41737                                    -   0.000  0.005  0.149  Fort Lauderdale, FL to                                  San Diego, CA	
    	1812.54997   1812.54997   1814.38516   1871.77660                                    -   0.000  0.001  0.033  Fort Lauderdale, FL to                                  New Haven, CT	
    	8175.93897   8175.93897   8817.96563  11107.90729                                    -   0.000  0.079  0.359  Fort Lauderdale, FL to                                  Adak, AK	
    	7244.45661   7244.45661   8008.74698  12015.96646                                    -   0.000  0.106  0.659  Bangor, ME to Adak,AK	
	
	




      © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
GeoSpatial Search
                                                                                     in
                                                    Amazon CloudSearch



© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
How to Compute Distance in CloudSearch?

!   Rank Expressions
       •  Computations run for each matching document
!   Can be used for
       •  Sorting
       •  Influencing Scoring




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Two Types of Rank Expressions
!   Static Rank Expressions
       •  Computation based on values in index
!   Query Time Rank Expressions
       •  Allow including parameters at run time.
                 •  e.g. latitude, longitude.




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Query Time Rank Expressions
!   Define Rank Expression
      •  &rank-NAME=EXPRESSION
      •  &rank-geo=sqrt(pow(lat-userlat),2)+pow(lon-userlon),2))
!   Select Rank Expression
      •  &rank=NAME
      •  &rank=geo

http://searchendpoint?q=creek&rank=geo&rank-geo=sqrt(pow(la1-123),2)+pow(lo1-456),2))



  © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Influencing Scoring
!   Include both text relevance and distance:

&rank-geo=(1000-text_relevance) + sqrt(pow(la1-ulat),2)+pow(lo1-ulon),2))

!   Relative Weight
       •      N * text_relevance + M * distance
       •      That's where the art comes in.
       •      Will vary by your application.
       •      Test & tune, and test again.

© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Storing Data
!   CloudSearch supports unsigned integers
!   Have to convert latitude, longitude to positive ranges
       •  latitude + 90
       •  longitude + 180
!   Have to store as integers; need to scale
       •  latitude = (latitude + 90) * 100
       •  longitude= (longitude+ 180) * 100



© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Performance
!   Don't query the whole world
       •  Can limit by literals or numeric fields.
       •  Literals are more efficient for limits.
!   Limit Options
       •  Literal
                 •  &bq=state:'CA'
                 •  &bq=zip:'94402'
       •  Numeric
                 •  &bq=(and latitude:40..50 longitude:80..85)
       •  Geohash


© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Performance Measures
 Why you don't want query the whole world!

!GeoMethod!!!!TextRel!!!!!Limits!!!!Queries!!Seconds!!QTimeMS!!!!Threads!CompletedQ!!!!!!AveHits!
!!!!!!NONE!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!!6.2255!!!!!!622!!!!!!!!!!1!!!!!!!!!10!!!8345450.00!
!CARTESIAN!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!15.6064!!!!!1560!!!!!!!!!!1!!!!!!!!!10!!!8345450.00!
!!!!!!EQUI!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!19.7106!!!!!1971!!!!!!!!!!1!!!!!!!!!10!!!8345450.00!
!!!COSINES!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!27.4968!!!!!2749!!!!!!!!!!1!!!!!!!!!10!!!8345450.00!
!HAVERSINE!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!31.2595!!!!!3125!!!!!!!!!!1!!!!!!!!!10!!!8345450.00!
!
!!!!!!NONE!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.1758!!!!!!917!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00!
!CARTESIAN!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.0255!!!!!!902!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00!
!!!!!!EQUI!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.1158!!!!!!911!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00!
!!!COSINES!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.8321!!!!!!983!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00!
!HAVERSINE!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.1272!!!!!!912!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00!
!
!!!!!!NONE!!!!!!false!!!!literal!!!!!!!!!10!!!0.8254!!!!!!!82!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00!
!CARTESIAN!!!!!!false!!!!literal!!!!!!!!!10!!!0.5936!!!!!!!59!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00!
!!!!!!EQUI!!!!!!false!!!!literal!!!!!!!!!10!!!0.6173!!!!!!!61!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00!
!!!COSINES!!!!!!false!!!!literal!!!!!!!!!10!!!0.5916!!!!!!!59!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00!
!HAVERSINE!!!!!!false!!!!literal!!!!!!!!!10!!!0.6289!!!!!!!62!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00!
!


 © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Geo-Spatial Demo Application


© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Demo Application Structure


HTML Page
                                     Ajax               Server                                                CloudSearch
  Javascript
                                                       (Tomcat)




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Demo Implementation
!   JavaScript
       •  Ajax
       •  JQuery
       •  Google Maps API
!   Twitter Bootstrap
       •  css
!   Tomcat Server
       •  Java
       •  Just for forwarding of requests
                 •  Because XSS, that's why.

© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Querying CloudSearch
$.ajax({(
     (url(:("searchx",(
     (data(:({(
     (        ('q'(:(currentQuery,(
     (        ('domain'(:("geoname25",(
     (        ('return@fields'(:(returnFields.join(),(
     (        ("rank"(:("geo",(
     (        ("rank@geo"(:("Math.sqrt(Math.pow(Math.abs(doc.latitude_90@(12539),2)(+(
Math.pow(Math.abs(doc.longitude_180@(5784),2))"(
     (},(
     (dataType(:("json",(
     (success(:(function(data)({(
     (        (var(hits(=(data['hits'];(
     (        (displaySearchResults(hits['hit'],(hits['found']);(
     (        (populateMap(hits['hit']);(
     (}(
 © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
});(
Wrap Up


© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Thanks for Coming!
!   Data
       •  http://www.geonames.org/export/
!   Slides
       •  On the meetup group soon
!   Sample Code
       •  Talk to me. (tomhill@amazon.com)
!   Computations
       •  http://www.movable-type.co.uk/scripts/latlong.html
       •  wikipedia

© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Querying Data
!   Java/Javascript
           •  Fields are latitude_90, longitude_180
           •  user location is userlat, userlon

!   simple distance
rank!=!"Math.sqrt(Math.pow(Math.abs(latitude_90W("!+!userlat!+!")),
2)+Math.pow(Math.abs(longitude_180W("!+!userlon!+!")),2))";!
!

!   Spherical Law of Cosines
rank = "6371*Math.acos(Math.sin(" + userlat + ") * Math.sin(lat_rad/" + scale + ") +
Math.cos(" + userlat + ") * Math.cos(lat_rad/" + scale + ") * Math.cos((lon_rad/" + scale +
") - " + userlon + ") )";!


    © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
What CloudSearch Doesn't Do




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Issues with assuming
                                                                                                                          the earth is flat.




© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

More Related Content

What's hot

NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017
NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017
NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017Amazon Web Services
 
Use Amazon Rekognition to Build a Facial Recognition System
Use Amazon Rekognition to Build a Facial Recognition SystemUse Amazon Rekognition to Build a Facial Recognition System
Use Amazon Rekognition to Build a Facial Recognition SystemAmazon Web Services
 
AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...
AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...
AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...Amazon Web Services
 
re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...
re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...
re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...Adrian Hornsby
 
Build Computer Vision Applications with Amazon Rekognition and SageMaker
Build Computer Vision Applications with Amazon Rekognition and SageMakerBuild Computer Vision Applications with Amazon Rekognition and SageMaker
Build Computer Vision Applications with Amazon Rekognition and SageMakerSungmin Kim
 
Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...
Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...
Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...Amazon Web Services
 
Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...
Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...
Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...Amazon Web Services
 
Day 1, Seo Architecture | September 11
Day 1, Seo Architecture | September 11 Day 1, Seo Architecture | September 11
Day 1, Seo Architecture | September 11 Thierry Arsenault
 
AI: State of the Union
AI: State of the UnionAI: State of the Union
AI: State of the UnionAdrian Hornsby
 
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018Amazon Web Services
 

What's hot (11)

NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017
NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017
NEW LAUNCH! Feature updates for Amazon Rekognition - MCL336 - re:Invent 2017
 
Use Amazon Rekognition to Build a Facial Recognition System
Use Amazon Rekognition to Build a Facial Recognition SystemUse Amazon Rekognition to Build a Facial Recognition System
Use Amazon Rekognition to Build a Facial Recognition System
 
AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...
AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...
AWS Machine Learning Week SF: Build an Image-Based Automatic Alert System wit...
 
re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...
re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...
re:Invent re:Cap - An overview of Artificial Intelligence and Machine Learnin...
 
Build Computer Vision Applications with Amazon Rekognition and SageMaker
Build Computer Vision Applications with Amazon Rekognition and SageMakerBuild Computer Vision Applications with Amazon Rekognition and SageMaker
Build Computer Vision Applications with Amazon Rekognition and SageMaker
 
Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...
Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...
Amazon Polly Tips and Tricks: How to Bring Your Text-to-Speech Voices to Life...
 
Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...
Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...
Exploring the Business Use Cases for Amazon Rekognition - June 2017 AWS Onlin...
 
Day 1, Seo Architecture | September 11
Day 1, Seo Architecture | September 11 Day 1, Seo Architecture | September 11
Day 1, Seo Architecture | September 11
 
SEO Cheat Sheet
SEO Cheat SheetSEO Cheat Sheet
SEO Cheat Sheet
 
AI: State of the Union
AI: State of the UnionAI: State of the Union
AI: State of the Union
 
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
 

Viewers also liked

Serverless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWSServerless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWSAmazon Web Services
 
Geospatial search with SOLR
Geospatial search with SOLRGeospatial search with SOLR
Geospatial search with SOLRNicolas Leroy
 
I See NoSQL Document Stores in Geospatial Applications
I See NoSQL Document Stores in Geospatial ApplicationsI See NoSQL Document Stores in Geospatial Applications
I See NoSQL Document Stores in Geospatial ApplicationsIBM Cloud Data Services
 
AWS Black Belt Techシリーズ Amazon CloudSearch
AWS Black Belt Techシリーズ Amazon CloudSearchAWS Black Belt Techシリーズ Amazon CloudSearch
AWS Black Belt Techシリーズ Amazon CloudSearchAmazon Web Services Japan
 
Practical Elasticsearch - real world use cases
Practical Elasticsearch - real world use casesPractical Elasticsearch - real world use cases
Practical Elasticsearch - real world use casesItamar
 
Build a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS LambdaBuild a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS LambdaTheFamily
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayAmazon Web Services
 
LuceneRDD for (Geospatial) Search and Entity Linkage
LuceneRDD for (Geospatial) Search and Entity LinkageLuceneRDD for (Geospatial) Search and Entity Linkage
LuceneRDD for (Geospatial) Search and Entity Linkagezouzias
 
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon Web Services
 

Viewers also liked (9)

Serverless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWSServerless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWS
 
Geospatial search with SOLR
Geospatial search with SOLRGeospatial search with SOLR
Geospatial search with SOLR
 
I See NoSQL Document Stores in Geospatial Applications
I See NoSQL Document Stores in Geospatial ApplicationsI See NoSQL Document Stores in Geospatial Applications
I See NoSQL Document Stores in Geospatial Applications
 
AWS Black Belt Techシリーズ Amazon CloudSearch
AWS Black Belt Techシリーズ Amazon CloudSearchAWS Black Belt Techシリーズ Amazon CloudSearch
AWS Black Belt Techシリーズ Amazon CloudSearch
 
Practical Elasticsearch - real world use cases
Practical Elasticsearch - real world use casesPractical Elasticsearch - real world use cases
Practical Elasticsearch - real world use cases
 
Build a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS LambdaBuild a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS Lambda
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API Gateway
 
LuceneRDD for (Geospatial) Search and Entity Linkage
LuceneRDD for (Geospatial) Search and Entity LinkageLuceneRDD for (Geospatial) Search and Entity Linkage
LuceneRDD for (Geospatial) Search and Entity Linkage
 
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
 

Similar to Geospatial Search With Amazon CloudSearch

Delivering Better Search For WordPress - AWS Webcast
Delivering Better Search For WordPress - AWS WebcastDelivering Better Search For WordPress - AWS Webcast
Delivering Better Search For WordPress - AWS WebcastMichael Bohlig
 
CIS13: AWS Identity and Access Management
CIS13: AWS Identity and Access ManagementCIS13: AWS Identity and Access Management
CIS13: AWS Identity and Access ManagementCloudIDSummit
 
AWS Webcast - High Availability with Route 53 DNS Failover
AWS Webcast - High Availability with Route 53 DNS FailoverAWS Webcast - High Availability with Route 53 DNS Failover
AWS Webcast - High Availability with Route 53 DNS FailoverAmazon Web Services
 
AWS Webinar - Intro to Amazon Cloudfront 13-09-17
AWS Webinar -  Intro to Amazon Cloudfront 13-09-17AWS Webinar -  Intro to Amazon Cloudfront 13-09-17
AWS Webinar - Intro to Amazon Cloudfront 13-09-17Amazon Web Services
 
DynamoDB and Amazon Cloudsearch
DynamoDB and Amazon CloudsearchDynamoDB and Amazon Cloudsearch
DynamoDB and Amazon CloudsearchMichael Bohlig
 
Backup and Recovery for Linux With Amazon S3
Backup and Recovery for Linux With Amazon S3Backup and Recovery for Linux With Amazon S3
Backup and Recovery for Linux With Amazon S3Amazon Web Services
 
Customizing AWS DeepRacer Action Space
Customizing AWS DeepRacer Action SpaceCustomizing AWS DeepRacer Action Space
Customizing AWS DeepRacer Action SpaceKire Galev
 

Similar to Geospatial Search With Amazon CloudSearch (9)

Delivering Better Search For WordPress - AWS Webcast
Delivering Better Search For WordPress - AWS WebcastDelivering Better Search For WordPress - AWS Webcast
Delivering Better Search For WordPress - AWS Webcast
 
CIS13: AWS Identity and Access Management
CIS13: AWS Identity and Access ManagementCIS13: AWS Identity and Access Management
CIS13: AWS Identity and Access Management
 
AWS Webcast - High Availability with Route 53 DNS Failover
AWS Webcast - High Availability with Route 53 DNS FailoverAWS Webcast - High Availability with Route 53 DNS Failover
AWS Webcast - High Availability with Route 53 DNS Failover
 
AWS Webinar - Intro to Amazon Cloudfront 13-09-17
AWS Webinar -  Intro to Amazon Cloudfront 13-09-17AWS Webinar -  Intro to Amazon Cloudfront 13-09-17
AWS Webinar - Intro to Amazon Cloudfront 13-09-17
 
DynamoDB and Amazon Cloudsearch
DynamoDB and Amazon CloudsearchDynamoDB and Amazon Cloudsearch
DynamoDB and Amazon Cloudsearch
 
Backup and Recovery for Linux With Amazon S3
Backup and Recovery for Linux With Amazon S3Backup and Recovery for Linux With Amazon S3
Backup and Recovery for Linux With Amazon S3
 
Customizing AWS DeepRacer Action Space
Customizing AWS DeepRacer Action SpaceCustomizing AWS DeepRacer Action Space
Customizing AWS DeepRacer Action Space
 
eMetrics Summit San Francisco 2013
eMetrics Summit San Francisco 2013 eMetrics Summit San Francisco 2013
eMetrics Summit San Francisco 2013
 
Hadoop on the Cloud
Hadoop on the CloudHadoop on the Cloud
Hadoop on the Cloud
 

More from Michael Bohlig

Amazon Cloudsearch Session With Elsevier: re:Invent 2013
Amazon Cloudsearch Session With Elsevier: re:Invent 2013 Amazon Cloudsearch Session With Elsevier: re:Invent 2013
Amazon Cloudsearch Session With Elsevier: re:Invent 2013 Michael Bohlig
 
Building Great Mobile Search with Productsy and Amazon CloudSearch
Building Great Mobile Search with Productsy and Amazon CloudSearchBuilding Great Mobile Search with Productsy and Amazon CloudSearch
Building Great Mobile Search with Productsy and Amazon CloudSearchMichael Bohlig
 
Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013
Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013
Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013Michael Bohlig
 
Amazon CloudSearch User Talk - Naked Wines
Amazon CloudSearch User Talk - Naked Wines Amazon CloudSearch User Talk - Naked Wines
Amazon CloudSearch User Talk - Naked Wines Michael Bohlig
 
Tuning Search Requests - Amazon CloudSearch
Tuning Search Requests - Amazon CloudSearchTuning Search Requests - Amazon CloudSearch
Tuning Search Requests - Amazon CloudSearchMichael Bohlig
 
Snapguide - Amazon Cloudsearch
Snapguide - Amazon CloudsearchSnapguide - Amazon Cloudsearch
Snapguide - Amazon CloudsearchMichael Bohlig
 
EDU2.0 and Amazon CloudSearch
EDU2.0 and Amazon CloudSearchEDU2.0 and Amazon CloudSearch
EDU2.0 and Amazon CloudSearchMichael Bohlig
 
Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation Michael Bohlig
 

More from Michael Bohlig (8)

Amazon Cloudsearch Session With Elsevier: re:Invent 2013
Amazon Cloudsearch Session With Elsevier: re:Invent 2013 Amazon Cloudsearch Session With Elsevier: re:Invent 2013
Amazon Cloudsearch Session With Elsevier: re:Invent 2013
 
Building Great Mobile Search with Productsy and Amazon CloudSearch
Building Great Mobile Search with Productsy and Amazon CloudSearchBuilding Great Mobile Search with Productsy and Amazon CloudSearch
Building Great Mobile Search with Productsy and Amazon CloudSearch
 
Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013
Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013
Amazon Redshift - Bay Area CloudSearch Meetup June 19, 2013
 
Amazon CloudSearch User Talk - Naked Wines
Amazon CloudSearch User Talk - Naked Wines Amazon CloudSearch User Talk - Naked Wines
Amazon CloudSearch User Talk - Naked Wines
 
Tuning Search Requests - Amazon CloudSearch
Tuning Search Requests - Amazon CloudSearchTuning Search Requests - Amazon CloudSearch
Tuning Search Requests - Amazon CloudSearch
 
Snapguide - Amazon Cloudsearch
Snapguide - Amazon CloudsearchSnapguide - Amazon Cloudsearch
Snapguide - Amazon Cloudsearch
 
EDU2.0 and Amazon CloudSearch
EDU2.0 and Amazon CloudSearchEDU2.0 and Amazon CloudSearch
EDU2.0 and Amazon CloudSearch
 
Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation
 

Recently uploaded

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Geospatial Search With Amazon CloudSearch

  • 1. GeoSpatial Search in Amazon CloudSearch Tom Hill January 30, 2013 © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 2. Agenda !   What is GeoSpatial search? !   Why do we care? !   Computing distance !   Geospatial Search in CloudSearch © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 3. What is GeoSpatial Search? !   Using location & distance as factors in search © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 4. What's this "Geo", anyway? !   Spatial !   Geographic •  Simple distance •  On the earth © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 5. How do we use distance? !   Limit to an Area •  Box •  Circle •  Polygon* !   Sort by Distance !   Include distance in score *not yet! © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 6. Why Do You Care? !   People care about things near them. •  Pizza, Classified Ads, etc. •  Find a Doctor, Lawyer,… !   Mobile is a key driver © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 7. What can you do with CloudSearch? © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 8. Computing Distance !   Many Formulas •  Rectangular distance •  Equirectangular projection •  Spherical Law of Cosines •  Haversine Formula •  Vincenty's Formula !   Speed Vs. Accuracy •  Speed: Rectangular distance •  Accuracy: Vincenty's Formula © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 9. Why So Many Ways to Compute Distance? The earth isn't flat! It isn't a sphere either. © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 10. Is the Earth Flat? !   If it's flat •  distance = sqrt((lat1-lat2)^2 + (lon1-lon2)^2) !   If it's not © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 11. How Much Accuracy? !   "Pizza, 1 Mile" ! Haversine is more accurate •  If you are a bird !   Any distance is approximate © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 12. Comparing Distance Computations !   Four computations: Haversine, Cosines, EquiRrect, Rect. !   Different computations – Different Results !   How accurate do you need to be? Haversine      Cosines     EuqiRect         Rect  -  CosErr EquErr RecErr  994.79893    994.79893    995.25921   1044.40926  -   0.000  0.000  0.050  Fort Lauderdale, FL to Anniston, AL 624.04339   3624.04339   3642.98321   4163.41737  -   0.000  0.005  0.149  Fort Lauderdale, FL to San Diego, CA 1812.54997   1812.54997   1814.38516   1871.77660  -   0.000  0.001  0.033  Fort Lauderdale, FL to New Haven, CT 8175.93897   8175.93897   8817.96563  11107.90729  -   0.000  0.079  0.359  Fort Lauderdale, FL to Adak, AK 7244.45661   7244.45661   8008.74698  12015.96646  -   0.000  0.106  0.659  Bangor, ME to Adak,AK © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 13. GeoSpatial Search in Amazon CloudSearch © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 14. How to Compute Distance in CloudSearch? !   Rank Expressions •  Computations run for each matching document !   Can be used for •  Sorting •  Influencing Scoring © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 15. Two Types of Rank Expressions !   Static Rank Expressions •  Computation based on values in index !   Query Time Rank Expressions •  Allow including parameters at run time. •  e.g. latitude, longitude. © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 16. Query Time Rank Expressions !   Define Rank Expression •  &rank-NAME=EXPRESSION •  &rank-geo=sqrt(pow(lat-userlat),2)+pow(lon-userlon),2)) !   Select Rank Expression •  &rank=NAME •  &rank=geo http://searchendpoint?q=creek&rank=geo&rank-geo=sqrt(pow(la1-123),2)+pow(lo1-456),2)) © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 17. Influencing Scoring !   Include both text relevance and distance: &rank-geo=(1000-text_relevance) + sqrt(pow(la1-ulat),2)+pow(lo1-ulon),2)) !   Relative Weight •  N * text_relevance + M * distance •  That's where the art comes in. •  Will vary by your application. •  Test & tune, and test again. © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 18. Storing Data !   CloudSearch supports unsigned integers !   Have to convert latitude, longitude to positive ranges •  latitude + 90 •  longitude + 180 !   Have to store as integers; need to scale •  latitude = (latitude + 90) * 100 •  longitude= (longitude+ 180) * 100 © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 19. Performance !   Don't query the whole world •  Can limit by literals or numeric fields. •  Literals are more efficient for limits. !   Limit Options •  Literal •  &bq=state:'CA' •  &bq=zip:'94402' •  Numeric •  &bq=(and latitude:40..50 longitude:80..85) •  Geohash © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 20. Performance Measures Why you don't want query the whole world! !GeoMethod!!!!TextRel!!!!!Limits!!!!Queries!!Seconds!!QTimeMS!!!!Threads!CompletedQ!!!!!!AveHits! !!!!!!NONE!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!!6.2255!!!!!!622!!!!!!!!!!1!!!!!!!!!10!!!8345450.00! !CARTESIAN!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!15.6064!!!!!1560!!!!!!!!!!1!!!!!!!!!10!!!8345450.00! !!!!!!EQUI!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!19.7106!!!!!1971!!!!!!!!!!1!!!!!!!!!10!!!8345450.00! !!!COSINES!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!27.4968!!!!!2749!!!!!!!!!!1!!!!!!!!!10!!!8345450.00! !HAVERSINE!!!!!!false!!!!!!!!!!!!!!!!!!!!10!!31.2595!!!!!3125!!!!!!!!!!1!!!!!!!!!10!!!8345450.00! ! !!!!!!NONE!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.1758!!!!!!917!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00! !CARTESIAN!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.0255!!!!!!902!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00! !!!!!!EQUI!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.1158!!!!!!911!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00! !!!COSINES!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.8321!!!!!!983!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00! !HAVERSINE!!!!!!false!!!!Numeric!!!!!!!!!10!!!9.1272!!!!!!912!!!!!!!!!!1!!!!!!!!!10!!!!!!3807.00! ! !!!!!!NONE!!!!!!false!!!!literal!!!!!!!!!10!!!0.8254!!!!!!!82!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00! !CARTESIAN!!!!!!false!!!!literal!!!!!!!!!10!!!0.5936!!!!!!!59!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00! !!!!!!EQUI!!!!!!false!!!!literal!!!!!!!!!10!!!0.6173!!!!!!!61!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00! !!!COSINES!!!!!!false!!!!literal!!!!!!!!!10!!!0.5916!!!!!!!59!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00! !HAVERSINE!!!!!!false!!!!literal!!!!!!!!!10!!!0.6289!!!!!!!62!!!!!!!!!!1!!!!!!!!!10!!!!!!3781.00! ! © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 21. Geo-Spatial Demo Application © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 22. © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 23. Demo Application Structure HTML Page Ajax Server CloudSearch Javascript (Tomcat) © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 24. Demo Implementation !   JavaScript •  Ajax •  JQuery •  Google Maps API !   Twitter Bootstrap •  css !   Tomcat Server •  Java •  Just for forwarding of requests •  Because XSS, that's why. © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 25. Querying CloudSearch $.ajax({( (url(:("searchx",( (data(:({( ( ('q'(:(currentQuery,( ( ('domain'(:("geoname25",( ( ('return@fields'(:(returnFields.join(),( ( ("rank"(:("geo",( ( ("rank@geo"(:("Math.sqrt(Math.pow(Math.abs(doc.latitude_90@(12539),2)(+( Math.pow(Math.abs(doc.longitude_180@(5784),2))"( (},( (dataType(:("json",( (success(:(function(data)({( ( (var(hits(=(data['hits'];( ( (displaySearchResults(hits['hit'],(hits['found']);( ( (populateMap(hits['hit']);( (}( © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. });(
  • 26. Wrap Up © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 27. Thanks for Coming! !   Data •  http://www.geonames.org/export/ !   Slides •  On the meetup group soon !   Sample Code •  Talk to me. (tomhill@amazon.com) !   Computations •  http://www.movable-type.co.uk/scripts/latlong.html •  wikipedia © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 28. Querying Data !   Java/Javascript •  Fields are latitude_90, longitude_180 •  user location is userlat, userlon !   simple distance rank!=!"Math.sqrt(Math.pow(Math.abs(latitude_90W("!+!userlat!+!")), 2)+Math.pow(Math.abs(longitude_180W("!+!userlon!+!")),2))";! ! !   Spherical Law of Cosines rank = "6371*Math.acos(Math.sin(" + userlat + ") * Math.sin(lat_rad/" + scale + ") + Math.cos(" + userlat + ") * Math.cos(lat_rad/" + scale + ") * Math.cos((lon_rad/" + scale + ") - " + userlon + ") )";! © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 29. What CloudSearch Doesn't Do © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
  • 30. Issues with assuming the earth is flat. © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.