lolochristen / OpenLayers.Blazor

An Map component for Blazor based on OpenLayers with support for swisstopo swiss maps.
MIT License
42 stars 15 forks source link

SetVisibleExtent not working #58

Closed GuerraAlan closed 5 months ago

GuerraAlan commented 5 months ago

I am trying to after doing an address search and adding a couple markers on the map i need to center and zoom the map to show every marker, i tried using a new extent with SetVisibleExtent and changing the current extent, both without success, based on my searches the use of extents to do this has been deprecated by openLayers and the new recomended way of doing it is with a Fit https://stackoverflow.com/questions/23682286/zoomtoextent-openlayers-3 i could not however find a way of doing so using the OpenLayers.Blazor.

GuerraAlan commented 5 months ago

I am able to change the center easily and also able to change the zoom, but cant calculate the required zoom to show every marker since the map size changes according to the display resolution

lolochristen commented 5 months ago

Actually, map.getView().fit() is internally used when calling SetVisibleExtent and SetZoomToExtend. But it didn't take different projections of the view into account. It's fixed with #59.

GuerraAlan commented 5 months ago

Thank you, the push has received a 403 from the nuget repo, as soon as its updated ill get it, will help a lot.