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 Google Maps (latitude/longitude) to a coordinate system useful to display the locations on your floor plan image (pixels x/y).
These are the steps you need to do to accomplish the conversion:
- Choose a floor plan image and take note of the pixel coordinates (pixels x/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 height]
- [max width; max height]
- [max width; 0]
- Upload the floor plan image inside the Accuware dashboard by following these instructions.
- Once the floor plan has been uploaded inside the Accuware dashboard:
- Select General from the TOP menu. Then select Floorplans.
- Click on the floor plan of interest.
- 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.
- 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.