Hi, I’m currently trying to use Clustering API for iOS but having a hard time understanding how each arguments in
- (void) setClusteringParams: (double) degreePerPixel clusterGridSize: (int) size;
work.
I set degreePerPixel = 1 and size = 100 since it says, in the docs, that the default size is 100.
But, when I query two separate geo points pretty far away from each other, these two geo points are queried as a cluster, when it shouldn’t. How should I set these values so it only queries a cluster when points are reasonably close to each other. I tried setting various values to these two variables, but it doesn’t seem to work!
Best,
Chan Park
Hi Chan,
I suppose the dpp value might be wrong. Here is a quote from the docs explaining what it’s value should be:
dpp - degree per pixel. Use the following psuedo algorithm to calculate the value of dpp:
if (eastLongitude – westLongitude) < 0
dpp = ((eastLongitude – westLongitude) + 360) / mapWidth
else
dpp = ((eastLongitude – westLongitude) / mapWidth
where
westLongitude- the longitude of any point on the western boundary of the map in degrees.
eastLongitude- the longitude of any point on the eastern boundary of the map in degrees.
mapWidth- the size of the viewing area of the map in pixels.
Or you could also try to use another configuration method:
-(void)setClusteringParams:(double)westLongitude eastLongitude:(double)eastLongitude mapWidth:(int)mapWidth clusterGridSize:(int)clusterGridSize;