Android的谷歌地图的经度和纬度融为一体pression
我做的自行车路线跟踪一个应用程序。
I am doing one application for Track routes of bike.
我全部取每秒的经度和纬度。
I am fetching all the latitude and longitude per second.
现在我想的纬度和经度存储在我的本地数据库或服务器。但问题是,数据变得非常大。所以我想这些数据存储与优化,意味着我想同样的结果,但我想,以减少数据大小。
Now I want to store that latitude and longitudes in my local database or on server. But the problem is data becomes very large. So I want to store that data with optimization, means I want same result but I want to reduce data size.
请帮我,如果有人知道任何算法或任何东西。
Please help me, if anybody knows any algorithm or anything.
如果你想这样做,设备端,有一个由Android地图团队,其中包括一个方法来连接$ C创建一个开源的地图工具库经纬度
的$ CA的对象集到 EN codeD折线字符串。
If you want to do this device-side, there is an open-source maps utility library created by the Android Maps team that includes a method to encode a set of LatLng
objects into an encoded Polyline string.
Android地图utils的库项目:
https://github.com/googlemaps/android-maps-utils
Android Maps Utils library project: https://github.com/googlemaps/android-maps-utils
示例应用程序,展示了如何使用该库:
https://github.com/googlemaps/hellomap-android
Sample app that shows how to use the library: https://github.com/googlemaps/hellomap-android
在项目中使用这个库,然后调用 PolyUtil.en code()
法恩codeA集的经纬度
对象转换成字符串,就可以在数据库中存储:
https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java#L68
Use this library in your project, then call the PolyUtil.encode()
method to encode a set of LatLng
objects into a String, which you can store in your database:
https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java#L68
然后,调用 PolyUtils.de code()
方法去code一组来自同一个String LatLng对象的:
https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java#L29
Then, call PolyUtils.decode()
method to decode a set of LatLng objects from the same String:
https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java#L29