# [Solved] Geolocation Showing a lot of numbers.

Just started using Construct 2? Post your questions here

### » Tue Mar 31, 2015 11:08 am

Hello to you all.

I'm having an issue when using Geolocation: most of the times I get the position with 9 digits: 43.4759862, but sometimes I get a lot of numbers: 43.475898199999996.

Is there a way to make the result to appear always the same way, with 9 digits?
I've tried
Code: Select all
`round(((Geolocation.Latitude)*10000000)/10000000)`

But it rounds the number to 40 (Because it's not a "real" decimal number, I guess, I'm not very good with GPS formats).

Last edited by FERdeBOER on Tue Mar 31, 2015 11:29 am, edited 1 time in total.
B
7
S
1
G
3
Posts: 12
Reputation: 1,239

### » Tue Mar 31, 2015 11:18 am

..maybe?..or not?

left(str(Geolocation.Latitude),10)
B
67
S
24
G
7
Posts: 1,519
Reputation: 11,104

### » Tue Mar 31, 2015 11:29 am

korbaach wrote:..maybe?..or not?

left(str(Geolocation.Latitude),10)

Works perfectly, Thank you very much @korbaach !!

Edit: Just looked for the explanation and found in the manual:

left(text, count)
Return the first count characters of text.

Not clear at all if you don't know exactly what you're looking for.
B
7
S
1
G
3
Posts: 12
Reputation: 1,239

### » Tue Mar 31, 2015 12:38 pm

@FERdeBOER

left(text, count) ......count=10
Return the first 10 characters of text...

Geolocation.Latitude=43.475898199999996
4=1
3=2
.=3
4=4
7=5
5=6
...etc

...but .. 43.475898199999996 its a number... u need to use "str" to convert number 43.475898199999996
in text "43.475898199999996"

B
67
S
24
G
7
Posts: 1,519
Reputation: 11,104

### » Tue Mar 31, 2015 12:54 pm

Thank you for the clarification @korbaach.
Sorry if I wasn't clear, I understood it once you pointed me to it and then found it in the manual, but I'm pretty sure it will help others.

I'm starting to learn some coding while I'm not messing with construct 2 (or working) and I already "knew" (I was supposed to, but I forgot, as this post proves) the character's count and remembered it when I saw your line and the manual... But I don't think the manual alone would have been useful for me in this case if I wouldn't know something about the subject already.

Thank you again!!
B
7
S
1
G
3
Posts: 12
Reputation: 1,239