Ad

Blazor: Google Maps JS API

Morning,

So currently in my project i am using an embeded google maps API with JS in my blazor project. The map is on the page and fucntional. I used tips from this following article on stack overflow (Launch Google Maps On Blazor)

Using the following JS in my _Hosts file I need to remove certain features of the map in JS

    <script>
        function initialize() {
            var latlng = new google.maps.LatLng(40.716948, -74.003563);
            var options = {
                zoom: 14, center: latlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById
                ("map"), options);
        }
    </script>

Any pointers on where i can find the code to turn features off?

I need to remove these features that open full screen or a new tab

I need to remove these features that open full screen or a new tab **image**

enter image description here

Ad

Answer

Have you tried disabling 'disableDefaultUI: true'

function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: {lat: -33, lng: 151},
    disableDefaultUI: true
  });
}

Check documentation https://developers.google.com/maps/documentation/javascript/controls

Ad
source: stackoverflow.com
Ad