0

我有一张用 google maps api v3 制作的地图,它有我想要的风格。但我不知道如何将它(如果可能的话)实现到 OpenLayers 中。我将添加我希望添加到下面打开层的代码。我看到了 ol3gmp 并希望这是答案,但我不知道它是不是。

        	styles:[
  			{"elementType": "geometry","stylers": [{"color": "#242f3e"}]},
			{"elementType": "labels","stylers": [{"visibility": "off"}]},
			{"elementType": "labels.text.fill","stylers": [{"color": "#746855"}]},
  			{"elementType": "labels.text.stroke","stylers": [{"color": "#242f3e"}]},
  			{"featureType": "administrative.land_parcel",
				"stylers": [{"visibility": "off"}]},
 			{"featureType": "administrative.locality","elementType": "labels",
				"stylers": [{"visibility": "on"}]},
			{"featureType": "administrative.locality",
				"elementType": "labels.text.fill",
				"stylers": [{"color": "#d59563"}]},
  			{"featureType": "administrative.neighborhood",
				"stylers": [{"visibility": "off"}]},
			{"featureType": "poi","stylers": [{"visibility": "off"}]},
			{"featureType": "poi","elementType": "labels.text.fill",
				"stylers": [{"color": "#d59563"}]},
			{"featureType": "poi.park","elementType": "geometry",
				"stylers": [{"color": "#263c3f"}]},
			{"featureType": "poi.park","elementType": "labels.icon",
				"stylers": [{"visibility": "simplified"}]},
			{"featureType": "poi.park","elementType": "labels.icon",
				"stylers": [{"visibility": "simplified"}]},
			{"featureType": "poi.park","elementType": "labels.text",
				"stylers": [{"visibility": "simplified"}]},
			{"featureType": "poi.park","elementType": "labels.text.fill",
				"stylers": [{"visibility": "simplified"}]},
			{"featureType": "poi.park","elementType": "labels.text.stroke",
				"stylers": [{"visibility": "simplified"}]},
			{"featureType": "road","stylers": [{"visibility": "on"}]},
			{"featureType": "road","elementType": "geometry",
				"stylers": [{"color": "#38414e"}]},
			{"featureType": "road","elementType": "geometry.stroke",
				"stylers": [{"color": "#212a37"}]},
			{"featureType": "road","elementType": "labels.text.fill",
				"stylers": [{"color": "#9ca5b3"}]},
			{"featureType": "road.highway","elementType": "geometry",
				"stylers": [{"color": "#746855"}]},
			{"featureType": "road.highway","elementType": "geometry.stroke",
				"stylers": [{"color": "#1f2835"}]},
			{"featureType": "road.highway","elementType": "labels.text.fill",
				"stylers": [{"color": "#f3d19c"}]},
			{"featureType": "transit","stylers": [{"visibility": "off"}]},
			{"featureType": "transit.station.airport",
				"stylers": [{"visibility": "on"}]},
			{"featureType": "water","elementType": "geometry",
				"stylers": [{"color": "#17263c"}]},
			{"featureType": "water","elementType": "labels.text.fill",
				"stylers": [{"color": "#515c6d"}]},
			{"featureType": "water","elementType": "labels.text.stroke",
				"stylers": [{"color": "#17263c"}]}
			]
		});

4

1 回答 1

0

您可以为 olgm 图层提供样式定义,它将将其传输到在 Google Maps 中创建的地图。这是一个片段:

var themedLayer = new olgm.layer.Google({
  styles: [{
    "stylers": [{
      "saturation": -100
    },{
       "gamma": 2.25
    }]
  }]
});

另请参阅显示此内容的实时示例(及其JavaScript源文件)。

于 2016-12-20T13:17:19.173 回答