Support » Plugin: Comprehensive Google Map Plugin » [Plugin: Comprehensive Google Map Plugin] How to Style with JSON Code

Viewing 4 replies - 1 through 4 (of 4 total)
  • I wondered this too.
    I know hoe to do this with my own map.
    Is it possible to style the map created by CGMP by adding some inline js?
    Many Thanks

    Did you ever figure out how this was done?

    I finally figured this one out, you have to add to the json-string parameter in the object, and tell the javascript file to pick up that style from the object. Here’s what I did, you might be able to suggest better code :

    1. In the cmgp plugin directory > short code.php > line #74 : $map_data_properties[‘styles’] = *your style info here as a json formatted string*
    2. In the cmgp plugin directory > assets > js > cgmp.framework.min.js file > line #2
      1. change : b.maptypecontrol,panControl:"true"===b.pancontrol,zoomControl:"true"===b.zoomcontrol,scaleControl:"true"===b.scalecontrol,scrollwheel:"true"===b.scrollwheelcontrol,streetViewControl:"true"===b.streetviewcontrol,tilt:"true"===b.tiltfourtyfive?45:null,draggable:"true"===b.draggable,overviewMapControl:!0,overviewMapControlOptions:{opened:!1}});"true"===b.showpanoramio&&p.buildPanoramioLayer(b.panoramiouid);"true"===b.showbike&&p.buildBikeLayer();"true"===b.showtraffic&&p.buildTrafficLayer();null!=b.kml&&
      2. to : b.maptypecontrol,panControl:"true"===b.pancontrol,zoomControl:"true"===b.zoomcontrol,scaleControl:"true"===b.scalecontrol,scrollwheel:"true"===b.scrollwheelcontrol,streetViewControl:"true"===b.streetviewcontrol,tilt:"true"===b.tiltfourtyfive?45:null,styles:b.styles,draggable:"true"===b.draggable,overviewMapControl:!0,overviewMapControlOptions:{opened:!1}});"true"===b.showpanoramio&&p.buildPanoramioLayer(b.panoramiouid);"true"===b.showbike&&p.buildBikeLayer();"true"===b.showtraffic&&p.buildTrafficLayer();null!=b.kml&&

    I keep the google style info in my theme options as a json formatted string, then use json_decode($string) to load that into the map_data_properties array

    Hope that makes sense/helps!

    note the styles:b.styles to line #2 in the js frameworks file, if you don’t want to play spot-the-difference between the two js code samples

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Comprehensive Google Map Plugin] How to Style with JSON Code’ is closed to new replies.