-1

Use case - Get the geopoint from Elastic Seach (data source) based on Bounding box of the map. and then those geopoint render as marker in the map.

Context- As the map first time load , we get the markers on the map based on the available bounding box. But as the user start panning/zooming the map , size of the bounding box changes and so the list of markers It is becasue we retrive markers based on the bounding box of the map.

Problem - As user starts panning/zooming the map we need the markers just for the area which had changed due to his panning/zooming , not for the entire bounding box but right now we are getting markers for entire bounding box and hence lot of duplicates markers in the map. We need markers just for incremental bounding box (increment bounding box means area of the map which is just increased due to panning/zooming of the map)

let know if i am able to explain else we can connect online .

what is Bounding box -
bounding box is nothing but visible area of the map Please note that I am using Mapbox.js and RestAPI to implement this

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
Nripa
  • 1
  • Your question is not very clear. But why don't you remove all markers from map before adding new ones after the user pans/zooms the map? – MrUpsidown Jul 22 '15 at 14:34
  • Thanks for your update. That can be done but it gives bad user experience . we want exactly the same way as google map works if we search some thing in googlemap. For example if you search Hospital in a particular area , it will first render list of Hospital (in the form of markers) available withinh the area and then if you start panning it will just render incremental one rather then clearing the exiting one and loading the bigger set for new area – Nripa Jul 24 '15 at 06:20

1 Answers1

0

To get the effect you want, you will need to ask the map for the current list of markers and compare the coordinates to the new list from your data source, adding the new one to the map. Tedious, but should run pretty fast.

picciano
  • 22,341
  • 9
  • 69
  • 82