google-maps-clustering
google-maps-clustering copied to clipboard
Odd marker/cluster behavior when international date line is in view
I couldn't see where this has been reported, perhaps it's expected behavior but anyhow...subject line pretty much says it all but here's a visual reference http://cld.wthms.co/DSxKuP
I'll ressurect this issue and say that I didn't find any problem with this library regarding the international date line.
I had a similar issue, but fault was mine: When camera moves, I get the the mapView's northEast and southWest to fetch data Usually, northEast has values bigger than southWest, example:
- SW(Lat = -1,Lng = -1)
- NE(Lat = 1 ,Lng = 1)
If you query that on a database, using NE as max values, and SW as min values, it will work.
BUT, around the International Date Line, this is not true, example:
- SW(Lat = -20, Lng = 170)
- NE(Lat = 20, Lng = -170).
Notice that the SW Lng has a bigger value than NE Lng.
If you were to use the same query with this in a database, nothing would come out, because no Latitude can be bigger than 170 and smaller than -170 at the same time.
You could reverse them. Making bigger than -170 and smaller than 170. But by doing this you would get all points that are OUTSIDE the map viewport.
You either would need to: invert the query when the above happens, or split in two queries.
- bigger than 170, smaller than 180. (gets the part in the left side of the line)
- bigger than -180, smaller than -170. (gets the part in the right side of the line)