Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

geolocation - How to properly triangulate GSM cell towers to get a location?

First of all, I am trying to do all this disaster in c# (.net 4) so if you come up with some code to help me that would be appreciated but really anything would help at this point.

I have a situation where I have a device that can only get GSM Cell information (incidentally via the AT+KCELL command) so I have a collection of values about cell towers (each has LAC, MCC, MNC, Cell ID, Signal Strength and the first Timing Advance). I think, therefore, I am in a good place to be able to come up with some sort of longitude and latitude coordinate (albeit inaccurate, but, well meh). This is where I am reaching out for help because now my little brain is confused...

I can see various services that provide cell code resolution (Google, Open Cell ID, etc) and they take LAC,MCC etc as arguments and return a coordinate. I figure that what they return would, therefore, be the coordinate of the given tower I pass in. So in my case I could send off all the LACs etc that I have and get back a collection of longitude and latitudes. Brilliant, but that is not where my device is. Now I think I need to do some kind of triangulation and this is where my lack of knowledge is hurting me.

So am I right so far? Assuming I am, how do I perform this calculation (is there something out there that will tell me what to do with all these numbers or, even better, some open source library I can reference and feed all this stuff into to get something sensible)?

I'm assuming that I would need to use the timing advance to work out some approximate distance from a cell tower (maybe using the signal strength somehow) but what do I have to do? As you can tell - I am way out of my depth here!

For example, this is something I might get back from the aforementioned AT command:

5,74,33,32f210,157e,8101,50,0,79,3,32f210,157e,80f7,37,64,5,32f210,157e,810b,37,55,32,32f210,157e,9d3,27,41,33,32f210,157e,edf8,15

breaking it up and parsing it I would get (I hope I parse this right - there is a chance there is a bug in my parsing routine of course but it looks reasonable):

Number of cells: 5

Cell 1

LAC: 5502
MNC: 1
MCC: 232
Cell ID: 33025
Signal: 80
ARFCN: 74
BSIC: 33
Timing advance: 0
Longitude: 14.2565389
Latitude: 48.2248439

Cell 2

LAC: 5502
MNC: 1
MCC: 232
Cell ID: 33015
Signal: 55
ARFCN: 79
BSIC: 3
Longitude: 14.2637736
Latitude: 48.2331576

Cell 3

LAC: 5502
MNC: 1
MCC: 232
Cell ID: 33035
Signal: 55
ARFCN: 64
BSIC: 5
Longitude: 14.2488966
Latitude: 48.232513

Cell 4

LAC: 5502
MNC: 1
MCC: 232
Cell ID: 2515
Signal: 39
ARFCN: 55
BSIC: 32
Longitude: 14.2488163
Latitude: 48.2277972

Cell 5

LAC: 5502
MNC: 1
MCC: 232
Cell ID: 60920
Signal: 21
ARFCN: 41
BSIC: 33
Longitude: 14.2647612
Latitude: 48.2299558

So with all that information how do I find, in the most accurate way, where I actually am?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I can help you with a bit of the theory.

Triangulation is basically finding the intersection point of 3 circles.

Each mobile tower is the center of a circle. The size of the circle is relative to the signal strength of that tower.

The place where the 3 circles overlap is where the user is.

You can do some very basic triangulation as follows:

3 Towers at 
 tx1,ty1 
 tx2,ty2 
 tx3,ty3

With signal strengths s1, s2, s3

We calculate the weight of each signal. Essentially a number from 0 to 1 for each tower where the sum of the weights adds up to 1.

Weighted signal w1, w2, w3 where:
 w1 = s1/(s1+s2+s3)
 w2 = s2/(s1+s2+s3)
 w3 = s3/(s1+s2+s3)


User will be at
x: (w1 * tx1 + w2 * tx2+ w3 * tx3)
y: (w1 * ty1 + w2 * ty2+ w3 * ty3)

Here is a working example using the values from your question:


s1 = 80
s2 = 55
s3 = 55
s4 = 55
s5 = 21

w1 = 80 / ( 80 + 55 + 55 + 55 + 21 ) 
w2 = 55 / ( 80 + 55 + 55 + 55 + 21 ) 
w3 = 55 / ( 80 + 55 + 55 + 55 + 21 ) 
w4 = 55 / ( 80 + 55 + 55 + 55 + 21 ) 
w5 = 21 / ( 80 + 55 + 55 + 55 + 21 ) 

w1 = 0.3007519
w2 = 0.2067669
w3 = 0.2067669
w4 = 0.2067669
w5 = 0.0789474

1. Longitude: 14.2565389
1. Latitude: 48.2248439

2. Longitude: 14.2637736
2. Latitude: 48.2331576

3. Longitude: 14.2488966
3. Latitude: 48.232513

4. Longitude: 14.2488163
4. Latitude: 48.2277972


5. Longitude: 14.2647612
5. Latitude: 48.2299558


Location Longitude = 
 14.2565389 * 0.3007519 + 
 14.2637736 * 0.2067669 + 
 14.2488966 * 0.2067669 +
 14.2488163 * 0.2067669 +
 14.2647612 * 0.0789474

Location Latitude: = 
 48.2248439 * 0.3007519 + 
 48.2331576 * 0.2067669 + 
 48.232513 * 0.2067669 +
 48.2277972 * 0.2067669 +
 48.2299558 * 0.0789474

Result Longitude: 14.255507
Result Latitude: 48.2291628


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...