_Defi Posted December 9, 2023 Posted December 9, 2023 Hey, I am looking at a mission.lua from inside a mission .miz file. The units are localised on the map using an X, Y like this ["type"] = "Cobra", ... ["y"] = 7940.8526241175, ["x"] = -128412.47133601 How do you map this x,y to Lat, Long? I see in mission editor that this unit is roughly at N25, 0.754' and E56 19.665'. But using online converters from Lat/Long to X,Y it doesn't give me back anything close to the x,y used here in the mission file? Can someone explain to me what is the mapping x,y ? What does it reference and how can I convert it to Lat/Long? Thanks! Converters: https://latlongdata.com/lat-long-converter/ https://tool-online.com/en/coordinate-converter.php
Rudel_chw Posted December 9, 2023 Posted December 9, 2023 4 minutes ago, _Defi said: How do you map this x,y to Lat, Long? The DCS Maps employs as native unit the meter, so x=-128412.47133601 means 128 kilometers West of the map origin, and y=7940.8526241175 means 7.9 Km North of the origin. Each map has its origin on a different point, for example caucasus has its origin 0,0 on Crimea, around the WP97/XP97 MGRS line of the map. 1 For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar Mobile: iPad Pro 12.9" of 256 GB
Solution Insonia Posted December 9, 2023 Solution Posted December 9, 2023 They are meters offset from the origin. The game converts between x,y and LatLon via "convertMetersToLatLon(x,y)" and "convertLatLonToMeters(lat, lon)" functions, which calls the C++ function in lua "terrain" module. 1 1
_Defi Posted December 9, 2023 Author Posted December 9, 2023 (edited) 38 minutes ago, Rudel_chw said: The DCS Maps employs as native unit the meter, so x=-128412.47133601 means 128 kilometers West of the map origin, and y=7940.8526241175 means 7.9 Km North of the origin. Each map has its origin on a different point, for example caucasus has its origin 0,0 on Crimea, around the WP97/XP97 MGRS line of the map. Oh I see. how do I find the origin of a map? I am looking at Persia Map here. Can I find the origin of the map in Lat/Longitude somewhere? Edited December 9, 2023 by _Defi
Insonia Posted December 9, 2023 Posted December 9, 2023 (edited) execute and output convertMetersToLatLon(0,0) in ME script. Or you add/set a unit/zone/object/bullseye in ME save and quit. modify the "mission.lua" in miz, change it to 0,0 then reload the mission. look at their state bar in game Mariana: bullseye 0,0. Edited December 9, 2023 by Insonia 1 1
_Defi Posted December 9, 2023 Author Posted December 9, 2023 10 minutes ago, Insonia said: They are meters offset from the origin. The game converts between x,y and LatLon via "convertMetersToLatLon(x,y)" and "convertLatLonToMeters(lat, lon)" functions, which calls the C++ function in lua "terrain" module. Oh thanks I will look into this function. So there is also an 'input' of the map origins since x,y is counted from x0,y0 so it converts (x0+x, y0+y) to lat/long and respectively. Where can I find the origin of the map (x0,y0) ? 2 minutes ago, Insonia said: execute and output convertMetersToLatLon(0,0) in ME script. Or you manually add a unit/zone/object and modify the "mission.lua" in miz, change it to 0,0 then reload the mission. look at their state bar in game oh that's sly. thanks.
_Defi Posted December 11, 2023 Author Posted December 11, 2023 (edited) On 12/9/2023 at 8:22 PM, Insonia said: They are meters offset from the origin. The game converts between x,y and LatLon via "convertMetersToLatLon(x,y)" and "convertLatLonToMeters(lat, lon)" functions, which calls the C++ function in lua "terrain" module. hey @Insonia, I am trying to find that code, in which folder is this? What's the file called? Reason why I want to know is I want to find out what coordinate system or approximation from lat/lon to x,y that DCS is using. Edited December 11, 2023 by _Defi
Insonia Posted December 11, 2023 Posted December 11, 2023 (edited) they are used in the mission editor. the function is a c function call from DCSWorld\bin-mt\gui_map.dll and DCSWorld\bin-mt\lua-terrain.dll Spoiler DCSWorld\MissionEditor\modules\me_bullseye.lua DCSWorld\MissionEditor\modules\me_map_window.lua DCSWorld\MissionEditor\modules\me_nav_target_fix_points.lua DCSWorld\MissionEditor\modules\me_setCoordPanel.lua DCSWorld\MissionEditor\modules\me_statusbar.lua DCSWorld\MissionEditor\modules\me_weather.lua I noticed them add "Metric" into Coordnate setting. It will show X and "Z" instead of lat and long Edited December 11, 2023 by Insonia 1
_Defi Posted December 11, 2023 Author Posted December 11, 2023 4 minutes ago, Insonia said: they are used in the mission editor. the function is a c function call from DCSWorld\bin-mt\gui_map.dll and DCSWorld\bin-mt\lua-terrain.dll Hide contents DCSWorld\MissionEditor\modules\me_bullseye.lua DCSWorld\MissionEditor\modules\me_map_window.lua DCSWorld\MissionEditor\modules\me_nav_target_fix_points.lua DCSWorld\MissionEditor\modules\me_setCoordPanel.lua DCSWorld\MissionEditor\modules\me_statusbar.lua DCSWorld\MissionEditor\modules\me_weather.lua Oh I see. so I suppose I cannot look into the source code of the DLL right?
Recommended Posts