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
340
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
サイバーエージェントグループのSRE10年の歩みとAI時代の生存戦略
shotatsuge
4
420
【LT会登壇資料】TROCCO新コネクタ「スマレジ」を活用した直営店データの分析
kazari0425
1
110
QuickSight SPICE の効果的な運用戦略~S3 + Athena 構成での実践ノウハウ~/quicksight-spice-s3-athena-best-practices
emiki
0
120
スタートアップに選択肢を 〜生成AIを活用したセカンダリー事業への挑戦〜
nstock
0
260
20250705 Headlamp: 專注可擴展性的 Kubernetes 用戶界面
pichuang
0
290
SREのためのeBPF活用ステップアップガイド
egmc
1
200
敢えて生成AIを使わないマネジメント業務
kzkmaeda
2
470
[SRE NEXT] ARR150億円_エンジニア140名_27チーム_17プロダクトから始めるSLO.pdf
satos
2
650
関数型プログラミングで 「脳がバグる」を乗り越える
manabeai
2
210
SREの次のキャリアの道しるべ 〜SREがマネジメントレイヤーに挑戦して、 気づいたこととTips〜
coconala_engineer
1
150
OpenTelemetryセマンティック規約の恩恵とMackerel APMにおける活用例 / SRE NEXT 2025
mackerelio
2
790
NewSQLや分散データベースを支えるRaftの仕組み - 仕組みを理解して知る得意不得意
hacomono
PRO
3
190
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.7k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
4 Signs Your Business is Dying
shpigford
184
22k
Side Projects
sachag
455
42k
Visualization
eitanlees
146
16k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
How STYLIGHT went responsive
nonsquared
100
5.6k
A Modern Web Designer's Workflow
chriscoyier
695
190k
Docker and Python
trallard
44
3.5k
We Have a Design System, Now What?
morganepeng
53
7.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Designing Experiences People Love
moore
142
24k
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?