• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 calculating inf destination coordinates

Messages
42
I am adapting my port of Ortho4XP to FS2004 (https://github.com/stackTom/Ortho4XP_FSX_P3D). I can't seem to figure out how to calculate the appropriate coordinates for the destination to fit within each LOD 13 terrain cell. The SDK says that "Each terrain cell falls on a multiple of 360/32768 degrees latitude, which is 0.010986328125 decimal degrees and 480/32768 degrees longitude, which is 0.0146484375 decimal degrees."

So, I do this:
new latitude = Floor(latitude / 0.010986328125)* 0.010986328125
new longitude = Floor(longitude / 0.0146484375) * 0.0146484375

if latitude or longitude are positive and do this, if negative:

new longitude = Ceiling(latitude / 0.010986328125)* 0.010986328125
new longitude = Ceiling(longitude / 0.0146484375) * 0.0146484375

I do this to fit the scenery onto the LOD 13 cell bounds...

For example, assume north latitude is 51.17934297928926, south latitude is 50.958426723359935, west longitude is -0.3515625, and east longitude is 0.0. We get:
new north latitude = Floor(51.17934297928926 / 0.010986328125) * 0.010986328125 = 51.17431640625
new south latitude = Floor(50.958426723359935 / 0.010986328125) * 0.010986328125 = 50.95458984375
new west longitude = Ceiling(-0.3515625 / 0.0146484375) * 0.0146484375 = -0.3515625
new east longitude = Floor(0.0 / 0.0146484375) * 0.0146484375 = 0.0

Nevertheless, I get the infamous rim of water around the scenery. What I am doing wrong. I think I am interpreting the SDK incorrectly, but can't figure out what I'm doing wrong.

Code:
[Source]
Type = MultiSource
NumberOfSources = 6

[Source1]
Season          = Summer
Variation          = January,February,March,April,May,June,July,August,September,October,November,December
Type          = Custom
Layer          = Imagery
SourceDir  = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon               = -0.3515625
Lat               = 51.17934297928926
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint      = 0
SamplingMethod    = Point
NullValue         = 255,255,255

[Source2]
Season          = Spring
Variation          = January
Type          = Custom
Layer          = Imagery
SourceDir  = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon               = -0.3515625
Lat               = 51.17934297928926
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint      = 0
SamplingMethod    = Point
NullValue         = 255,255,255

[Source3]
Season          = Fall
Variation          = January
Type          = Custom
Layer          = Imagery
SourceDir  = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon               = -0.3515625
Lat               = 51.17934297928926
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint      = 0
SamplingMethod    = Point
NullValue         = 255,255,255

[Source4]
Season          = Winter
Variation          = January
Type          = Custom
Layer          = Imagery
SourceDir  = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon               = -0.3515625
Lat               = 51.17934297928926
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint      = 0
SamplingMethod    = Point
NullValue         = 255,255,255

[Source5]
Season          = HardWinter
Variation          = January
Type          = Custom
Layer          = Imagery
SourceDir  = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon               = -0.3515625
Lat               = 51.17934297928926
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint      = 0
SamplingMethod    = Point
NullValue         = 255,255,255

[Source6]
Season          = LightMap
Variation          = LightMap
Type          = Custom
Layer          = Imagery
SourceDir  = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214_night.tga
Lon               = -0.3515625
Lat               = 51.17934297928926
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint      = 0
SamplingMethod    = Point
NullValue         = 255,255,255

[Destination]
DestDir             = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14\ADDON_SCENERY\scenery
DestBaseFileName     = 5472_8176_GO214
BuildSeasons        = 1
UseSourceDimensions  = 0
CompressionQuality   = 100
NorthLat             = 51.17431640625
SouthLat             = 50.95458984375
WestLon             = -0.3515625
EastLon             = 0.0
LOD = 13

Do images have to be in a 3:4 aspect ratio? This is how the example in the SDK is. Furthermore 0.010986328125 / 0.0146484375 = 3/4 as well...
 
I know there is a tool called photocalc to calculate this, but I can't find a link to it. Also, I rather know how to do it so I can add it to my code.
 
Back
Top