Hi,
is there a similar functionality like WebGMaps.GetMapCenter() for WebOSMaps?
I cannot find anything though...
Bart
(Bart)
April 15, 2019, 8:42am
2
Hi,
Unfortunately this functionality is only available in WebGMaps. This is a limitation of the OpenLayers API which the WebOSMaps is based on.
I know that there isn't a direct way to get this from OSM via
Javascript, but this could be easily calculated with vector addition
using the bounds, that are known or could be retrieved:
WebOSMaps.GetMapBounds; //fills OSMapBounds in WebOSMapsBoundsRetrieved() OSMapCenter.Longitude := (OSMapBounds.SouthWest.Longitude + OSMapBounds.NorthEast.Longitude) / 2; OSMapCenter.Latitude := (OSMapBounds.SouthWest.Latitude + OSMapBounds.NorthEast.Latitude) / 2;
It would be nice to have a GetMapCenter() method for the sake of compatibility to TWebGMaps.
PS: Why is the forum timeout so ridiciously small, that I have to retype my replies again?