Using Google Map Tracks API

后端 未结 1 1292
你的背包
你的背包 2021-02-01 10:51

I have to develop a vehicle tracking system. I have gone through \'Google Map API\' and Google Map Tracks API\' tutorials. i-e;

Google Map API (Web).

Google Map

1条回答
  •  盖世英雄少女心
    2021-02-01 11:14

    If you want a native app running on the phone you would use the Google Maps SDKs for either iOS or Android. (How to develop iOS and Android apps is beyond the scope of this but basically Android uses Java, iOS uses Objective-C.)

    You should be able to use the SDK to get the current location of the device.

    For the web tracking application/interface (where you will view the devices movement/location) I'd maybe use a Node.js/Express/Google Maps JavaScript API stack with Firebase (firebase.com) handling the data - the reason for which I will explain below.

    You can probably bypass the Google Tracks API and check out GeoFire from Firebase. It allows realtime tracking of assets based on lat/long values that are encoded into "Geohashes" (read more about them on Wikipedia) for speed and convenience. Lat/long coordinates are encoded into a single string making a single position/point easy to parse on the client side. You should be able to create multiple "entities".

    If, however, you need to access the "Collections" or "GeoFencing" features of the Tracks API; you may need stick with that. The "Breadcrumbs" feature is nice too but you could probably replicate it in some fashion with the Maps JavaScript v3 API.

    So your app would output lat/log coordinates at given intervals (could be data/resource intensive depending on your implementation but I would say every 3-5 seconds), store them (on Firebase) and convert them to Geohashes. When the Geohash is written to the database, geoFire.js should decode the string on the client side and it should update the position instantaneously. When it updates with a new value, it will give the "realtime" effect (without reloading the page etc.)

    This is quite a high level overview but I hope it helped some.

    All the best.

    0 讨论(0)
提交回复
热议问题