How do I focus the map on given coordinates?

Hello Thunkers !
I start to work with map component, and I don’t know what I’m doing wrong here:

It’s a simple task, calling current device coordinates then putting an icon on the map for these coordinates.
But I wanted the map to move and focus on those coordinates… and I don’t manage to do it… I thought that setting map latitude/longitude is doing that. But map stays on default values and need to manually move and zoom to coordinates to find my marker :thinking:

1 Like

Are you testing this in Thunkable Live? Have you granted permission for the location sensor during first run of the app?

Yes, and yes … Location sensor is just fine, as it puts marker on correct coordinates retrieved … Only that I have to manually move and zoom the map to go to the marker.
I put marker and set map in Romania, where I am, and map starts around San Francisco :face_with_hand_over_mouth:

This works for me in Thunkable Live on an iPhone 11:

https://x.thunkable.com/copy/5e08e054975e0c1943542b538ffe1784
(See the first screen; it has your username)

2 Likes

Yes, your example works on My Android too…
It focus on my house…
But the code is the same as mine…
The only difference is that your example is in DnD and I try in StP… and mine doesn’t work

1 Like

The GetCurrentLocation should automatically focus the map to your current location.

1 Like

It should…
As both codes (mine and @tatiang ) are the same, and my StP reacts different than his DnD, maybe something is wrong in StP ? :thinking:

1 Like

Edit: my mistake! See below… the blocks do work when corrected.

When I use similar blocks in StP, it doesn’t Zoom. It just shows my location while displaying several continents. I can’t get it to do anything really. It doesn’t always update my location either.

https://x.thunkable.com/copy/15f8f2cb572bff43e97cd99021ba63e5

2 Likes

So, it’s a StP issue …
Just my luck. When I start learning something new, I encounter a bug, letting me confused thinking that I don’t use blocks right :blush:
May I kindly ask you @jared to take a look into this issue ?
Thank you.

1 Like

@tatiang
I removed the zoom option and corrected a small mistake that you’ve overseen which is having latitude instead of longitude and the map responded perfectly.

This is where I am now although I don’t look like a baby chicken.

1 Like

You’re right! I made a mistake… thanks for catching that.

Reminds me of a certain cat video.

2 Likes

@mimostel Can you try this StP project? The first screen works for me on an iPhone 11:

https://x.thunkable.com/copy/176df0687d0111aaa95fe27e2094f46d

2 Likes

Yes, yours works, mine still doesn’t. Checked again the blocks and are the same. Really weird.
I’ll try again with new map later, when I’ll be on computer. My map has everything default before blocks. Did you changed anything on it ? Or maybe because my map fills the container and yours has absolute values as height/width. I’ll try all option and I’ll see. I’ll let you know.
Thank you and @muneer for wasting time for me :blush:

1 Like

I just added the map component. I didn’t change any settings.

Maybe try removing your map component and re-adding it?

2 Likes

:rofl: :rofl: :rofl:

1 Like

Done it…
It seems that set visibility for row that contain map to false/true was interferring with moving/zooming map.
Bottom line: map needs to be visible when focusing/zooming. (cannot be hidden and displayed only after operations are done, with a nice waiting icon displayed instead :thinking:)

2 Likes

This should be fixed because you don’t want the user to have to see the default location before it finds their location and zooms in.

1 Like

That was my point when I have hidden the map and revealed it only after the calculations were done… but… can’t be done atm… well, there’s other things to be done more important now than my esthetic taste :blush: so no rush in “fixing” this.
P.S. My users will start from my house now :rofl: haha (as I put my coordinates as default on map)

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.