I have difficulties extending a MapExtent by a number of meters and i hope i can find a good solution here.
My use case is to select a rectangle on the map. From the rectangle i get a MapExtent. This MapExtent should be increased by x meters which is a given input by the user.
I have the following problem when doing this:
How to get an approximately correct pixel result when converting from meters to pixels? e. g. How many pixel on the current map (with zoom and scale + scale unit regarded) are approximately one meter.
My first approach was to use the AxMap.CurrentScale because the Ax.MapUnits is set to meters. Then i calculated how many pixels are equivalent to one meter: 1 / (Map.CurrentScale / 96). 96 is the number for pixels per logical inch as it is stated that this is used for the scale in the documentation:
https://www.mapwindow.org/documentation/mapwingis4.9/group__map__extents.html#ga3746cb2f2d816f7ae6b910679b142301 . However the results i am getting from this calculation doesn’t seem to be right, but i have no idea why. I wanted to multiply the given meters by the pixel per meters and then i add the result to the corner points of the rectangle.
Maybe someone knows easier approaches to this use case, i’m kind of new to MapWinGis and haven’t used other GIS softwares before.
Thanks in advance