Tagged: custom map, map, Map Style
This topic contains 3 replies, has 2 voices, and was last updated by Luke Day 3 years, 4 months ago.
-
AuthorPosts
-
July 14, 2016 at 9:52 am #53238
Hey, is it possible to customise the style of the map?
I want my map to look like this but can’t find the map file json?
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950[{"featureType": "water","stylers": [{ "visibility": "on" },{ "color": "#1A87D6" }]},{"featureType": "landscape","stylers": [{ "color": "#AFFFA0" }]},{"featureType": "road","elementType": "geometry","stylers": [{ "color": "#59A499" }]},{"featureType": "poi","stylers": [{ "color": "#EAFFE5" }]},{},{"featureType": "road","elementType": "geometry.stroke","stylers": [{ "color": "#F0FF8D" },{ "weight": 2.2 }]},{"featureType": "poi.business","stylers": [{ "visibility": "off" }]},{"featureType": "poi.government","stylers": [{ "visibility": "off" }]},{"featureType": "administrative.locality","stylers": [{ "visibility": "off" }]},{},{}]Regards,
LukeJuly 14, 2016 at 12:41 pm #53242Got this done in another thread… Thanks mate.
July 21, 2016 at 8:07 am #53323Can you share the thread? Need to do the same kind of thing.
July 21, 2016 at 8:39 am #53324To add your own map style to GEO my WP search form use the script below (added to the functions.php file of your theme) =D
123456789function gmw_modify_map_style( $mapArgs ) {// replace the script that is inside the json_decode( ' ' ) with your own script$mapArgs['mapOptions']['styles'] = json_decode( 'REMOVE TEXT & ADD YOUR SCRIPT' );return $mapArgs;}// replace 1 in gmw_map_element_1 to the GEO my WP form IDadd_filter( 'gmw_map_element_1', 'gmw_modify_map_style', 50 );You can create a map and get the relevant json code here, http://googlemaps.github.io/js-samples/styledmaps/wizard/index.html
To use on multiple maps simply add additional filters with the ID of each map, for example:
12add_filter( 'gmw_map_element_2', 'gmw_modify_map_style', 50 );add_filter( 'gmw_map_element_3', 'gmw_modify_map_style', 50 ); -
AuthorPosts
You must be logged in to reply to this topic.