During Google’s I/O 2019 developer conference, the company announced several updates to its Google Maps PlatformTrack this API, including a new Maps SDK for Android and the addition of deck.gl support. Travis McPhail, an engineering lead for the Maps Platform, shared these updates along with several best practices for building mapping solutions that perform well at scale.
1. Only Add/Remove Custom Overlay Content When the User Stops Panning/Zooming
Custom Overlays are a layer of geospatial data that is rendered on top of the map. If you choose to have complex overlays render in real-time as the user is moving the map it can lead to poor performance and choppy map loading.
2. No Heavyweight Non-Drawing Logic in The Draw Method
The Draw Method is called every time the map is drawn. The concern is that if you do too much work in this method it can lead to poor performance and slow map loading. The time it takes to render a frame can be dramatically increased.
3. Use JPG or PNG Assets Instead of SVG
Plain and simple Google Maps just isn't optimized for SVG at this time. If you do need to use an SVG file it is recommends that you rasterize the image first.
4. Don’t Forget to Cluster
To avoid having a map that gets overly cluttered with markers on top of each other, it is recommended that you use the MarkerCluster function to group the markers together. You can manually set properties controlling how many markers are grouped together as well as at what zoom level the markers separate.
5. Use deck.gl for Overlaying Massive Datasets
Google has now partnered with deck.gl, an open source data visualization library that renders hundreds of thousands of data points with WebGL. Google is recommending that users who are looking to work with large datasets work with deck.gl.
Additionally, Google today announced the beta release of a new Maps SDK for Android. Up until now the Maps SDK for Android was not built on entirely the same infrastructure as the Google Maps Mobile App. This had been causing issues and the team decided to make the update. Google is offering a migration guide for interested developers.