Jump to content

What is the (x,y) map location of units from a mission.lua file based on?


Go to solution Solved by Insonia,

Recommended Posts

Posted

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

 

Posted
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.

 

  • Like 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
Posted

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.

  • Like 1
  • Thanks 1
Posted (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 by _Defi
Posted (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:

KXJznP1.pngHuc9dry.png

bullseye 0,0. 

Edited by Insonia
  • Like 1
  • Thanks 1
Posted
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.

Posted (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 by _Defi
Posted (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. 

TY8IbLV.png

It will show X and "Z" instead of lat and long

Edited by Insonia
  • Thanks 1
Posted
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?

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...