Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by agentargyle · May 20, 2017 at 10:40 PM · locationgpslocationinfo

How can I get 5 decimal places of accuracy for latitude and longitude from locationservice?

Edit: Originally my question was "Why am I getting different lat and longitude readings at same exact spot when I query locationservices?" I have changed it now that I understand more about the issue.

I am using the script from https://docs.unity3d.com/ScriptReference/LocationService.Start.html . The only pertinent difference is I have commented out the first yield statement because it prevents the service from starting at all on iOS >= 10.3.1 as far as I can tell. I call the script from other scripts when things happen, like when the user taps a button. I also call it in one of the scripts' Awake() method to make sure iOS asks for the location permission when the app is first run. I call the script like so:

 public string location = "not-yet-set location" ;
 TestLocationService tls; 

 TestLocationService TLS = GetComponent<TestLocationService> ();
 tls = TLS; 
 location = tls.locationString;  
 // (locationString is a concatenation of lat and lon in my TestLocationService script.) 

The problem I am having is every time I open the app in the exact same location (at my desk) I get different readings. But if I move down the street, beyond the default 10 meters laterally, I still get the same reading from when I started the app.

What am I doing wrong?

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by agentargyle · May 23, 2017 at 05:23 PM

@Talimar solves it at the bottom of this post: https://forum.unity3d.com/threads/precision-of-location-longitude-is-worse-when-longitude-is-beyond-100-degrees.133192/

The solution is to use .ToString("R")

Done.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by agentargyle · May 21, 2017 at 03:19 PM

I should add that I tried using 1 meter desiredAccuracyInMeters and .1 meters updateDistanceInMeters and it did not change the accuracy. I get up to 5 decimal places for latitude and only 4 for longitude.

So really my question is now:

How can I get 5 decimal places of accuracy for both lat and long? (Pretty sure that is what I need for my level of accuracy.

I think once I have that I can deal with the slight discrepancies programatically.

Thanks!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image agentargyle · May 21, 2017 at 07:36 PM 0
Share

I don't think this answers it, since I can get 5 decimal places with latitude, just not longitude. But, apparently, the script Unity uses to get the data from the iOS device uses floats not double for the type so maybe that has something to do with it? https://forum.unity3d.com/threads/gps-float-precision-issue.275180/

avatar image
0

Answer by neomarian · Oct 21, 2019 at 05:22 PM

try this https://github.com/ryanw3bb/unity-native-toolkit

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

104 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GPS coordinates not changing at all! 0 Answers

Disable updateDistanceInMeters filtering entirely on Input.Location.Start 0 Answers

Android Input Location Crash 0 Answers

target fixed by GPS locaton 0 Answers

Location Service gets stuck during Initializing on Epson Moverio 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges