0

I am trying to display Google satellite map in Openlayers. So, I added Google Satellite Hybrid map. My problem is, I need to display labels(like POI, place name etc) but don't need any roads & its lables.

So, I just tried this link & I am able to get exact output like below image. In this link they are using Google Map API. So, its working fine.. But I am using Openlayers.

enter image description here

For Street map, I did using below code and working fine..

var map;
var stylez = [{
        "featureType" : "road",
        "stylers" : [{
                "visibility" : "off"
            }
        ]
    }
];

var gmap = new OpenLayers.Layer.Google("Google Streets", {
        type : 'styled'
    });

var styledMapOptions = {
    name : "Styled Map"
};

var styledMapType = new google.maps.StyledMapType(stylez, styledMapOptions);

function init() {
    map = new OpenLayers.Map('map');
    map.addLayers([gmap]);

    map.setCenter(new OpenLayers.LonLat(51.523913, 25.256328).transform(
            new OpenLayers.Projection("EPSG:4326"),
            map.getProjectionObject()), 14);

    gmap.mapObject.mapTypes.set('styled', styledMapType); //Here setting the cusom style
    gmap.mapObject.setMapTypeId('styled');

}
2

I got the solution. If you want, just do the following...

 //Styles to switch off the roads
    var stylez = [{
            "featureType" : "road",
            "stylers" : [{
                    "visibility" : "off"
                }
            ]
        }
    ];

    //Satellite
    var ghyb = new OpenLayers.Layer.Google(
            "Google Hybrid", {
            type : google.maps.MapTypeId.HYBRID,
            numZoomLevels : 22,
            visibility : false
        });
    //End

    map.addLayers([ghyb]);

    ghyb.mapObject.setOptions({
        styles : stylez
    });
0

IMO the wms service used by OL cannot be changed in this detail. It will be more likely that you need to create your own basemap using TileMill or something else. But I am not an expert in OL / Gmaps

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.