Google maps 谷歌地图公园边界
可以在谷歌地图上显示公园边界吗?我已经能够使用以下样式将公园设置为紫色:Google maps 谷歌地图公园边界,google-maps,Google Maps,可以在谷歌地图上显示公园边界吗?我已经能够使用以下样式将公园设置为紫色: { featureType: 'poi.park', elementType: 'geometry.fill', stylers: [{color: '#aa44aa'}] } 并尝试了以下方法来启用边界,但没有成功 { featureType: 'poi.park', elementType: 'geometry.stroke', stylers: [{color: '
{
featureType: 'poi.park',
elementType: 'geometry.fill',
stylers: [{color: '#aa44aa'}]
}
并尝试了以下方法来启用边界,但没有成功
{
featureType: 'poi.park',
elementType: 'geometry.stroke',
stylers: [{color: '#000000'}]
}
全速前进
谷歌地图的样式参考是
完整代码:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Parks</title>
<style>
/* 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;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
// This example creates circles on the map, representing populations in North
// America.
function initMap() {
// Create the map.
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: {lat: 37.180240, lng: -121.434949},
styles: [
{
featureType: 'poi.park',
elementType: 'geometry.fill',
stylers: [{color: '#aa44aa'}]
}/*,
{
featureType: 'poi.park',
elementType: 'geometry.stroke',
stylers: [{color: '#000000'}]
},*/
]
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap">
</script>
</body>
</html>
公园
/*始终明确设置贴图高度以定义div的大小
*包含映射的元素*/
#地图{
身高:100%;
}
/*可选:使示例页面填充窗口*/
html,正文{
身高:100%;
保证金:0;
填充:0;
}
//本例在地图上创建圆圈,表示北方的人口
//美国。
函数initMap(){
//创建地图。
var map=new google.maps.map(document.getElementById('map'){
缩放:11,
中心:{lat:37.180240,lng:-121.434949},
风格:[
{
功能类型:“poi.park”,
elementType:'geometry.fill',
样式器:[{color:'#aa44aa'}]
}/*,
{
功能类型:“poi.park”,
elementType:'geometry.stroke',
样式器:[{color:'#000000'}]
},*/
]
});
}
目前,API不公开特性边界。Google issue tracker中有一个非常老的功能请求,但是,看起来Google并没有对这个任务设置高优先级
您可以在功能请求中随意添加星星,以添加您的投票并订阅通知