mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

How to center camera on user location?

Open AnEpicName opened this issue 2 years ago • 11 comments

I'm trying to get my location from the map to avoid using external libraries like geolocator, but I can't find any option nor listener for the user location.

At the start of my view I want to center the camera at the current user location. Is there any way to do that in the current version of the plugin?

AnEpicName avatar Jan 11 '23 15:01 AnEpicName

Have a look at this example: https://gist.github.com/hkben/844d46a829f667e91fa6e6078e8b019c Maybe it is helpful

kamami avatar Jan 11 '23 15:01 kamami

Thanks! This is exactly what I was looking for!

AnEpicName avatar Jan 11 '23 23:01 AnEpicName

I'd argue that there is a case for this being directly supported by this library since both the Android SDK and the iOS SDK support following the puck out of the box: Android Docs | iOS Docs

mvarendorff avatar Jan 12 '23 11:01 mvarendorff

But viewport is not supported by the Flutter SDK yet.

kamami avatar Jan 12 '23 11:01 kamami

@kamami Yeah, that's what I mean; I think this issue should remain open until this is supported in the Flutter SDK.

mvarendorff avatar Jan 12 '23 11:01 mvarendorff

@kamami you refer to this package support for viewport or flutter framework itself?

This would be a good improvement as when using the timer approach to center the location we notice the map "jumping" every second instead of the smooth navigation when using mapbox in a native app.

serraojoao avatar Feb 20 '23 17:02 serraojoao

@geisterfurz007 @kamami @serraojoao reopening to track when viewport will be implemented. There're no estimations when it'll become available yet, I'll keep you all updated.

yunikkk avatar Feb 22 '23 17:02 yunikkk

@yunikkk I understand you can't give an estimate. But is there a ballpark figure you can say like if it takes some months, more than half a year, a year? This would really help for my project planning.

basvdijk avatar Apr 18 '24 17:04 basvdijk

@yunikkk I understand you can't give an estimate. But is there a ballpark figure you can say like if it takes some months, more than half a year, a year? This would really help for my project planning.

@evil159 or @baleboy - do you folks know if the viewport API is planned anytime soon?

yunikkk avatar Apr 22 '24 10:04 yunikkk

Unfortunately there is no committed timeline at the moment.

baleboy avatar Apr 22 '24 16:04 baleboy

@baleboy thanks for your update. Is there perhaps a public roadmap of this package?

basvdijk avatar Apr 22 '24 18:04 basvdijk