Support Topics Documentation Slack YouTube Blog

Saving and retrieving Geopoint only 3 digits

Hello
I am saving geopoint using Java Sdk and retrieving it using Android.

I noticed that the Geopoint on the data base is truncated to (3 to 5 decimal points). So when I save it and I check in the database I find that it is only saved as 3 number after decimal in the data table (Geo Reference). When I open Geo points screen I find that it is saved as yy.xxx00

When I retreive it, it comes as yy.xxx only which loses quite bit of accuracy

Am I doing something wrong? Or is this intended behaviour? or a bug?
Thanks

Hello @snakeeyes

What does you mean

?

and

?

I am using Android SDK:

GeoPoint geoPoint = new GeoPoint( 50.123456789, 14.123456789 );
GeoPoint geo = Backendless.Geo.savePoint( geoPoint );
System.out.println( "Geo - " + geo );

BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(  );
List<GeoPoint> listGeo = Backendless.Geo.getPoints( geoQuery );
GeoPoint result = listGeo.get( 0 );
System.out.println( "result - " + result );

Output:

Geo - GeoPoint{objectId='7B200E64-9689-4911-FFFF-691C27B87B00', latitude=50.123456789, longitude=14.123456789, categories=[Default], metadata={}, distance=null}
result - GeoPoint{objectId='7B200E64-9689-4911-FFFF-691C27B87B00', latitude=50.123456789, longitude=14.123456789, categories=[Default], metadata={}, distance=null}

As we can see, precision is maintained inside.
Or do you mean something else?

1 Like

Thank you for the answer. It seems I had a bug with double and float at the time of upload. I ran your snippet and it worked but mine didn’t . So I will investigate further why my code is behaving differently. Much appreciated!

1 Like