Answer the question
In order to leave comments, you need to log in
How to convert PaintBox X and Y coordinates to Longitude and Latitude (Openstreetmap)?
Faced with an interesting problem. We have a TPaintBox component, which conditionally displays some part of the map taken from Openstreetmap. The question is how to find out the latitude and longitude when we move the cursor over this component, if we know the following:
The width and height of the TPaintBox component: hBox = 400 | wBox = 800
The current scale is known from Openstreetmap: 11
Lon and Lat for the top left point (0,0) : Lon = 28.12 | Lat = 46.07
Our cursor also moves within our TPaintBox, that is, we know the X and Y position of
OpenStreet tiles always have a length and height: 256 pxl
I would appreciate help with the formulas for the functions below, for example:
function GetLonByX( APosX: Integer): Double;
function GetLonByY(APosX: Integer): Double;
PS. Scale and initial coordinates Lon | Lat may change...
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question