Luca Bertoncello <lucab...@lucabert.de> writes: > You can see the result as attachment. > In the Map I drawed two circles: the first one at the south-west > corner of the map. This is correct. > The second one should be in the middle of the map ( ($maxLat - > $minLat) / 2 + $minLat, ($maxLng - $minLng) / 2 + $minLng ), and you > see, this is NOT correct. > Finally I tried to add the markers for the airports of Kamenz and > Bautzen. And they are on the wrong position (both are souther than the > correct position, Kamenz is wester and Bautzen is easter, too). > > Can you please send me at least a pseudocode to understand you to > convert LatLng to Y,X of an image?
postgis has builtin support for Coordinate Reference Systems and conversions using proj. There is existing library support to convert between geodetic (lat/long) and projected (easting, northing, usually) coordinate systems. I suggest reading the proj docs and the postgis manual. https://proj.org/en/stable/ https://postgis.net/docs/manual-3.5/ (section 4.5 in particular) If you aren't using postgis, then your question is really off topic! In that case, you should use gdal, which also uses proj. And, it can read/write postgis. https://gdal.org/en/stable/ and in particular the ogr2ogr program is useful. Finally, you may want to visualize all of this in qgis.