0
Q
风格谷歌地图
A
回答
0
请按照此代码。
在这里你需要在下面的链接添加你的谷歌API密钥。
src="https://maps.googleapis.com/maps/api/jskey=Your_api_key&callback=initMap"
这是代码。
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: new google.maps.LatLng(38.769671, -9.097975),
mapTypeId: 'roadmap',
styles : [
{
"elementType": "geometry",
"stylers": [
{
"color": "#f5f5f5"
}
]
},
{
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#f5f5f5"
}
]
},
{
"featureType": "administrative.land_parcel",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#bdbdbd"
}
]
},
{
"featureType": "poi",
"elementType": "geometry",
"stylers": [
{
"color": "#eeeeee"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [
{
"color": "#e5e5e5"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "road",
"elementType": "geometry",
"stylers": [
{
"color": "#ffffff"
}
]
},
{
"featureType": "road.arterial",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#dadada"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"featureType": "road.local",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [
{
"color": "#e5e5e5"
}
]
},
{
"featureType": "transit.station",
"elementType": "geometry",
"stylers": [
{
"color": "#eeeeee"
}
]
},
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{
"color": "#c9c9c9"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
}
]
});
var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';
var icons = {
info: {
icon: 'https://novo2.rhp.pt/map.png'
}
};
var features = [
{
position: new google.maps.LatLng(38.769671, -9.097975),
type: 'info'
}
];
// Create markers.
features.forEach(function(feature) {
var marker = new google.maps.Marker({
position: feature.position,
icon: icons[feature.type].icon,
map: map,
content:'<div>Test</div>'
});
});
}
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
<div id="map"></div>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>
如果你想改变还是那么地图样式请点击此链接https://mapstyle.withgoogle.com/,创造任何你想要的,只是复制整个JSON代码及以上styles
对象替换英寸
希望这会有所帮助。
+0
谢谢。有效! – lordpicard
相关问题
- 1. Subgurim谷歌地图风格的地图
- 2. 风格使用谷歌地图API
- 3. 聚合物风格谷歌地图
- 4. 谷歌地图api风格的地图与卫星水
- 5. 谷歌地图API风格的地图 - 颜色问题
- 6. 谷歌地图API - 将融合表层到风格图层
- 7. 在谷歌地图上显示风向
- 8. Java谷歌地图谷歌地图
- 9. 添加谷歌地图infoBubble内的手风琴(从谷歌地图工具库)
- 10. 谷歌风格向导
- 11. 谷歌Python风格指南
- 12. 如何实现谷歌地图yelp.com风格?
- 13. 谷歌地图砖 - 街道和标签覆盖着风格?
- 14. ie7和ie6似乎没有风格在谷歌地图api v3
- 15. jquery-ui-map(谷歌地图jquery插件)风格infowindow
- 16. 谷歌地图层onclick更改风格多边形
- 17. 如何嵌入风格的谷歌地图在您的网站
- 18. Yelp风格的谷歌地图,沿用户上下页面
- 19. 如何使用openInfoWindowTabsHtml为谷歌地图泡泡赋予风格?
- 20. 谷歌地图API的信息窗口风格误差
- 21. 自定义风格到谷歌地图V3覆盖
- 22. 如何修改谷歌地图导航器的控制风格
- 23. 谷歌地图的地址格式
- 24. 谷歌地图V3:风格化的地图突然失去了他们的风格?
- 25. 谷歌地图谷歌地点类型
- 26. 谷歌地图
- 27. 谷歌地图
- 28. 谷歌地图
- 29. 谷歌地图,如地图
- 30. 同步谷歌电子表格和谷歌(我)地图
你想在RHP图像中添加银色风格的地方? –
嗨。感谢您的回复。我想在地图本身添加样式 - 我已经添加了成本管脚,因为你看到它。我只需要添加银色风格。 – lordpicard
此链接将对您有用https://developers.google.com/maps/documentation/android-api/styling和https://mapstyle.withgoogle.com/。 –