I use ol3-google-maps and when I switch layer from standard OSM to Google then styles are broken. I have defined styles but Google use self for example: points in OSM are yellow but when is google-map point shows like Google marker.

Google layers:

var GM = new olgm.layer.Google({
         mapTypeId: 'hybrid',
         title: 'Google',
         type: 'base'

var olGM = new olgm.OLGoogleMaps({map: map,mapIconOptions: {useCanvas: true }}); 


function pointStyleFunction(feature) {
return new ol.style.Style({
    fill: new ol.style.Fill({
    color: 'rgba(255, 255, 255, 0.2)'
    stroke: new ol.style.Stroke({
    color: '#ffcc33',
    width: 2
    image: new ol.style.Circle({
        radius: 7,
        fill: new ol.style.Fill({
        color: '#ffcc33'
    text: createTextStyle(feature)

Layers of features:

var layer_ambon = new ol.layer.Vector({
                source: new ol.source.Vector({ features: new ol.Collection((new ol.format.GeoJSON()).readFeatures(map_info['layers'][3])) })

Standard OL map:

map = new ol.Map({
        interactions: olgm.interaction.defaults(),
        target: olMapDiv,
        layers: [
        controls: ol.control.defaults().extend([
            new ol.control.ScaleLine()
        view: view
  • Would you please share some code? How do are the feature styled? Can you share a live example? By the way, be aware that if you use features that come from Google, then they must be shown on top of Google layers. Apr 26, 2017 at 12:42
  • I share some code. Apr 26, 2017 at 15:56

1 Answer 1


Style Functions in OpenLayers are not compatible with ol3-google-maps. See the LIMITATION.

As an alternative, you can either:

  1. manually set the style directly within each feature instead, which would avoid the use of the style function
  2. keep the style function and turn off the vectors watcher in ol3-google-maps. See the ol3gm Watch Options example to see how to turn it off.

Here's a snippet for (2):

var olGM = new olgm.OLGoogleMaps({
  map: map,
  watch: {
    'vector': false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.