Jump to content

ED Developers, please give me my position in x,y,z


Recommended Posts

Developers of our EyeCandy Sim,

 

I just made a network test with a friend who already downloaded FC and found that the v.LatLongAlt.Lat, v.LatLongAlt.Long, v.LatLongAlt.Alt are in fact like the name already says Degrees,Minutes & Seconds...

 

Which means that this Data is unuseable for our ATC Project.

 

WE NEED X,Y,Z COORDINATES TO PLOT OUR PLANES ON YOUR MAP !!!!

 

If it is possible to export my own position in x,y,z please one of u friendly developers, TELL US HOW...

 

We are not planning any cheating tools, we are serious sim fanatics with ATC Controllers in our Squad trying to make Lomac even more realistic and enjoyable...

 

Help us...

 

JaBoG32_Zillion

Link to comment
Share on other sites

There was some people asking about the same thing earlier in the month

Search under:

Map projection

ZoomBoy

My Flight Sims Page

- Link to My Blog - Sims and Things - DCS Stuff++

- Up-to-Speed Guides to the old Lockon A10A and Su-25T

- Some missions [needs update]

Link to comment
Share on other sites

I just made a network test with a friend who already downloaded FC and found that the v.LatLongAlt.Lat, v.LatLongAlt.Long, v.LatLongAlt.Alt are in fact like the name already says Degrees,Minutes & Seconds...

 

Hmm, judging from http://lockon.ru/index.php?end_pos=567&scr=default&lang=en , maybe both are possible.

 

Please try v.LatLongAlt.z, v.LatLongAlt.x, and vLatLongAlt.Alt instead. Does it work?

 

Note that x = Latitude, and z = Longitude.

 

-SK

Link to comment
Share on other sites

doesn't work, no export at all with v.LatLongAlt.z, v.LatLongAlt.x, and vLatLongAlt.Alt !!

 

i also tried:

 

v.position.p.x, v.position.p.y, v.position.p.z

 

and

 

cur.position.p.x, cur.position.p.y, cur.position.p.z

 

inside my

 

local o = LoGetWorldObjects()

for k,v in pairs(o) do

 

NONE OF THEM WORKED :(

Link to comment
Share on other sites

  • ED Team
Developers of our EyeCandy Sim,

 

I just made a network test with a friend who already downloaded FC and found that the v.LatLongAlt.Lat, v.LatLongAlt.Long, v.LatLongAlt.Alt are in fact like the name already says Degrees,Minutes & Seconds...

 

Which means that this Data is unuseable for our ATC Project.

 

WE NEED X,Y,Z COORDINATES TO PLOT OUR PLANES ON YOUR MAP !!!!

 

If it is possible to export my own position in x,y,z please one of u friendly developers, TELL US HOW...

 

We are not planning any cheating tools, we are serious sim fanatics with ATC Controllers in our Squad trying to make Lomac even more realistic and enjoyable...

 

Help us...

 

JaBoG32_Zillion

If you are a programmer then the following C++ code may help you:

const float zeroX = 5000000.f; // Real coordinates beginning

const float zeroZ = 6600000.f;

 

const float centerX = 11465000.f - zeroX; // Circle center

const float centerZ = 6500000.f - zeroZ;

 

const float pn40x24_X = 4468608.57f - zeroX; // point 40dgN : 24dgE

const float pn40x24_Z = 5730893.72f - zeroZ;

 

const float pn48x24_X = 5357858.31f - zeroX; // point 48dgN : 24dgE

const float pn48x24_Z = 5828649.53f - zeroZ;

 

const float pn40x42_X = 4468608.57f - zeroX; // point 40dgN : 42dgE

const float pn40x42_Z = 7269106.20f - zeroZ;

 

const float pn48x42_X = 5357858.31f - zeroX; // точка 48dgN : 42dgE

const float pn48x42_Z = 7171350.00f - zeroZ;

 

// distances from the circle center to 48dgN and 40dgN

const double lenNorth = sqrt((pn48x24_X-centerX)*(pn48x24_X-centerX) + (pn48x24_Z-centerZ)*(pn48x24_Z-centerZ));

const double lenSouth = sqrt((pn40x24_X-centerX)*(pn40x24_X-centerX) + (pn40x24_Z-centerZ)*(pn40x24_Z-centerZ));

const double lenN_S = lenSouth - lenNorth;

 

const double RealAngleMaxLongitude = atan (((double)pn40x24_Z - centerZ)/(pn40x24_X - centerX)) * 180.f / PI;

 

// Map bounds. Degrees!

const float EndWest = 24.f;

const float EndEast = 42.f;

const float EndNorth = 48.f;

const float EndSouth = 40.f;

const float MiddleLongitude = (EndWest + EndEast) / 2;

 

const float ToLengthN_S = (float)((EndNorth - EndSouth) / lenN_S);

const double ToAngleW_E = (MiddleLongitude - EndWest) / RealAngleMaxLongitude;

const double ToDegree = 180. / PI;

 

void GetCoords(double inLatitudeGrad, double inLongitudeGrad, float &outX, float &outZ)

{

double realAng = (inLongitudeGrad - MiddleLongitude) / ToAngleW_E / ToDegree;

double realLen = lenSouth - (inLatitudeGrad - EndSouth) / ToLengthN_S;

outX = centerX - realLen * cos (realAng);

outZ = centerZ + realLen * sin (realAng);

}

Valery Blazhnov

Eagle Dynamics Veteran

Link to comment
Share on other sites

This has already been done by a Russian group.

A fully moving online map of the planes that are present on the server.

 

http://lockon.but.ru/

 

Apparently it has been up for quite a while as well.

 

THere must be simple forumlae that can be used to convert one method of positioning to the other.

 

A programmer would be able to apply the forumlae to produce the desired lat and long results. There should not be much overhead for these calculations at all.

Link to comment
Share on other sites

Hi Valery,

 

Thanks a lot for your answer...

 

I can see your phytagoras and 1/2 way understand your calculating a distance from the so called "circle center" to 48dgN and 40dgN.

But why 48 AND 40 Degree North ?

Is the circle Center the Zero Point on the x,y,z coordinates near Simferopol ?

And are 48 and 40 Degree North above and below the Middle Longitude ?

 

I can also see your Atan and your rad to degree conversion. Is that some Heading your calculating ?

 

Sorry to say, to understand it, I think i need more explanation to your Code...

 

THX a lot for replying....

 

JaBoG32_Zillion

 

Edit:

Ok 48 and 40 dgn are the map boundaries... and the the middle longitude is (EndWest + EndEast) / 2;

What is the RealAngleMaxLongitude ?

Is the ToLengthN_S my position relative to the North and Souther Boundaries ?

 

Maybe i can convert it to ActionScript without fully understanding it... I'm really not a cartographer...

Link to comment
Share on other sites

  • 1 month later...

i doesn't seem to work right...

 

Hi Valery,

 

Hope you will read this post. As you might imagine, i didn't quite manage to successfully apply your code :( ...

Our project has come quite far already...

 

Press connect without IP or Name, Press & Hold "R" Key for the Ruler option.

 

We can recieve data from lockon and we can plot the runways based on the x,z coordinates we collected in F11 view with Alt-Y...

 

We really want to make it a precise Air Traffic Simulator and are to stupid to accomplish it, now, so close before finishing it...

 

I know it's nowhere near your job to bugfix our simple action script code, i just hope you can find some spare time and maybe maybe be able to tell me which mistake i made...

 

I feed it the with the coordinates that Sochi 06 beginns:

Lat: 43.439718

Long: 39.937191

 

As a result it tells me Sochi06 beginns at:

X -523816.4

Z 792412.7

 

But in Lockon Sochi06 beginns at:

X -165206.9

Z 460883.3

 

:(

 

 

//Macromedia Flash ActionScript...

 

function latlong2xz (inLongitudeGrad,inLatitudeGrad) {

 

ToDegree = 180/Math.PI;

 

zeroX = 5000000;

zeroZ = 6600000;

 

centerX = 11465000-zeroX;

centerZ = 6500000-zeroZ;

 

pn40x24_X = 4468608.57-zeroX; // point 40dgN : 24dgE

pn40x24_Z = 5730893.72-zeroZ;

 

pn48x24_X = 5357858.31-zeroX; // point 48dgN : 24dgE

pn48x24_Z = 5828649.53-zeroZ;

 

pn40x42_X = 4468608.57-zeroX; // point 40dgN : 42dgE

pn40x42_Z = 7269106.20-zeroZ;

 

pn48x42_X = 5357858.31-zeroX; // point 48dgN : 42dgE

pn48x42_Z = 7171350.00-zeroZ;

 

// distances from the circle center to 48dgN and 40dgN

 

lenNorth = Math.sqrt((pn48x24_X-centerX)*(pn48x24_X-centerX)+(pn48x24_Z-centerZ)*(pn48x24_Z-centerZ));

lenSouth = Math.sqrt((pn40x24_X-centerX)*(pn40x24_X-centerX)+(pn40x24_Z-centerZ)*(pn40x24_Z-centerZ));

lenN_S = lenSouth-lenNorth;

 

RealAngleMaxLongitude = Math.atan((pn40x24_Z-centerZ)/(pn40x24_X-centerX))*ToDegree;

 

// Map bounds. Degrees!

EndWest = 24;

EndEast = 42;

EndNorth = 48;

EndSouth = 40;

 

MiddleLongitude = (EndWest+EndEast)/2;

ToLengthN_S = (EndNorth-EndSouth)/lenN_S;

ToAngleW_E = (MiddleLongitude-EndWest)/RealAngleMaxLongitude;

 

realAng = (inLongitudeGrad-MiddleLongitude)/ToAngleW_E/ToDegree;

realLen = lenSouth-(inLatitudeGrad-EndSouth)/ToLengthN_S;

outX = centerX-realLen*Math.cos(realAng);

outZ = centerZ+realLen*Math.sin(realAng);

return outX+" : "+outZ

 

}

 

Thank you so much in advance,

 

regards

 

JaBoG32_Zillion

Link to comment
Share on other sites

Hi again,

 

Sorry to say but I'm really stuck... Is it possible that the RealAngleMaxLongitude is not precise enough ? I don't have double floats in ActionScript...

 

But floats in ActionScript are like this one for example, 6.27327882143581 with 14 digits behind the comma...

 

I'm have a friend who will compile the original C++ function for me... Is it possible it's somehow little bit wrong ?

 

Would be really happy about some help...

 

Thx again...

 

JaBoG32_Zillion

Link to comment
Share on other sites

i got it, unfortunatly it doesn't help much

 

Hi again,

 

My C++ friends are either to busy coding a stupid fishing simulator for dcp on the nebula2 device or are to busy playing stupid world of warcraft...

So after hard labour i managed to compile my own .exe...

 

Took me quite a while since printf and scanf are nearly the only things I have ever done in C...

 

It works :) ... use the win32 console and use a . (dot) as decimal seperator...

 

Unfortunatly it doesn't help at all since its not what i need...

 

I'm therefore asking again, why doesn't my action script accomplish the same ? Anyone who might have an idea, please, please help me out...

 

thx...

 

// latlong2xz.cpp : Defines the entry point for the console application.

//

#include "stdio.h"

#include "stdafx.h"

#include "math.h"

 

const double pi = 3.14159265358979323846;

 

const float zeroX = 5000000.f; // Real coordinates beginning

const float zeroZ = 6600000.f;

 

const float centerX = 11465000.f - zeroX; // Circle center

const float centerZ = 6500000.f - zeroZ;

 

const float pn40x24_X = 4468608.57f - zeroX; // point 40dgN : 24dgE

const float pn40x24_Z = 5730893.72f - zeroZ;

 

const float pn48x24_X = 5357858.31f - zeroX; // point 48dgN : 24dgE

const float pn48x24_Z = 5828649.53f - zeroZ;

 

const float pn40x42_X = 4468608.57f - zeroX; // point 40dgN : 42dgE

const float pn40x42_Z = 7269106.20f - zeroZ;

 

const float pn48x42_X = 5357858.31f - zeroX; // point 48dgN : 42dgE

const float pn48x42_Z = 7171350.00f - zeroZ;

 

// distances from the circle center to 48dgN and 40dgN

const double lenNorth = sqrt((pn48x24_X-centerX)*(pn48x24_X-centerX) + (pn48x24_Z-centerZ)*(pn48x24_Z-centerZ));

const double lenSouth = sqrt((pn40x24_X-centerX)*(pn40x24_X-centerX) + (pn40x24_Z-centerZ)*(pn40x24_Z-centerZ));

const double lenN_S = lenSouth - lenNorth;

 

const double RealAngleMaxLongitude = atan (((double)pn40x24_Z - centerZ)/(pn40x24_X - centerX)) * 180.f / pi;

 

// Map bounds. Degrees!

const float EndWest = 24.f;

const float EndEast = 42.f;

const float EndNorth = 48.f;

const float EndSouth = 40.f;

const float MiddleLongitude = (EndWest + EndEast) / 2;

 

const float ToLengthN_S = (float)((EndNorth - EndSouth) / lenN_S);

const double ToAngleW_E = (MiddleLongitude - EndWest) / RealAngleMaxLongitude;

const double ToDegree = 180. / pi;

 

int main(int argc, char* argv[])

{

 

float inLatitudeGrad;

float inLongitudeGrad;

 

float outX;

float outZ;

 

printf("Please enter the Latitude:\n");

scanf("%f", &inLatitudeGrad);

 

printf("Please enter the Longitude:\n");

scanf("%f", &inLongitudeGrad);

 

double realAng = (inLongitudeGrad - MiddleLongitude) / ToAngleW_E / ToDegree;

double realLen = lenSouth - (inLatitudeGrad - EndSouth) / ToLengthN_S;

outX = centerX - realLen * cos (realAng);

outZ = centerZ + realLen * sin (realAng);

 

printf("The result is:\nX:%f\nZ:%f", outX, outZ);

 

}

Link to comment
Share on other sites

Hi,

 

just to clarify what was going on, i think i should tell you it was me myself and I who messed it up... :)

I just mixed latitude and longitude up so the result was wrong... it actually worked the whole time...

You can see it here Our ATC programm is on its way again, sorry to bother you all, hope you will enjoy it when it's finished around june/july...

 

later

 

JaBoG32_Zillion

Link to comment
Share on other sites

  • 6 years later...
If you are a programmer then the following C++ code may help you...

 

Not to bring up useless posts, but this saved my bacon this afternoon, straight outta 2005! (Or Compton, but mostly 2005.) Thanks to Valery, wherever you are!

 

Please note in Valery's [psuedo] code, his calculation for "RealAng" at the end of the snippet says "ToAngleW_E / ToDegree" which should say "ToAngleW_E * ToDegree"

 

Hopefully this helps keep this thread from dying entirely so the next dumb noob like me gets this info.


Edited by aaron886
Link to comment
Share on other sites

Hi aaron886. I put this algorithm (and its inverse calculation) into Yoda's LEAVU2 (which he then tweaked). You can find a working (Java) implementation there.

 

I can also supply test coordinates to check your algorithm if you like.

Link to comment
Share on other sites

MATT the thread is about calculating coordinates and positions, not... whatever you're trying to imply it is about.

 

Hi aaron886. I put this algorithm (and its inverse calculation) into Yoda's LEAVU2 (which he then tweaked). You can find a working (Java) implementation there.

 

I can also supply test coordinates to check your algorithm if you like.

 

Thanks kind sir! I read some posts on the subject you wrote as well, and I think they'll come in handy. However, I'm running into problems with the coordinate conversion. It seems I get close, but not close enough... something like 1000 meters off on average. I'm not quite sure what the problem is.

 

I'm actually just using a script language to read in an x,z meter coordinate position and arrange objects based on simple trigonometric transformations. At this stage, all I'm trying to do is prove that I can convert from radians lat/long (or whatever is the actual value used in the .miz file when extracted,) to meters x,z or vice versa.

 

I could definitely make use of some test values, and if you're willing, I'll pm you a section of code to see if anything stands out to you. I'm beginning to think it may be a problem with a lack of decimal precision somewhere in the calculations.

Link to comment
Share on other sites

At this stage, all I'm trying to do is prove that I can convert from radians lat/long (or whatever is the actual value used in the .miz file when extracted,) to meters x,z or vice versa.

 

Both coordinate are used in DCS:BS, the lat/long are used in the mission editor and the x/y coordinate are used in game. Both coordinate may not match perfectly inside the game, this might be why you are getting a 1km error.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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