Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 285
George Harrison Avatar asked Aug 08 '26 05:08

George Harrison


1 Answers

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

like image 148
Learning Avatar answered Aug 10 '26 20:08

Learning



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!