It is not so easy as it looks like. You should get the map object's projection and the map's zoom to be able to calculate it.