The task of tracking a moving object is widespread. In the simplest case, you need to take the phone with android, put OsmAnd there and set up live monitoring. Sit yourself and look at the map (OpenStreetMap of course) moving the device. I would have done so, but suddenly it turned out that on the right day I would have no Internet, no computer, no time.
And I began to look for a way out.
First, short consultations and discussions took place
with the chat , and then, after lunch, the decision came.
There is a mobile phone and there is a service of the operator email2sms. So in my case, the task is reduced to a simple receipt of a human-readable text no more than 1000 characters long. But first I will try to outline my train of thought.
- The tracking service provided by Opsos is dismissed immediately, as inaccurate and due to the absence of the SIM of any of the designated operators.
- In OSM there is a good search ( not without sin, as habra users found out , but acceptable). And what if it is deployed in the opposite direction and, using the transmitted coordinates, we obtain the name of a nearby ground object. What does this have to do with my task? .. But not with it! It’s just that the text should be more human-readable. In general, the idea is interesting, we must leave it for later. The author of the site even has something in store.
- “The observed has moved 350 meters to the north from the past,” seems to be good, but then you need to somehow save all the points. Even if the last two ... Where can I get this hosting?
- Arrange the WPT in advance and upon reaching them let the device discard the message. Well, here, firstly, the route is not known in advance, but only the destination. Secondly, there was no such application. About this below.
- And so it is not always responsive juick_ppl and it did not help here .
- “Observed” - “relative” - “destination” ... Eureka!
So, 100,500 applications from the market are able to do the same, that OsmAnd collects tracks, shows a location on a map, shares coordinates. The problem is that they are divided only by pressing the “share” menu item, and the dependence on manual actions of an unschooled android user should be excluded. And then to say - a pair of coordinates (
lat ,
lon ) is good except to hang a frame on the wall, but not to tell the person where the object has already reached. Other suitable options have not been found, perhaps not enough time. I will mention only OruxMaps - undoubtedly useful and highly functional program. So functional that it scared me to shiver at my knees. Leave her study for later ...
')
At this point, the thought was clearly formed about the format of the message received every 5 minutes: “
There is XXX km to the destination point ”, this will be enough for me. It could be less often, but 5 minutes is the maximum that can be set. The approximate limit on the number of email2sms messages is 100 per day. That's enough for as much as 8 hours, good enough.
Unexpectedly, I just managed to find hosting, on the terms of placing an extremely simple php script, without a database and other goodies. So it's time to start coding. On the website from the tabs (
GIS-LAB.info , which is to be hidden) there was a sensible description of large circles with the ready-made algorithm “Calculation of the distance and initial azimuth between two points on the sphere”, I brazenly distort and unscrupulously alter in php:
<?php
Distance >> 276805.84112453 [meters]
Initial bearing >> 39 [degrees]As a test example
, airport points were taken , roughly corresponding to the direction and distance of the trip.
Distance between MQF and CEK
The distance has been calculated as being: 277 kilometers (173 miles)Ok, works! We make out the function, the initial azimuth is discarded as unnecessary and to simplify. We attach the missing functionality, not forgetting to post the data in the direction for which Live Tracking originally appeared in OsmAnd 0.7.1.

<?php function distance($llat1,$llong1,$llat2,$llong2) # {
A very important step - in OsmAnd, enter the line
Web address of the Live tracking type:
h͇t͇t͇p͇://hosting_does_not_advertise/fd.php?clat={0}&clon={1}&hdop={3}&alt={4}&speed={5}&slat=53.393&slon=58.756&flat=55.3&flon=61.5&eml=emailto@gmail.com&rpl=emailfrom@mail.ru&usr=[osmohash]&n=[num]

You can
rob cows in the same concept to add waypoints, and if you have a little bit of database in general, turn around in full. However, my knee minimum has already been met ...
...
Good luck ! It remains to be sure to charge the android. After all, if you do not
blow charge, then the focus will not work.
Of the deficiencies identified:
- The maximum interval of 5 minutes, I would like more. Ideally, generally be able to enter a number, and not choose from the list.
- By the end of the second hour, the application died, it is not clear who tried. I suspect that the android summed up, because the user has not been active all this time - as soon as the first data transfer took place, the device was immediately in the bag and regularly gave signals. I had to induce panic and ask to reanimate OsmAnd. Managed, OK.
- There is still a dependency on an untrained user - do not turn off remotely. The instructions did not help, it's hard to see ... It turned out to be easier to turn off the power of the “tracker” on arrival.

But it is enough to wash the bones of such a spherically ideal, thoughtful and logically complete life hacking, after all, we have already arrived at the scene.
Distance >> 29 to final destination and 247194 from start (meters)Speed ​​>> 0.0 (m / s)