-
-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latlng to screen position #334
Comments
You can use
This should give you the center x,y for your screen so something like x:250, y:450 according to the device of course. |
Yes I'm gonna try it asap (but not before sunday because I don't have access to an IDE before). |
The proposed solution didn't work for me. It gives completely different values depending on the zoom level, and they do not seem to be related at all to the screen. |
@c-mendoza It should give different values depending on the zoom level. Think of a Marker on the map before and after a zoom. Its place changes(unless it is in the center of the map) It's The solution I proposed works for me. |
@aytunch thanks for the quick reply. I'm getting wildly different values depending on zoom level, and the values don't seem to correlate at all to screen coordinates:
When I zoom increases, the Any idea what could cause this? |
@c-mendoza @Skyost If you want to find the absolute x,y screen coordinates, you can get the CustomPoint of the LatLng with the function I provided and then subtract it from the topleft(northwest) of the visible map. So top left of the map screen point will be (0,0) and bottom right will be (mapwidth, mapheight)
|
thanks for the detailed answer @aytunch |
Hi,
I have a moving marker that tracks the user position. I want to be able to save the user path, a bit like this :
To do this, I need to know how to convert a given position
LatLng
to a screen position(x, y)
(where x and y are pixels), this will allow me to draw a circle at the given position.I've already seen #231 but it doesn't seem to fit my needs.
Thanks !
The text was updated successfully, but these errors were encountered: