Task #6220
closed
- Status changed from New to In Progress
In the d1_dashboard, we were trying to plot all markers simultaneously, and therefore required an aggregation library that took in individual points, and calculating centroids on the client side would be a big task. In this use case, where we're only calculating centroids for, say, 100 markers, using Google's Map API might be the easiest. Try using the LatLngBounds class, which includes the getCenter() method, and only needs the SW and NE corners as arguments, which can be derived from the N, S, E, W bounding coordinates provided in the Solr index. See:
https://developers.google.com/maps/documentation/javascript/reference#LatLngBounds
- Description updated (diff)
- Status changed from In Progress to Resolved
- translation missing: en.field_remaining_hours set to 0.0
Turns out Google Maps API has just the thing for us:
var latLngSW = new gmaps.LatLng(s, w);
var latLngNE = new gmaps.LatLng(n, e);
var bounds = new gmaps.LatLngBounds(latLngSW, latLngNE);
var latLngCEN = bounds.getCenter();
Also available in: Atom
PDF