Get AP position over floorplan

webfrank
Getting noticed

Get AP position over floorplan

Hi, is it possible to retrieve AP position over floorplan? I need the position with the same coordinates as reported by Scanning API for clients, meters over the floorplan.

5 Replies 5
sungod
Kind of a big deal

The device list returned by getNetworkFloorPlans includes the APs on the floor plan and each AP's latitude and longitude.

 

https://developer.cisco.com/meraki/api-v1/#!get-network-floor-plans

 

It also returns the latitude and longitude of each of the floorplan's corners, its centre and also the width and height of the floor plan.

 

From that you can calculate each AP's position in metres from the corner.

 

webfrank
Getting noticed

Hi, do you have the formulas to translate lat/lng to floorplan system?

sungod
Kind of a big deal

Not tried it, but I'd just calculate the absolute difference from lower-left lat/long to top-left and AP lat/long values to normalise them to that corner, i.e. lower-left becomes 0,0 in the coordinate system.

 

Then figure out the scale based on the lower-left top-left difference (I'm simplifying by pretending we're on a plane not a sphere, which for likely floorplans is fine)...

 

Divide drawing height (in metres) by the lower/top-left latitude difference to get the scaling factor, multiply the AP latitude by that to get AP distance 'up' from lower-left. Use the same scale factor on the AP longitude to get horizontal distance from lower left.

 

If you sketch things out on a piece of paper with some real values and do the calculations by hand, it'll help see how this works.

 

It's a quick and dirty method, should be good enough for likely floor sizes away from the poles, if you search online you can find more rigorous methods that take into account that we're (roughly) on a sphere.

 

webfrank
Getting noticed

Hi, you are not taking in account floorplan rotation. 

 

I think a transformation matrix is required for this task. 

sungod
Kind of a big deal

Yes, I forgot that, if the plan is rotated you'd need to transform coordinates.

 

I guess you could calculate the floorplan's angle of rotation using Pythagoras, then counter rotate all coordinates to proceed as above.

 

Get notified when there are additional replies to this discussion.