Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Geolocalização + E-Commerce
Search
Alexandre Gaigalas
June 08, 2016
Technology
2
130
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
480
Porrada no Wordpress!
alganet
2
410
Microframeworks vs. Frameworks
alganet
4
330
Dados!
alganet
2
270
Domine Validação de Dados em 45min
alganet
6
450
Criação de Software para Durar
alganet
4
510
REST in PaaS
alganet
6
1k
Linked Data e Web Semântica
alganet
1
460
Armazenamento de Dados para Web Semântica
alganet
4
390
Other Decks in Technology
See All in Technology
20250612_GitHubを使いこなすためにソニーの開発現場が取り組んでいるプラクティス.pdf
osakiy8
1
490
OpenJDKエコシステムと開発中の機能を紹介 2025夏版
chiroito
2
1.3k
CSSの最新トレンド Ver.2025
tonkotsuboy_com
11
4.2k
CSSDay, Amsterdam
brucel
0
290
おれのAI活用の現状とこれから
tsukasagr
0
130
AWS Lambdaでサーバレス設計を学ぼう_ベンダーロックインの懸念を超えて-サーバレスの真価を探る
fukuchiiinu
4
960
Kafka vs. Pulsar: Performance Evaluation by Petabyte-Scale Streaming Platform Providers
lycorptech_jp
PRO
1
340
JavaのMCPサーバーで体験するAIエージェントの世界
tatsuya1bm
1
220
データ戦略部門 紹介資料
sansan33
PRO
1
3.2k
ソフトウェア開発現代史: "LeanとDevOpsの科学"の「科学」とは何か? - DORA Report 10年の変遷を追って - #開発生産性_findy
takabow
1
320
20250514_未経験から Fintech実務参画まで。学生エンジニアの挑戦録
hideto1008
0
900
Generational ZGCのメモリ運用改善 - その物理メモリ使用量、本当に正しい?
tabatad
1
290
Featured
See All Featured
Gamification - CAS2011
davidbonilla
81
5.3k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
106
19k
Site-Speed That Sticks
csswizardry
9
620
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Fireside Chat
paigeccino
37
3.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Building Adaptive Systems
keathley
42
2.6k
The Cost Of JavaScript in 2023
addyosmani
50
8.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
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?