By Josh Morony
In this tutorial series, we are going to cover how to dynamically load markers from a server and add them to a Google Map in Ionic 2. When dealing with a small number of markers it isn’t a big deal to just load them all and dump them into the map all at once, but when we start getting into the thousands and tens of thousands of markers this starts to become an issue.
Adding a large number of markers at once will cause a performance hit, and if we think about the scale of social applications like Facebook and Foursquare where location data would get into the millions, this strategy is not suitable. A better approach is to only load in the markers as you need them. This means that we will need to:
- Implement a server that will only return a subset of available markers for locations based on proximity
- Calculate the region of space that is displayed on the Google Map so that we know what markers we need to request