As mentioned in the title.
There are two objects 30 meters apart in display life. If these two objects are marked on a 1:100m map, how many px should the distance between them be?
高洛峰2017-05-18 10:59:44
First of all, we need to know how many pixels the length of 1cm is equal to on the screen. This is easy to find with the help of the centimeter unit in CSS.
var p = document.createElement('p');
p.style.width = '1cm';
document.body.appendChild(p);
var pxPerCm = p.offsetWidth;
The distance of 30 meters should be 30cm on a 1:100m map. The actual rendered pixel distance is 30 * pxPerCm
.
黄舟2017-05-18 10:59:44
This specific value should be calculated based on the ratio and zoom level of your map display