Closed deezaster closed 2 years ago
I'm not sure to understand your needs.
Do you want to get the exact tap position on screen ?
No, the tap position on screen i get it from the callback:
onTap: (polylines, tapPosition)
What i need are the points of the map: latitude and langitude.
Understood.
It's not possible currently but adding this don't seems to be too hard.
I'll try to hack something when I find some spare time if no one dit it before.
@deezaster I have a PR adding a MapController.pointToLatLng()
method on flutter_map which has some issues but works until you rotate the map (it then become less accurate, I'm still trying to figure why)...
https://github.com/fleaflet/flutter_map/pull/1115
You can use our branch until it got merged, or even better, fork it on your own repo so you don't rely on something we could change later.
You could do something like:
onTap: (polylines, tapPosition) {
final latLng = MapController.pointToLatLng(CustomPoint(tapPosition.localPosition.dx, tapPosition.localPosition.dy));
print(latLng);
}
@HugoHeneault As the polyline detection is made, we should be able to find wich offset of the polyline is the nearest from the tap.
It's not as accurate as your PR but it's doable.
If OP needs the exact tap position in term of lat/long it's not an issue for this repo
@deezaster If it's fine on your side, you can close this issue. If you need more help, we're here.
Thanks!
I need the points (coordinates), not only the position or the tag. Is this possible?
By the way, a very cool package!