Answer the question
In order to leave comments, you need to log in
Coordinates (latitude and longitude) in x and y?
Good evening.
The essence of the question is this, a drawing of the edge of the Russian Federation is given on which it is necessary to put points according to the available coordinates (latitude and longitude). How to translate the coordinates of the points on the drawing, i.e. to pixels. The origin of the drawing is at the top left. Accuracy is not very important. There are approximate coordinates (latitude and longitude) of the corners of the picture.
I tried, according to the available data, to calculate how many degrees are in one pixel, but something didn’t work out with this idea, I think it’s not done that way.
Can anyone suggest an algorithm?
Answer the question
In order to leave comments, you need to log in
The task is not as trivial as it seems. It all depends on what projection the map is made in.
For example, there is a Mercator projection (an example of its use is Google Maps). There, latitude and longitude depend linearly on the pixel number, and it is enough to calculate the coordinates of the four corners, and then it is easy to calculate.
And if the map projection is WGS84 (for example, Google Earth uses it), the above method is not suitable. They have their own base coordinates, which depend linearly on the pixel number, and to convert them into latitude and longitude, you must use the appropriate non-linear formulas.
You need to know exactly which projection your file is using. There are quite a few different map projections, and each has its own dependence of pixel coordinates on latitude and longitude. When making a map, the choice of projection depends on the goals pursued. The Mercator projection preserves angles, but not distances, and gives large distortions for areas far from the equator.
There are formats that allow you to store a map projection (geotiff, sid, img), and software that allows you to read this data from files. For example, for geotiff there is a simple listgeo console utility that provides information about the type of projection and the coordinates of the corners. Try to find a map that has projection information.
I'm not sure, but I think something like this:
x= cos(longitude)*earth_radius* scale + offset of the map area
y= sin(latitude)*earth_radius* scale + shift of the map area
Looking at what projection is the drawing of the terrain made in? In any case, you will need to georeference your drawing using a pair of known base points.
take more anchor points (river crossings and everything you can accurately tie)
and then the arithmetic mean: not so accurate, but quickly
If the size of the map is small and the curvature of the earth's surface can be neglected, then the simplest way is as follows:
Suppose the picture has a resolution of (Xmax, Ymax).
The coordinates of the upper left corner of the picture (X1, Y1) and the lower right (X2, Y2).
Then an arbitrary point with geographical coordinates (A, B) under the condition X1 < A < X2 && Y1 < B < Y2 will receive pixel coordinates:
Xcoord = Xmax * (A - X1) / (X2 - X1)
Ycoord = Ymax * (B - Y1) / (Y2 - Y1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question