I was looking for a way to integrate styled Maps in OpenLayers, but the only thing I could finde, was a sandbox module for drupal 6. Are there any undocumented (or documented) ways to use the styling options of Google API v3?

Comments

zzolo’s picture

Status: Active » Closed (works as designed)

Hey @webcultist. There's no way to do this with just configuration in this module. And it doesn't look like there's too much info out there from people who might be doing this. here is the best I found:

http://gis.stackexchange.com/questions/5964/how-to-apply-custom-google-m...

Overall, you should be able to do this, as you have access to the Google Maps object from with OpenLayers. So, in theory with some code, you could make a Layer Type for this module to handle it.

Let me know if you have anymore questions and feel free to re-open.

philpro’s picture

@webcultist or @zzolo do either of you have additional information/proof of concept/progress with this? I would also like to create styled maps.

svdhout’s picture

StatusFileSize
new3.63 KB

I've created a behavior (attached as a module) that allows styling the default google map

You can choose to fill in settings for feature type 'All', or add a JSON string with custom styles.

Is this something that can be added to openlayers module, or should it live in contrib on it's own?

svdhout’s picture

Attached screenshots showing the behavior settings
 All
If you choose settings mode 'Feature Type: all'
You can provide values for Visibility, Invert Lightness, Hue, Lightness, Saturation, Gamma
These settings will be used for all styling features.

Json String
If you use settings mode 'specific JSON string',
you can add a json string containing all the specific settings for feature types.
This JSON string needs to be valid json, if not the settings supplied for 'Feature Type: all' will be used to style the map.

the style map wizard does not return valid JSON.

e.g.

[
  {
    stylers: [
      { saturation: -90 },
      { lightness: 32 }
    ]
  }
]

Should use quotes:

[
  {
    "stylers": [
      { "saturation": -90 },
      { "lightness": 32 }
    ]
  }
]
philpro’s picture

FANTASTIC! Thank you so much for putting this together and sharing it with the community.

webcultist’s picture

That sounds great! I will try it in a few days.

acbramley’s picture

Status: Closed (works as designed) » Reviewed & tested by the community

This is absolutely awesome and so easy to use, I definitely think this should be commited to the openlayers module!

acbramley’s picture

@svdhout this could easily be converted to a patch to the openlayers module by using the existing ctools plugin system, I would do it myself but the js files confuse me a bit.

giorgosk’s picture

For the life of me I can't understand how to get a view display LOCATION content type nodes on a google map using this behaviour

thank you for any help on this

pol’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

I think in this case is to create a module for this behavior.

I'm gonna close this, feel free to reopen it.

acbramley’s picture

If anyone is ever looking for this functionality I have been using the module @svdhout provided extensively in a live site so I decided to promote it to a full project at http://drupal.org/project/openlayers_stylemaps

JoergPf’s picture

Wow, great!!! Thanks a lot! :-)

kmajzlik’s picture

Issue summary: View changes

please can anybody post example uri of that screenshot? clicking in openlayers + openlayers_stylemaps and cant find that setting.

kmajzlik’s picture

oh, finally.
/admin/structure/openlayers/maps/list/default/edit or /admin/structure/openlayers/maps/add
Vertical tabs click "Behaviors" -> find Google Stylemap Overlay.