SlideShare a Scribd company logo
1 of 23
Advanced Map Feature
- Marker Cluster
Mickey Chiang
What we’ll do
Before we begin...
Pre-requires
- Basic knowledge of Android and Kotlin programming
- Basic knowledge of map.
To learn more, see Get Started with Google Maps Platform
- Material
- [Android] 一起來做三倍券地圖吧(一)
- [Android] 一起來做三倍券地圖吧(二)
Google Map SDK for Android
- Please set up Google map API key first
Layout for MapsActivity
Set up for map
Add one marker
Add a custom marker image
Add BitmapHelper.vectorToBitmap
Note: vectorToBitmap was taken from the Maps SDK for Android
samples. For more information, see it on GitHub.
Put custom marker
Add multiple markers
VIDEO
Maps SDK for Android Utility Library
Update your build.gradle
Go ahead and update the dependencies section of your
app/build.gradle file.
Implement clustering
1. Implement the ClusterItem interface.
2. Subclass the DefaultClusterRenderer class.
3. Create a ClusterManager and add items.
1.Implement the ClusterItem interface
1.ClusterRenderer
- ClusterManager, internally uses a ClusterRenderer class to handle
creating the clusters as you pan and zoom around the map.
- In this project, markers need to be customized, you need to extend this class
and add the customizations in there.
2.Subclass the DefaultClusterRenderer class
Comes from MapActivity
Comes from MapActivity
2.Subclass the DefaultClusterRenderer class
3.Create a ClusterManager and add items
3.Handle onMapReady behavior
Please see page 19
Congratulations!
Your map look much elegant now!
VIDEO
Reference
Codelab:
Google Maps Platform 101—Android
Image Resources:
Icons
Find me @
LinkedIn Facebook Github

More Related Content

Similar to Advanced map feature - marker cluster

Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
Ahsanul Karim
 
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
NgLQun
 
Breizhcamp Rennes 2011
Breizhcamp Rennes 2011Breizhcamp Rennes 2011
Breizhcamp Rennes 2011
sekond0
 

Similar to Advanced map feature - marker cluster (20)

Google Maps on iOS with Swift
Google Maps on iOS with SwiftGoogle Maps on iOS with Swift
Google Maps on iOS with Swift
 
Augmented World Expo 2013 Mobile AR SDK Comparison and Tutorial
Augmented World Expo 2013 Mobile AR SDK Comparison and TutorialAugmented World Expo 2013 Mobile AR SDK Comparison and Tutorial
Augmented World Expo 2013 Mobile AR SDK Comparison and Tutorial
 
以 Kotlin 快速打造 Mobile Backend
以 Kotlin 快速打造 Mobile Backend以 Kotlin 快速打造 Mobile Backend
以 Kotlin 快速打造 Mobile Backend
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
 
Mobile AR SDK Tutorial - Augmented World Expo New York 2014
Mobile AR SDK Tutorial - Augmented World Expo New York 2014Mobile AR SDK Tutorial - Augmented World Expo New York 2014
Mobile AR SDK Tutorial - Augmented World Expo New York 2014
 
Android programming
Android programmingAndroid programming
Android programming
 
Serverless Container with Source2Image
Serverless Container with Source2ImageServerless Container with Source2Image
Serverless Container with Source2Image
 
Serverless containers … with source-to-image
Serverless containers  … with source-to-imageServerless containers  … with source-to-image
Serverless containers … with source-to-image
 
[Kotlin Serverless 工作坊] 單元 1 - 開發環境建置
[Kotlin Serverless 工作坊] 單元 1 - 開發環境建置[Kotlin Serverless 工作坊] 單元 1 - 開發環境建置
[Kotlin Serverless 工作坊] 單元 1 - 開發環境建置
 
4_pillars_for_app_development_in_GCP.pdf
4_pillars_for_app_development_in_GCP.pdf4_pillars_for_app_development_in_GCP.pdf
4_pillars_for_app_development_in_GCP.pdf
 
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
 
Breizhcamp Rennes 2011
Breizhcamp Rennes 2011Breizhcamp Rennes 2011
Breizhcamp Rennes 2011
 
Android tutorial1
Android tutorial1Android tutorial1
Android tutorial1
 
Augmented World Expo 2014 Wearable SDK Overview
Augmented World Expo 2014 Wearable SDK OverviewAugmented World Expo 2014 Wearable SDK Overview
Augmented World Expo 2014 Wearable SDK Overview
 
ARCore 101: A Hands-on Workshop
ARCore 101: A Hands-on WorkshopARCore 101: A Hands-on Workshop
ARCore 101: A Hands-on Workshop
 
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
 
ML Kit , Cloud FF GDSC MESCOE.pdf
ML Kit , Cloud FF GDSC MESCOE.pdfML Kit , Cloud FF GDSC MESCOE.pdf
ML Kit , Cloud FF GDSC MESCOE.pdf
 
Nativescript with angular 2
Nativescript with angular 2Nativescript with angular 2
Nativescript with angular 2
 
Getting Started With Android
Getting Started With AndroidGetting Started With Android
Getting Started With Android
 

Recently uploaded

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Advanced map feature - marker cluster

Editor's Notes

  1. 我先簡單的介紹一下今天要做什麼, 今天我們會在基本的google map上加入一個叫marker cluster的feature, 這個feature是由Google Map SDK for Android提供的。
  2. 適合接下來內容的朋友們, 我會建議要有基礎的Android跟Kotlin知識, 再來就是要花一些時間去申請Google map API key、才能使用地圖相關的一些服務, 我的PPT上面有附上官方寫的申請方式, 如果覺得看得很痛苦也可以看我之前寫的文章。 第一集是帶著大家一起申請Google map API key, 第二集則是示範如何讓APP顯示地圖以及加入第一個Marker
  3. 這邊要麻煩大家照著文章, 先把該加的key加進project裡面, 可以看前面提到的三倍券文章~
  4. 從File > New 加入你擁有的SVG檔案, 感謝Tom Liu的提供, 接著這個檔案就會被夾到drawable的目錄底下。
  5. 一般來說,我們用Default的ClusterRenderer就可以了,但因為我們會用到自訂的marker, 所以要extend ClusterRenderer
  6. 我們把maskIcon跟在ItemRendered前的行為搬到StoreRender
  7. 在cluster繪圖後被呼叫,要將我們前前一步做的clusterItemset給marker的tag 因為是在繪圖後,所以已經可以拿到傳參數中的marker了