aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-google-ol.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-03-31 10:11:32 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-03-31 10:11:32 +0100
commit3d967f09d8171b283c9a90afa6407dc033e4ae42 (patch)
tree6ee61d6ae0ec96dfe9444a45bd773d9030283415 /web/js/map-google-ol.js
parentc1346b93ee2dd21ec501484da89aa28350631960 (diff)
parent7032edb7a72758086fcaa3e3d0b198a163cf043c (diff)
Merge branch 'dominican-republic-improvements'
Diffstat (limited to 'web/js/map-google-ol.js')
-rw-r--r--web/js/map-google-ol.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/web/js/map-google-ol.js b/web/js/map-google-ol.js
index 96ec6fe9b..7369a8e9f 100644
--- a/web/js/map-google-ol.js
+++ b/web/js/map-google-ol.js
@@ -33,8 +33,24 @@ fixmystreet.maps.config = function() {
zoomDuration: 10
};
+ var road_layer = {}; // Empty object defaults to standard road layer
+
+ function apply_map_styles() {
+ var styledMapType = new google.maps.StyledMapType(fixmystreet_google_maps_custom_style);
+ this.mapObject.mapTypes.set('styled', styledMapType);
+ this.mapObject.setMapTypeId('styled');
+ }
+ // If you want to apply a custom style to the road map (for example from
+ // a service such as snazzymaps.com) then define that style as a top-level
+ // variable called fixmystreet_google_maps_custom_style (you might have to
+ // override the maps/google-ol.html template to include your own JS file)
+ // and it'll automatically be applied.
+ if (typeof fixmystreet_google_maps_custom_style !== 'undefined') {
+ road_layer = { type: 'styled', eventListeners: { added: apply_map_styles } };
+ }
+
fixmystreet.layer_options = [
- {},
+ road_layer,
{ type: google.maps.MapTypeId.HYBRID }
];
};