# How do I focus the map on given coordinates?

**URL:** https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331
**Category:** Maps
**Tags:** beginner
**Created:** [May 15, 2022, 8:02pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331 "2022-05-15T20:02:02Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 15, 2022, 8:02pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/1 "2022-05-15T20:02:02Z")

</div>

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

 ![screen](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/d/bddac08c639d1b77c5a2c1ac457769634db97aeb.png)

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 🤔

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 15, 2022, 8:20pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/2 "2022-05-15T20:20:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 15, 2022, 8:22pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/3 "2022-05-15T20:22:08Z")

</div>

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 🤭

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 15, 2022, 8:29pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/4 "2022-05-15T20:29:29Z")

</div>

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

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/b/5bcbe8cd0cf73822c8a967dfea7d75b11edf12bc.png)

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 15, 2022, 8:33pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/5 "2022-05-15T20:33:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 15, 2022, 8:33pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/6 "2022-05-15T20:33:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 15, 2022, 8:47pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/7 "2022-05-15T20:47:43Z")

</div>

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 ? 🤔

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 16, 2022, 12:38am UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/8 "2022-05-16T00:38:27Z")

</div>

**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](https://x.thunkable.com/copy/15f8f2cb572bff43e97cd99021ba63e5)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/e/5e9433c817ba3d261fb7c5a5f2fd77e4bf7d447f.png)

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 16, 2022, 5:36am UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/9 "2022-05-16T05:36:20Z")

</div>

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 😊  
May I kindly ask you @jared to take a look into this issue ?  
Thank you.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 16, 2022, 1:34pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/10 "2022-05-16T13:34:57Z")

</div>

@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.

 ![Screenshot_2022-05-16-16-31-51-03_2bbfbfee96a5dfce998f962ebb8b5da3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/d/6d9a5a1cd0541600c955b77ee9e8373239979c2b.jpeg)

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

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 16, 2022, 2:50pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/11 "2022-05-16T14:50:44Z")

</div>

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

> [@muneer](#):
>
> This is where I am now although I don’t look like a baby chicken.

Reminds me of a certain [cat video](https://www.youtube.com/watch?v=s-frHneo95k).

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 16, 2022, 2:55pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/12 "2022-05-16T14:55:38Z")

</div>

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

[https://x.thunkable.com/copy/176df0687d0111aaa95fe27e2094f46d](https://x.thunkable.com/copy/176df0687d0111aaa95fe27e2094f46d)

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 16, 2022, 3:21pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/13 "2022-05-16T15:21:26Z")

</div>

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 😊

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 16, 2022, 4:14pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/14 "2022-05-16T16:14:34Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 16, 2022, 4:29pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/15 "2022-05-16T16:29:22Z")

</div>

> [@tatiang](#):
>
> Reminds me of a certain [cat video](https://www.youtube.com/watch?v=s-frHneo95k).

🤣 🤣 🤣

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 16, 2022, 6:20pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/16 "2022-05-16T18:20:20Z")

</div>

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 🤔)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 16, 2022, 7:35pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/17 "2022-05-16T19:35:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [May 16, 2022, 7:46pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/18 "2022-05-16T19:46:10Z")

</div>

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 😊 so no rush in “fixing” this.  
**P.S.** My users will start from my house now 🤣 haha (as I put my coordinates as default on map)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [August 14, 2022, 7:46pm UTC](https://community.thunkable.com/t/how-do-i-focus-the-map-on-given-coordinates/1877331/19 "2022-08-14T19:46:50Z")

</div>

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