Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌地图API嵌入代码_Javascript_Html_Maps - Fatal编程技术网

Javascript 谷歌地图API嵌入代码

Javascript 谷歌地图API嵌入代码,javascript,html,maps,Javascript,Html,Maps,一直在努力让我的谷歌地图嵌入正确的风格。 我有一个密钥,只是用我想要的样式复制了代码。遵循每一个教程,但似乎不能得到它的权利。 你们谁能告诉我怎么了? 多谢各位 <div id="map"></div> <script> function initMap() { var uluru = {lat: 50.0715845, lng: 14.3000891}; var map = new google.maps.Map(document.get

一直在努力让我的谷歌地图嵌入正确的风格。 我有一个密钥,只是用我想要的样式复制了代码。遵循每一个教程,但似乎不能得到它的权利。 你们谁能告诉我怎么了? 多谢各位

<div id="map"></div>
<script>
  function initMap() {
    var uluru = {lat: 50.0715845, lng: 14.3000891};
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 10,
      styles: [

{
    "featureType": "water",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#165c64"
        },
        {
            "saturation": 34
        },
        {
            "lightness": -69
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "landscape",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#b7caaa"
        },
        {
            "saturation": -14
        },
        {
            "lightness": -18
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "landscape.man_made",
    "elementType": "all",
    "stylers": [
        {
            "hue": "#cbdac1"
        },
        {
            "saturation": -6
        },
        {
            "lightness": -9
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "road",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#8d9b83"
        },
        {
            "saturation": -89
        },
        {
            "lightness": -12
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "road.highway",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#d4dad0"
        },
        {
            "saturation": -88
        },
        {
            "lightness": 54
        },
        {
            "visibility": "simplified"
        }
    ]
},
{
    "featureType": "road.arterial",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#bdc5b6"
        },
        {
            "saturation": -89
        },
        {
            "lightness": -3
        },
        {
            "visibility": "simplified"
        }
    ]
},
{
    "featureType": "road.local",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#bdc5b6"
        },
        {
            "saturation": -89
        },
        {
            "lightness": -26
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "poi",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#c17118"
        },
        {
            "saturation": 61
        },
        {
            "lightness": -45
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "poi.park",
    "elementType": "all",
    "stylers": [
        {
            "hue": "#8ba975"
        },
        {
            "saturation": -46
        },
        {
            "lightness": -28
        },
        {
            "visibility": "on"
        }
    ]
},
{
    "featureType": "transit",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#a43218"
        },
        {
            "saturation": 74
        },
        {
            "lightness": -51
        },
        {
            "visibility": "simplified"
        }
    ]
},
{
    "featureType": "administrative.province",
    "elementType": "all",
    "stylers": [
        {
            "hue": "#ffffff"
        },
        {
            "saturation": 0
        },
        {
            "lightness": 100
        },
        {
            "visibility": "simplified"
        }
    ]
},
{
    "featureType": "administrative.neighborhood",
    "elementType": "all",
    "stylers": [
        {
            "hue": "#ffffff"
        },
        {
            "saturation": 0
        },
        {
            "lightness": 100
        },
        {
            "visibility": "off"
        }
    ]
},
{
    "featureType": "administrative.locality",
    "elementType": "labels",
    "stylers": [
        {
            "hue": "#ffffff"
        },
        {
            "saturation": 0
        },
        {
            "lightness": 100
        },
        {
            "visibility": "off"
        }
    ]
},
{
    "featureType": "administrative.land_parcel",
    "elementType": "all",
    "stylers": [
        {
            "hue": "#ffffff"
        },
        {
            "saturation": 0
        },
        {
            "lightness": 100
        },
        {
            "visibility": "off"
        }
    ]
},
{
    "featureType": "administrative",
    "elementType": "all",
    "stylers": [
        {
            "hue": "#3a3935"
        },
        {
            "saturation": 5
        },
        {
            "lightness": -57
        },
        {
            "visibility": "off"
        }
    ]
},
{
    "featureType": "poi.medical",
    "elementType": "geometry",
    "stylers": [
        {
            "hue": "#cba923"
        },
        {
            "saturation": 50
        },
        {
            "lightness": -46
        },
        {
            "visibility": "on"
        }
    ]
}

函数initMap(){
var uluru={lat:50.0715845,lng:14.3000891};
var map=new google.maps.map(document.getElementById('map'){
缩放:10,
风格:[
{
“功能类型”:“水”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“165c64”
},
{
“饱和”:34
},
{
“轻盈”:-69
},
{
“可见性”:“打开”
}
]
},
{
“特色类型”:“景观”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“b7caaa”
},
{
“饱和”:-14
},
{
“轻盈”:-18
},
{
“可见性”:“打开”
}
]
},
{
“特色类型”:“景观。人造”,
“elementType”:“全部”,
“造型师”:[
{
“色调”:“cbdac1”
},
{
“饱和”:-6
},
{
“轻盈”:-9
},
{
“可见性”:“打开”
}
]
},
{
“功能类型”:“道路”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“8d9b83”
},
{
“饱和”:-89
},
{
“亮度”:-12
},
{
“可见性”:“打开”
}
]
},
{
“功能类型”:“道路.公路”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“d4dad0”
},
{
“饱和”:-88
},
{
“轻盈”:54
},
{
“可见性”:“简化”
}
]
},
{
“功能类型”:“道路干线”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“bdc5b6”
},
{
“饱和”:-89
},
{
“轻盈”:-3
},
{
“可见性”:“简化”
}
]
},
{
“功能类型”:“road.local”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“bdc5b6”
},
{
“饱和”:-89
},
{
“轻盈”:-26
},
{
“可见性”:“打开”
}
]
},
{
“featureType”:“poi”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“c17118”
},
{
“饱和”:61
},
{
“亮度”:-45
},
{
“可见性”:“打开”
}
]
},
{
“功能类型”:“poi.park”,
“elementType”:“全部”,
“造型师”:[
{
“色调”:“8ba975”
},
{
“饱和”:-46
},
{
“轻盈”:-28
},
{
“可见性”:“打开”
}
]
},
{
“featureType”:“transit”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“a43218”
},
{
“饱和”:74
},
{
“轻盈”:-51
},
{
“可见性”:“简化”
}
]
},
{
“特征类型”:“行政省”,
“elementType”:“全部”,
“造型师”:[
{
“色调”:“#ffffff”
},
{
“饱和”:0
},
{
“亮度”:100
},
{
“可见性”:“简化”
}
]
},
{
“featureType”:“administration.neighbour”,
“elementType”:“全部”,
“造型师”:[
{
“色调”:“#ffffff”
},
{
“饱和”:0
},
{
“亮度”:100
},
{
“可见性”:“关闭”
}
]
},
{
“featureType”:“administration.locality”,
“elementType”:“标签”,
“造型师”:[
{
“色调”:“#ffffff”
},
{
“饱和”:0
},
{
“亮度”:100
},
{
“可见性”:“关闭”
}
]
},
{
“功能类型”:“行政用地”,
“elementType”:“全部”,
“造型师”:[
{
“色调”:“#ffffff”
},
{
“饱和”:0
},
{
“亮度”:100
},
{
“可见性”:“关闭”
}
]
},
{
“功能类型”:“管理”,
“elementType”:“全部”,
“造型师”:[
{
“色调”:“3a3935”
},
{
“饱和”:5
},
{
“轻盈”:-57
},
{
“可见性”:“关闭”
}
]
},
{
“特征类型”:“poi.medical”,
“elementType”:“几何体”,
“造型师”:[
{
“色调”:“cba923”
},
{
“饱和”:50
},
{
“轻盈”:-46
},
{
“可见性”:“打开”
}
]
}
]

});
var marker=new google.maps.marker({
职位:乌卢鲁,
地图:地图
});
}

Hi,你能解释一下你想要实现的目标和你看到的问题吗?嗨,你好!我试图通过JavaScript APi插入地图。当我插入标准样式时,效果很好,当我更改样式时,效果不好
    });
    var marker = new google.maps.Marker({
      position: uluru,
      map: map
    });
  }
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/staticmap?key=Mykeyisherealright&center=-33.9,151.14999999999998&zoom=12&format=png&maptype=roadmap&style=element:geometry%7Ccolor:0x1d2c4d&style=element:labels.text.fill%7Ccolor:0x8ec3b9&style=element:labels.text.stroke%7Ccolor:0x1a3646&style=feature:administrative.country%7Celement:geometry.stroke%7Ccolor:0x4b6878&style=feature:administrative.land_parcel%7Celement:labels%7Cvisibility:off&style=feature:administrative.land_parcel%7Celement:labels.text.fill%7Ccolor:0x64779e&style=feature:administrative.province%7Celement:geometry.stroke%7Ccolor:0x4b6878&style=feature:landscape.man_made%7Celement:geometry.stroke%7Ccolor:0x334e87&style=feature:landscape.natural%7Celement:geometry%7Ccolor:0x023e58&style=feature:poi%7Celement:geometry%7Ccolor:0x283d6a&style=feature:poi%7Celement:labels.text%7Cvisibility:off&style=feature:poi%7Celement:labels.text.fill%7Ccolor:0x6f9ba5&style=feature:poi%7Celement:labels.text.stroke%7Ccolor:0x1d2c4d&style=feature:poi.business%7Cvisibility:off&style=feature:poi.park%7Celement:geometry.fill%7Ccolor:0x023e58&style=feature:poi.park%7Celement:labels.text%7Cvisibility:off&style=feature:poi.park%7Celement:labels.text.fill%7Ccolor:0x3C7680&style=feature:road%7Celement:geometry%7Ccolor:0x304a7d&style=feature:road%7Celement:labels.text.fill%7Ccolor:0x98a5be&style=feature:road%7Celement:labels.text.stroke%7Ccolor:0x1d2c4d&style=feature:road.arterial%7Celement:labels%7Cvisibility:off&style=feature:road.highway%7Celement:geometry%7Ccolor:0x2c6675&style=feature:road.highway%7Celement:geometry.stroke%7Ccolor:0x255763&style=feature:road.highway%7Celement:labels%7Cvisibility:off&style=feature:road.highway%7Celement:labels.text.fill%7Ccolor:0xb0d5ce&style=feature:road.highway%7Celement:labels.text.stroke%7Ccolor:0x023e58&style=feature:road.local%7Cvisibility:off&style=feature:road.local%7Celement:labels%7Cvisibility:off&style=feature:transit%7Celement:labels.text.fill%7Ccolor:0x98a5be&style=feature:transit%7Celement:labels.text.stroke%7Ccolor:0x1d2c4d&style=feature:transit.line%7Celement:geometry.fill%7Ccolor:0x283d6a&style=feature:transit.station%7Celement:geometry%7Ccolor:0x3a4762&style=feature:water%7Celement:geometry%7Ccolor:0x0e1626&style=feature:water%7Celement:labels.text.fill%7Ccolor:0x4e6d70&size=480x360">
</script>
    </div>
    </div>
</div>