Falcon BMS Forum
    • Register
    • Login
    • Search
    • Categories
    • Unread
    • Recent
    • Unsolved
    • Popular
    • Website
    • Wiki
    • Discord

    Converting x and y values into lat and long

    Technical Support (BMS Only)
    2
    3
    323
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      steveh2112 last edited by

      i’m having a really hard time converting x and y from the flightdata to lat and long. i have it close but there is a skew in the longitude of 2.9deg to the north east it seams but its more complex than that.

      if anyone could send me a formula or a bit of code, much appreciated

      thx

      1 Reply Last reply Reply Quote 0
      • S
        steveh2112 last edited by

        i worked it out with a little help from the free falcon source

        const float FALCON_ORIGIN_LAT = 33.844031F; // DEF_LAT;
        const float FALCON_ORIGIN_LONG = 123.0F; //DEF_LONG;
        const float RTD = 57.2957795F;
        const float DTR = 0.01745329F;
        const float EARTH_RADIUS_NM = 3443.92228F; //Mean Equatorial Radius
        const float EARTH_RADIUS_FT = 2.09257E7F; //Mean Equatorial Radius
        const float NM_PER_MINUTE = 1.00018F; //Nautical Mile per Minute of Latitude (Or Longitude at Equator)
        const float MINUTE_PER_NM = 0.99820F; //Minutes of Latitude (or Longitude at Equator) per NM
        const float FT_PER_MINUTE = 6087.03141F; //Feet per Minute of Latitude (Or Longitude at Equator)
        const float MINUTE_PER_FT = 1.64283E-4F; //Minutdes of Latitude (or Longitude at Equator) per foot
        const float FT_PER_DEGREE = FT_PER_MINUTE * 60.0F;

        void convertXYtoLatLon(int x, int y, float& lat, int& latd, float& latm, float& lon, int& lond, float& lonm)
        {
        // Kunsan center runway 36 is 35 57.550N 127 24.288E = x(772511) y(1302177)
        lat = (FALCON_ORIGIN_LAT * FT_PER_DEGREE + x) / EARTH_RADIUS_FT;
        lat = R2D(lat);
        latd = (int)lat; latm = (lat-latd)*60;

        float cosLat = (float)cos(D2R(lat));
        lon = ((FALCON_ORIGIN_LONG * DTR * EARTH_RADIUS_FT * cosLat) + y) / (EARTH_RADIUS_FT * cosLat);
        lon = R2D(lon);
        lond = (int)lon; lonm = (lon-lond)*60;
        }

        AlphaFox 1 Reply Last reply Reply Quote 0
        • AlphaFox
          AlphaFox @steveh2112 last edited by

          Thanks, for your post, I need some other data :
          const float FALCON_ORIGIN_LAT = 33.844031F; // DEF_LAT;
          const float FALCON_ORIGIN_LONG = 123.0F; //DEF_LONG;
          for ITO, Balkan and Ikaros theaters.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          63
          Online

          10.6k
          Users

          21.0k
          Topics

          348.6k
          Posts

          Benchmark Sims - All rights reserved ©