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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Alexandre Gaigalas
June 08, 2016
Technology
2
150
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
530
Porrada no Wordpress!
alganet
2
430
Microframeworks vs. Frameworks
alganet
4
360
Dados!
alganet
2
300
Domine Validação de Dados em 45min
alganet
6
480
Criação de Software para Durar
alganet
4
540
REST in PaaS
alganet
6
1.2k
Linked Data e Web Semântica
alganet
1
500
Armazenamento de Dados para Web Semântica
alganet
4
400
Other Decks in Technology
See All in Technology
社内でAWS BuilderCards体験会を立ち上げ、得られた気づき / 20260225 Masaki Okuda
shift_evolve
PRO
1
110
Agent Ready になるためにデータ基盤チームが今年やること / How We're Making Our Data Platform Agent-Ready
zaimy
0
170
歴史に敬意を! パラシュートVPoEが組織と共同で立ち上がる信頼醸成オンボーディング
go0517go
PRO
0
220
AI が Approve する開発フロー / How AI Reviewers Accelerate Our Development
zaimy
1
200
GoとWasmでつくる軽量ブラウザUI
keyl0ve
0
130
Interop Tokyo 2025 ShowNet Team Memberで学んだSRv6を基礎から丁寧に
miyukichi_ospf
0
190
全自動で回せ!Claude Codeマーケットプレイス運用術
yukyu30
3
130
競争優位を生み出す戦略的内製開発の実践技法
masuda220
PRO
2
440
GitHub Copilot CLI 現状確認会議(2026年2月のすがた)
torumakabe
4
630
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
94k
Microsoft Fabric のワークスペースと容量の設計原則
ryomaru0825
2
150
AIに視覚を与えモバイルアプリケーション開発をより円滑に行う
lycorptech_jp
PRO
1
530
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
How to train your dragon (web standard)
notwaldorf
97
6.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Side Projects
sachag
455
43k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
86
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
300
Balancing Empowerment & Direction
lara
5
920
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How STYLIGHT went responsive
nonsquared
100
6k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
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?