You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm planning to implement a "Search this area" functionality. Here's how it will work: as the user scrolls the map and the center point changes, the system will compare the initial center point with the current point to determine if the distance exceeds a certain threshold. If it does, the option to 'Search this place' will be displayed.
However, in this scenario, I'm facing difficulty finding the initial map view's center latitude and longitude. I'm currently using ".overview" to display all the markers.
Expected behavior
After loading the map, I'm able to obtain the center point for the map view.
I'm using the "viewport" method to show the markers on the map view. Because of this, I cannot get the center location of the map since this method does not set any center. Is there an alternate way to get the initial center location or if we .overview where the center will be set and how to access it?
If the map moves, I can get the new center location by using "onCameraChanged(action:)". In the way, if I get the initial map location, I can find the distance and call the API.
Additional links and references
The text was updated successfully, but these errors were encountered:
Environment
Observed behavior and steps to reproduce
I'm planning to implement a "Search this area" functionality. Here's how it will work: as the user scrolls the map and the center point changes, the system will compare the initial center point with the current point to determine if the distance exceeds a certain threshold. If it does, the option to 'Search this place' will be displayed.
However, in this scenario, I'm facing difficulty finding the initial map view's center latitude and longitude. I'm currently using ".overview" to display all the markers.
Expected behavior
After loading the map, I'm able to obtain the center point for the map view.
Notes / preliminary analysis
withViewportAnimation(.fly(duration: 2)) { viewport = .overview(geometry: multiPoints, geometryPadding: EdgeInsets(top: 50, leading: 20, bottom: screenHeight * 0.4, trailing: 20), maxZoom: zoom, offset: .zero) }
I'm using the "
viewport
" method to show the markers on the map view. Because of this, I cannot get the center location of the map since this method does not set any center. Is there an alternate way to get the initial center location or if we.overview
where the center will be set and how to access it?If the map moves, I can get the new center location by using "onCameraChanged(action:)". In the way, if I get the initial map location, I can find the distance and call the API.
Additional links and references
The text was updated successfully, but these errors were encountered: