rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
309 stars 99 forks source link

Did you have already Geolocation Support? #315

Closed martinx1941 closed 5 months ago

martinx1941 commented 5 months ago

function FindLocaiton() { geocoder = new google.maps.Geocoder(); InitializeMap();

    var address = document.getElementById("addressinput").value;
    geocoder.geocode({ 'address': address }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);
            var marker = new google.maps.Marker({
                map: map,
                position: results[0].geometry.location
            });

        }
        else {
            alert("Geocode was not successful for the following reason: " + status);
        }
    });

}
valentasm1 commented 5 months ago

Duplicate. No https://github.com/rungwiroon/BlazorGoogleMaps/issues/178

martinx1941 commented 5 months ago

Hi valentasm1, i did not mean the google api geolocation. i mean read out the current location direct from the browser

var x = document.getElementById("demo");

function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } }

function showPosition(position) { x.innerHTML = "Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude; }

valentasm1 commented 5 months ago

It is not related to library at all. 30s google result https://stackoverflow.com/questions/69428693/blazor-user-device-geolocation