How to get distance using Wi-Fi

I want to find the distance using wi-fi and draw a marker on the map on the iPhone.

So, any idea or code I can get for this?

+3
source share
7 answers

After the first reading of your question, I was on the assumption that you had in mind the distance to the access point. After I wrote about this, I realized that you can say something. If this is what you mean, keep reading ...

Given your configuration:

  • one fixed receiver (your phone should not be fixed, but it is effectively fixed if you are looking for instant measurements).
  • one fixed base station (access point)
  • omnidirectional antenna on the receiver
  • 802.11 b / g protocol

It's impossible. Even if you work at PHY level, it is impossible to solve. To make it a little more doable, you need to triangulate your receiver's position relative to two (but preferably larger) base stations. Even then, it is still a difficult problem. Radio waves travel at the speed of light, so using relay methods to measure the propagation delay of a signal in the opposite direction does not give good accuracy (receivers must work very fast, and then multipath problems ...). Again, all of this assumes that you are basically creating your own RF equipment, which you obviously are not going to do for the iPhone.

It’s best to track the location of the base station to capture the strength of the Wi-Fi signal when changing the position of the phone. By “changing position,” you essentially have to make your way around the area. With some good heuristics and reliability to handle signal degradation associated with distance, you can achieve decent accuracy (probably around 10 meters).

+10
source

It is not possible to get the exact distance (in meters or feet) to the access point, simply using the signal strength from your network card.

+2
source

Use the Apple CoreLocation infrastructure, it can provide you with the coordinates of your location. I can’t link to it because I don’t have access to the iPhone documentation.

+1
source

Here http://www.mathforum.com/library/drmath/view/51711.html you can find equations for calculating the distance between two locations from GPS. This is the C # code I created on this (its scaled metric)

private double Distance(GpsPosition p1, GpsPosition p2) { // http://www.mathforum.com/library/drmath/view/51711.html double A = p1.Latitude / 57.29577951; double B = p1.Longitude / 57.29577951; double C = p2.Latitude / 57.29577951; double D = p2.Longitude / 57.29577951; if((A==C) && (B==D)) return 0; if((Math.Sin(A)*Math.Sin(C)+Math.Cos(A)*Math.Cos(C)*Math.Cos(BD)) > 1.0) return 6372.72 * Math.Acos(1); else return 6372.72 * Math.Acos(Math.Sin(A) * Math.Sin(C) + Math.Cos(A) * Math.Cos(C) * Math.Cos(B - D)); } 
+1
source

You may be able to get an approximate distance using 3 or more access points. Now there is a way to get the distance to a mobile subscriber using 3 GSM base stations of mobile communication.

0
source

Using the received power, you can determine the distance using the model of radio frequency propagation from the emitter to the receiver. However, it looks like you want a location, not just a distance.

Free space path loss model:

http://en.wikipedia.org/wiki/Free-space_path_loss

0
source

What are you trying to achieve here?

If you are trying to build your position on the map using the Iphone, this function is already part of the Iphone with a GPS receiver and will do it out of the box.

If you are trying to find the position of your laptop using Wi-Fi and send this place to iphone, then you have a rather complicated problem that is probably not feasible without a lot of work.

You have options that allow you to triangulate your position with GSM masts, but they are in fixed positions with lat / longs knowledge. Wifi access points do not have a database of geographical locations, so triangulating from them will be very difficult / impossible.

You can use third-party services such as this to track your position using GSM, but they are wildly inaccurate if you are not in a big city and require that you have a GSM modem in everything that you track.

0
source

Source: https://habr.com/ru/post/1391768/


All Articles