features => \@features
};
+my $apikey = FS::Conf->new->config('google_maps_api_key');
</%init>
+
<div id="map_canvas"></div>
<style type="text/css">
#map_canvas { height: 100%; }
</style>
-<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3">
+<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3<% $apikey ? "&key=$apikey" : '' %>">
</script>
<script type="text/javascript">
// construct bounds around all of the features
var bounds = new google.maps.LatLngBounds;
map.data.forEach(function(feature) {
- var g = feature.getGeometry();
- if (g.getType() == 'Point') {
- bounds.extend(g.get());
- } else if (g.getArray) {
- g.getArray().forEach(function(point) { bounds.extend(point); });
+ var b = feature.getProperty('bounds');
+ if (b) { // if it specifies an ROI, include all of it
+ bounds.union(b);
+ } else {
+ var g = feature.getGeometry();
+ if (g.getType() == 'Point') {
+ bounds.extend(g.get());
+ } else if (g.getArray) {
+ g.getArray().forEach(function(point) { bounds.extend(point); });
+ }
}
});