Google Map Style seems not working

Hi
I tried to use Map Style for FNCGoogleMap for a Web Core App
If I defined

Options.MapStyle := MAPSTYLENIGHT;

as it's defined in VCL.TMSFNCGoogleMaps, but when maps is paint the zone is empty (OK with none style defined)
I tried to create a style "SILVER" with same result (create using Google Map Style Creator)

    MAPSTYLESILVER = '[' + LB +
    '{' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#f5f5f5"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "elementType": "labels.icon",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "visibility": "off"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#616161"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "elementType": "labels.text.stroke",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#f5f5f5"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "administrative.land_parcel",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#bdbdbd"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "poi",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#eeeeee"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "poi",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#757575"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "poi.park",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#e5e5e5"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "poi.park",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#9e9e9e"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "road",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#ffffff"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "road.arterial",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#757575"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "road.highway",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#dadada"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "road.highway",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#616161"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "road.local",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#9e9e9e"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "transit.line",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#e5e5e5"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "transit.station",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#eeeeee"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "water",' + LB +
    '  "elementType": "geometry",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#c9c9c9"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '},' + LB +
    '{' + LB +
    '  "featureType": "water",' + LB +
    '  "elementType": "labels.text.fill",' + LB +
    '  "stylers": [' + LB +
    '    {' + LB +
    '      "color": "#9e9e9e"' + LB +
    '    }' + LB +
    '  ]' + LB +
    '}' + LB +
    ']';

Please move the code to the OnMapInitialized event:

procedure TForm1.TMSFNCGoogleMaps1MapInitialized(Sender: TObject);
begin
  TMSFNCGoogleMaps1.Options.MapStyle := MAPSTYLENIGHT;
end;

That's works
And my MAPSTYLESILVER style works fine too.

Thanks

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.