2

I'm currently loading data into a mapview from a web service, where there are more rows then I can return in one query. As such I'm trying to work out the best way to display these to the user.

My intitial thought is to load 100 pins when the mapview first loads. Then as the user scrolls/zooms load new data depending on where they are either in

 regionDidChangeAnimated

or

 mapViewDidFinishRenderingMap

The trouble is, as I'm trying to refine the places I show them based on zoom, this could get quite costly in terms of api calls. Is there a best practise here? I thought about only showing a user locations once they reach a certain zoom level, but then that could appear to them that there is actually a lack of data when the mapview first loads. My other thought was to check how far they have moved the map in regionDidChangeAnimated and making a call then depending on a threshold and zoom level.

With a tableview its obvious when to do this sort of thing, i.e at the bottom. I thought about loading results in a paged way and displaying results as soon as I get the first "page" back, but I feel that if the user is at a high level, then too many results would add too many pins to the map.

If I have access to the users location,or they provide a point of interest I think it would be easier for me to zoom to a certain scale to display results. But as I don't require this, I'm not sure what to do with the high level view. I appreciate there isn't a lot of code in this question and it sort of leans on the UX side of things. But I'm wondering from a functional perspective what's best. Even if I stored previous results in array, a subsequent api call could in theory bring back duplicates.

Anyone got any ideas on a good approach to this? So far I'm leaning towards showing X amount on load, and perhaps prompting the user to zoom to refine, the onous really is on them then to try and be more specific.

TommyBs
  • 9,354
  • 4
  • 34
  • 65

0 Answers0