Get my geolocation

Hello everyone, I have already tried many DIFFERENT ways to find out my coordinates. I used python modules and 2ip type sites, many different sites. All of the above gives me these coordinates(55.7522 37.6156). I tested all this from different devices, which have a different provider. From this (55.7522 37.6156) place I am very far away, but I am in Moscow(at least I identified something correctly).

Code examples

import geocoder
g = geocoder.ip('me')
print(g.latlng)
curl ipinfo.io/loc

I also went to the 2ip website, found out your ipv4, went to the following sites: ipinfo.io, 2ip.ru/geoip, iplocation.net/; I drove my ipv4 there(on the sites), and got the same result. Does anyone know how to identify the true location? It is advisable to use python. If you know a way without using python, write, I would be very grateful. Please help me. Thank you

Author: kali_xyyali, 2020-01-30

1 answers

Pass the mac addresses of neighboring wifi access points to the geocoder. The accuracy of detection in Moscow will improve to 50 meters

That's what I did in the router. There's no python, just cgi..

Collect wifi signal levels

iwlist wlan0 scan | awk '/Address/ {print $5} /Signal\ level/{split($3,a,"="); print a[2]}' > levels.list

I generate xml. This will be much easier on python

xml=<ya_lbs_request><common><version>1.0</version>
<api_key>Ваш ключ</api_key>
</common><wifi_networks>
<?$i=0; $levels = fopen("/tmp/levels.list", "r") >
<? while(!feof($levels)) >
<? $i++; $mac = fgets($levels,255); $level = fgets($levels,255) >
<network><mac><? echo $mac></mac><signal_strength><? echo $level></signal_strength><age><? echo $i*10+1000 ></age></network>
<? endwhile >
</wifi_networks></ya_lbs_request>

And I send it to Yandex. On python via requests, just send a post

cgi -q /usr/www/lib/ya.xml.cgi | curl -d @- -X POST http://api.lbs.yandex.net/geolocation > $LOC

In response, I get the coordinates

Documentation here https://yandex.ru/dev/locator/doc/dg/api/xml-docpage/

Https://yandex.ru/dev/locator/doc/dg/api/json.html/

 0
Author: eri, 2020-11-21 09:58:15