Story #6206: Plot data packages on map layer
Find JS library for centroid calculation
Perhaps this will work for us.
Chris also mentioned Dave V. had written something up.
#1 Updated by Chris Jones over 8 years ago
- 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:
#2 Updated by ben leinfelder over 8 years ago
- translation missing: en.field_remaining_hours set to 0.0
- Status changed from In Progress to Resolved
- Description updated (diff)
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();