question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google Map Bounds Coordinates

See original GitHub issue

The google map api we can get the bounds via these methods:

const bounds = map.getBounds();
const ne = bounds.getNorthEast();
const sw = bounds.getSouthWest();

Does this library support anything like this?

Update: I’m trying to use jsinterop to call these methods:

private async Task OnMapBoundsChanged()
{
        var _mapsJs = await _js.InvokeAsync<IJSObjectReference>("import", "./_content/Majorsoft.Blazor.Components.Maps/googleMaps.min.js");
        await _mapsJs.InvokeVoidAsync("getBounds", _map.MapId);
}

But its not working, (I’m new to js interop), its throwing:

Error: Microsoft.JSInterop.JSException: Could not find 'getBounds' ('getBounds' was undefined).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Grizzllycommented, Dec 12, 2021

Regarding this, the API also offers restrictions on the map bounds, so you can limit the map to a certain country for example. This is documented here.

I think this is might be quite easy to implement as it only requires changes in the window.initGoogleMaps function, specifically the map initializer.

It would be nice if the InnerElementReference would actually contain the map object so we can work with it…

0reactions
majorimicommented, Dec 20, 2021

Sure no problem once you confirm it is ok I will add it to the next Nuget package release. Since it Christmas etc. the release will be done next year…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coordinates | Maps JavaScript API
A LatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian. Access by calling ...
Read more >
Can I view a Google Maps map by bounding latitude and ...
With Google Maps I can enter a single lat/lng coordinate and the map is drawn with that lat/lng in the center.
Read more >
Maximum Lat and Long bounds for the world - Google ...
But if you just want an answer for the maximum bounds for Google Maps: Latitude: -85 to +85 (actually -85.05115 for some reason)....
Read more >
Google Maps JavaScript API V3 Reference
Google Maps JavaScript API V3 Reference ... This is an index of all the classes, methods, and interfaces in the Maps JavaScript API...
Read more >
getBounds() in Google Maps API v3 - AIO Collective
So to get our latitude and longitude we need to move getBounds(), to some event listener. Description of bounds_changed in documentation is: “ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found