Skip to content

Calculating Geo Coordinates of Beacons

Stephan Schultz edited this page Apr 17, 2018 · 3 revisions

For the multilateration, each beacon needs to have a known location (latitude and longitude). Because measuring using GPS is usually not possible in an indoor environment, here's a guide how to calculate the geo-coordinates instead.

1. Measure an outdoor reference location

Find a nearby outdoor location that you can measure using GPS. Make sure that you measure for a few minutes to get a high accuracy. If you don't have a dedicated device for that, you can use a phone and an app like GPSLogger.

2. Calculate an indoor reference location

Find a location inside your building that has a line of sight to your outdoor reference point (e.g. your first beacon). If possible, make sure that the line of sight is orthogonal to the outer wall of your building. That will make it easier to calculate the angle later.

  1. Measure the distance between the outdoor and the indoor reference location. You can use a digital laser distance meter for that.

  2. Measure the angle between the outdoor and the indoor reference location. You can also calculate it based on your building's bearing if you have orthogonal lines. The Location.getRotationAngleInDegrees() method is useful for that.

  3. Use Location.shift() on the outdoor reference location using the distance and angle to the indoor reference location. This will return the geo-coordinates of the indoor reference location.

3. Calculate beacon locations

Based on your indoor reference location, measure or calculate the distances and angles to your beacons. Then calculate their geo-coordinates as described in step 2. Measuring square angles will allow you to use the Pythagorean theorem and saves a lot of time.

Example

// Step 1: Outdoor reference location
double measuredLatitude = 52.512292;
double measuredLongitude = 13.3909021;
Location outdoorReferenceLocation = new Location(measuredLatitude, measuredLongitude);

// Step 2: Indoor reference or beacon location
double distance = 13.435; // in meters
double angle = 353.84; // in degrees (0° is North)
Location indoorReferenceLocation = outdoorReferenceLocation.getShiftedLocation(distance, angle);
System.out.println(indoorReferenceLocation); // print latitude and longitude