Jump to content
Sign in to follow this  
GHD

Converting Lat/Long to LWMPoint3 coordinates

Recommended Posts

I have created flatten files and removed the equivalent LWM polygons from the HP file. This works ok, however, obviously the flattens do not show up in map view. I have two questions.Can someone give me a formula to convert Lat/Long as used in SCASM Area16N (FSTFlatten output) to LWMPoly3/LWMPoint3 coordinates (LWMViewer output).Secondly, do LWMPoly3 polygons need to be convex? ie, will I need to split the flatten contours. ( I know I will need to do this on cell boundaries).I am proficient in C++, so given this information I am sure I could write a conversion program.Any help would be much appreciated,George

Share this post


Link to post
Share on other sites

Hi George.I use Delphi, but the math should be about the same:==================================================== LOD5x := Floor( ( Longitude ) / 3.75 ) ; LOD5y := Floor( ( Latitude ) / 2.8125 ) + 1 ; LOD5xLon := LOD5x * 3.75 ; LOD5yLat := LOD5y * 2.8125 ; LOD5xPoint := Ceil( ( Frac( ( Longitude + 180 ) / 3.75 ) * 3.75 ) / 0.0146484375 ) - 1 ; LOD5yPoint := 256 - Ceil( ( Frac( ( Latitude + 90 ) / 2.8125 ) * 2.8125 ) / 0.010986328125 ); LOD8x := Ceil( ( Longitude + 180 ) / 0.46875 ) - 1 ; LOD8y := Ceil( ( 180 - ( Latitude + 90 ) ) / 0.3515625 ) - 1 ; LOD13xSub:= Ceil( ( Longitude + 180 ) / 0.0146484375 ) - 1; LOD13ySub:= Ceil( ( 180 - ( Latitude + 90 ) ) / 0.010986328125 ) - 1; LOD13x := Ceil( ( Longitude + 180 ) / 0.0146484375 ) - 1 - ( LOD8x * 32 ); LOD13y := Ceil( ( 180 - ( Latitude + 90 ) ) / 0.010986328125 ) - 1 - ( LOD8y * 32 ); LOD13xPoint := Ceil( ( Longitude + 180 ) / 0.000057220458984375 ) - 1 - ( LOD13xSub * 256 ); LOD13yPoint := Ceil( ( 180 - ( Latitude + 90 ) ) / 0.00004291534423828125 ) - 1 - ( LOD13ySub * 256 ); LOD8xPoint := LOD13xPoint + ( LOD13x * 255 ) + 4080; LOD8yPoint := LOD13yPoint + ( LOD13y * 255 ) + 4080;Cell is LOD8x, LOD8yArea is LOD13x, LOD13yAreaPoint is LOD13xPoint, LOD13yPointCellPoint is LOD8xPoint, LOD8yPointAreaFill1x1 is LOD13x, LOD13yAreaFill2x2 is LOD13x DIV 2, LOD13y DIV 2AreaFill4x4 is LOD13x DIV 4, LOD13y DIV 4AreaFill8x8 is LOD13x DIV 8, LOD13y DIV 8AreaFill16x16 is LOD13x DIV 16, LOD13y DIV 16====================================================Polys should be convex, and they need to be split at the LOD13 bounds ( Area ). Areas then need to be grouped for the LOD8 bounds ( Cell ).Cells need to be arranged in rows from West to East and then rows arranged from North to South in the final code. That's a requirement of the data stream, as described by the SDK and worked out by Christian Stock and Chris Wright.Dick

Share this post


Link to post
Share on other sites

Hi Dick,Thanks for the information, I will get cracking now.George

Share this post


Link to post
Share on other sites

Hi Dick,I have been looking at a default HP* bgl and see that it contains non-convex polygons. This obviously makes my task much easier.George

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...