For my previous post, where I find the signal strength of WiFi spots, I will also need an algorithm to actually locate the spot. I will use Triangulation as my beginning point, since this is a method to do exactly that – locate a given point, using three or more known points. Triangulation is often used in wireless communications, to identify the location of cell phones, walkie talkies and so forth.
But, as my system will use GPS later on, I will need to accommodate for this. Problem here is the sphere that we call Earth, it is not straightforward to find the midpoint of a set of coordinates. But there is a way, as this site explains here (see method A).
Method
The idea is to convert every geographical coordinate into a simple x,y,z coordinate (The Cartesian Coordinate system). After converting all geographical coordinates into Cartesian coordinates, we calculate the total weight of all the coordinates. After this – we simply add them all together (multiplying the respective coordinate with its weight), and divide by the total weight. We are then left with one coordinate, a single 3D Cartesian coordinate, that we can convert back to a Geographical coordinate using the trigonometric function atan2 and Pythagoras.
The method is described on the next page. After that, I will code my own implementation, that can take a series of weighted coordinates and return a single coordinate. Then I’ll test it, comparing with GeoMidPoints service.