Hi, I very much appreciate your help-
I’ve been thinking about how to deal with the overlapping/cluster of markers thing (where I have more than one ship in the same location, in my case). So I came up with something that would stagger markers so you don’t get two in the same place (except, I need to make sure that I don’t have two sets of lat/long that are the same)
if (isset ($loc_tracking[$locs->station_key]))
{
if ($loc_tracking[$locs->station_key ][$lat_counter] == 4)
{
$loc_tracking[$locs->station_key ][$lat_counter] = 0;
$loc_tracking[$locs->station_key ][$long_counter]++;
}
else
{
$loc_tracking[$locs->station_key ][$lat_counter]++;
}
}
else
{
$loc_tracking[$ship_line->line_number] = array($latcounter = 0,$longcounter = 0);
}
array_push($map_rows [$ship_line->line_number],($final[0]->location_latitude) + ($loc_tracking[$locs->station_key ][$lat_counter]*.0008));
array_push($map_rows [$ship_line->line_number],($final[0]->location_longitude) + ($loc_tracking[$locs->station_key ][$long_counter]*.0008));
I thought I’d share this with you so you can either use it (I mean, I’ve not tested it, so it’s more pseudo than code, but it’s enough to get the gist)
But anyways, what this does is – track whether a certain location has been used before for a marker- (in an array), and that array has a lat and long tracker for each- so that for each successive use of that location, an amount (in this case, set to roughly .05 nautical miles (as a portion of a degree of latitude- I’ve used the same number for longitude so of course as things get closer to equator, the longitudinal separation will be longer, and closer together as they get closer to the poles). Anyways, the idea is that the ticker will create rows of 5 markers. So it’s not useful for things that need absolute precision- but if people want to show clusters of things and approximation is fine- well then this might be useful to them.
A much simpler solution would have been to dispense with the arrays etc and just- for every marker, have a random float added (on a value of -.0008 to .0008) to both the lat and long value just as part of the iteration through the array, but that would have a non-0 chance of markers still being on top of each other, so *shrug* I didn’t do that.
I hope this is useful.