1 (edited by WolfBeardedLion 2015-08-09 14:12:28)

Topic: Tileset - Return Chosen Longitude and Latitude

I am using Online Maps to create an iOS and Android app that will allow a user to select a longitude and latitude by using a customized version of the Tileset example.

I tried calling "api.position" (Coordinates of the center point of the map) to get the longitude and latitude of the center of the map once the user selects their chosen location, but this property of the class OnlineMaps only returns a number to its tenth decimal place (97.1, 34.6). I see in the editor that the OnlineMaps script in the inspector window does have the full latitude and longitude number going up to the hundred thousandth decimal place.

How can I retrieve these more detailed numbers through script so I can get a more precised location from the user?

Thank you in advance; Online Maps was very easy to jump into and has been wonderful experience so far.

Re: Tileset - Return Chosen Longitude and Latitude

Hello.

This is because Vector2.ToString, by default shows the values to the first decimal.
Actually, Vector2 stores values in float.
Debug.Log (api.position.ToString("F4"));
Debug.Log (api.position.x);

This is enough for most purposes.
If you need more accuracy, use OnlineMaps.GetPosition:
http://infinity-code.com/doxygen/online … b84e75f062

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Tileset - Return Chosen Longitude and Latitude

Thank you for the quick response, Alex.

Everything is working as intended now.