Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Geolocalização + E-Commerce
Alexandre Gaigalas
June 08, 2016
Technology
2
110
Geolocalização + E-Commerce
Apresentação sobre geolocalização realizada no iMasters DevCommerce 2016
Alexandre Gaigalas
June 08, 2016
Tweet
Share
More Decks by Alexandre Gaigalas
See All by Alexandre Gaigalas
Passos em Direção à Glória do REST
alganet
0
360
Porrada no Wordpress!
alganet
2
390
Microframeworks vs. Frameworks
alganet
4
310
Dados!
alganet
2
240
Domine Validação de Dados em 45min
alganet
6
400
Criação de Software para Durar
alganet
4
460
REST in PaaS
alganet
6
750
Linked Data e Web Semântica
alganet
1
270
Armazenamento de Dados para Web Semântica
alganet
4
350
Other Decks in Technology
See All in Technology
都市ARの作り方 PLATEAU ✖︎ Geospatial API
41h0_shiho
1
330
メドレー エンジニア採用資料/ Medley Engineer Guide
medley
3
5.2k
Deep Neural Networkの共同学習
hf149
0
360
AI Services 概要 / AI Services overview
oracle4engineer
PRO
0
180
NGINXENG JP#2 - 4-NGINX-エンジニアリング勉強会
hiropo20
0
130
NGINXENG JP#2 - 1-NGINX-エンジニアリング勉強会-きょうの見どころ
hiropo20
0
120
Stripe / Okta Customer Identity Cloud(旧Auth0) の採用に至った理由 〜モリサワの SaaS 戦略〜
tomuro
0
140
03_ユーザビリティテスト
kouzoukaikaku
0
840
あつめたデータをどう扱うか
skrb
2
180
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
3
16k
Periodic Multi-Agent Path Planning
hziwara
0
160
データ分析基盤の要件分析の話(202201_JEDAI)
yabooun
0
400
Featured
See All Featured
Creatively Recalculating Your Daily Design Routine
revolveconf
207
11k
Designing on Purpose - Digital PM Summit 2013
jponch
108
5.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
31
20k
Building Your Own Lightsaber
phodgson
96
4.9k
Into the Great Unknown - MozCon
thekraken
2
310
jQuery: Nuts, Bolts and Bling
dougneiner
57
6.6k
Testing 201, or: Great Expectations
jmmastey
25
5.7k
Unsuck your backbone
ammeep
659
56k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
7
590
Intergalactic Javascript Robots from Outer Space
tanoku
261
26k
From Idea to $5000 a Month in 5 Months
shpigford
374
44k
Making the Leap to Tech Lead
cromwellryan
117
7.7k
Transcript
Geolocalização + E-Commerce
Alexandre Gaigalas
Alexandre Gaigalas Iterador de CRUD Avançado
None
Powered by: PHP, MongoDB, MySQL, Redis, Kafka, ActiveMQ, Memcache, Amazon,
Docker, etc.
None
Encontrando Veículos
None
None
<?php $mongo->my_db->command([ 'geoNear' => 'my_collection', 'near' => [ -46.6579243, -23.5640367
], 'maxDistance' => '1' / 6378.1, 'spherical' => true, 'distanceMultiplier' => 6378.1 ]);
<?php $mongo->my_db->ensureIndex([ 'location' => '2d' ]);
None
Tem um jeito melhor?
None
None
Distâncias são relativas
None
None
Easy Share: Compartilhamento de Corridas
None
None
Lembra no colégio...
None
{ "type": "MultiPolygon", "coordinates": [ [ [ [-109.25, 36.285596], [-109.27,
40.962013], [-109.35, 36.285596] ], [ [-59.35, 36.285596], [-59.45, 40.962013], [-59.55, 36.285596] ] ] ] }
<?php $mongo->my_db->ensureIndex([ 'location' => '2dsphere' ]);
None
None
Multi-Pontos e Multi-Polígonos
{ "type": "MultiPoint", "coordinates": [ [-105.01621, 39.57422], [-80.6665134, 35.0539943] ]
}
$mongo->my_db->my_collection->find([ 'location' => [ '$geoWithin' => [ '$geometry' => [
'type' => 'MultiPolygon', 'coordinates' => [ [ [ [-109.25, 36.285596], [-109.27, 40.962013], [-109.35, 36.285596] ], [ [-59.35, 36.285596], [-59.45, 40.962013], [-59.55, 36.285596] ] ] ] ] ] ] ]);
Invertendo tudo...
<?php $mongo->my_db->my_collection->find([ '$and' => [ [ 'location' => [ '$geoIntersects'
=> [ '$geometry' => $pointA ] ] ], [ 'location' => [ '$geoIntersects' => [ '$geometry' => $pointB ] ] ] ] ]);
Obrigado!
Perguntas?