There are several ways to accomplish the conversion. The method that we usually suggest is to compute a “transformation matrix” that takes care of converting:

- from the WGS84 coordinate system used by Open Street Maps (latitude/longitude)
- to a coordinate system useful to display the positions on your floor plan image (pixels x/y).

These are the steps you need to accomplish the conversion:

- Choose a floor plan image and take note of the pixel coordinates (pixels x; pixel y) of 3 or more points on it. Please choose points that are far from each other. We suggest to use the 4 corners of the floor plan image. The coordinates of the 4 corners are:
- [0; 0]
- [0; max image height]
- [max image width; max image height]
- [max image width; 0]

- Upload the floor plan image inside the Dragonfly dashboard by following these instructions.
- Once the floor plan has been uploaded inside the Dragonfly dashboard:
- Select
**General**from the top menu. Then select**Floorplans.** - Click on the floor plan of interest (
**not on the EDIT button!**). **Zoom in as much as possible**and move to the first corner of the floor plan image.- Click on the first corner and take note of the
**lat/lng**fields:- E.g.: [0; 0] -> [45.610829, 9.351505]

- Click on the other 3 corners and take note of the
**lat/lng**fields.

- Select
- You have now all what you need to create a [4 x 4] matrix where each row contains the correspondence between pixel x/pixel y and latitude/longitude: [pixel_x pixel_y latitude longitude].
- Compute the transformation matrix using least squares approach.

Once you have the transformation matrix you can apply it to any pair of latitude/longitude coordinates to obtain the corresponding pair of x/y pixel of your floor plan image.

**For clients who need the Matlab code**

Fell free to write us to receive the Matlab code to make the computations described above along with a real example of usage of this method. You can then implement the matrix multiplication, transpose and inverse operation yourself (replicating the Matlab code in your favorite programming language) or you can use any library available on the Web.