我正在使用谷歌地图,如果可能的话,我想隐藏我的地图上的餐厅和酒店。所以我的问题是如何消除或应用过滤器来隐藏谷歌地图 api 中的餐厅和酒店点。
感谢你所做的一切。编辑。
<script>
function writeAddressName(latLng) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
"location": latLng
},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
document.getElementById("address").innerHTML = results[0].formatted_address;
else
document.getElementById("error").innerHTML += "Unable to retrieve your address" + "<br />";
});
}
function geolocationSuccess(position) {
var userLatLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
writeAddressName(userLatLng);
$(document).ready(function(){
var styles = [
{
stylers: [
{ hue: "#00ffe6" },
{ saturation: -20 }
]
},{
featureType: "road",
elementType: "geometry",
stylers: [
{ lightness: 100 },
{ visibility: "simplified" }
]
},{
featureType: "road",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
var styledMap = new google.maps.StyledMapType(styles, {name: "Styled Map"});
// display map
var mapOptions = {
zoom: 11,
center: userLatLng ,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP,'map_style']
}
};
var map = new google.maps.Map(document.getElementById('map'), mapOptions);
map.mapTypes.set('map_style', styledMap);
map.setMapTypeId('map_style', styledMap);
});
// marker
new google.maps.Marker({
map: map_style,
position: userLatLng
});