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

Importing SBX tiles into Scenproc to export to GEOTIFF (??)

Messages
115
Country
australia
Does Scenproc import the BMP files using the TXT files that SBX creates (not the INF fles when you compile)?

If so, what is the command to import them?

cheers

Braedon
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
No, but if the txt file is easy to understand I can probably add it quickly.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
To quickly implement it some samples of the files SBuilderX makes would be useful.
 
Messages
7,450
Country
us-illinois
Hi Arno:

Here's the entire (and very simple) Geo-referencing *.TXT file which accompanied SBuilderX output of a 1-piece BMP file assembled as a composite from the aerial imagery tiles it downloads via tileserver DLLs internally unto the [SBuilderX install path]\Tiles sub-folder chain.

FYI: Those BMP and TXT files automatically write into [SBuilderX install path]\Tools\Work sub-folder when Background image 'tiles' are selected in the SBuilderX work-space.

SBuilderX internally and automatically submits a name for the 'selected tile group' (in this case "Photo02") ...that the end user may use in the 'Map Properties' dialog accessed by right-clicking the border of that selected background image group of tiles in the SBuilderX work-space.

That ex: "Photo02" name submitted by SBuilderX for the 'selected tile group' is only used if 'approved' in the 'Map Properties' dialog by the end user when that 'selected tile group' is subsequently processed via a BGL file compilation.


[GEOGRAPHIC]
Name=Photo02
North=49.419460741227
South=49.4163339230005
West=-123.715667724609
East=-123.708114624023


BTW: This is a very small area of the "White Islets" near Sechelt, BC, Canada; do you also need the BMP file ? :scratchch


NOTE: This is the same info Luis Sa's "Exploring Google Maps" or Dick's "Rhumba Maps" makes available in on-screen text boxes.


The above *.TXT file format output by SBuilderX is different than the *.TXT file format written by Jim Keir when one exports a BMP screenshot from LWMViewer v1.4x (...which might be another useful file to support).

BTW: The latter LWMViewer v1.4x *.TXT file does, however, contain info SBuilderX can read as Geo-referencing info. :pushpin:


FYI: During import of raster files (BMP / JPG / TIF / GIF / PNG) via Add Map > From Disk, SBuilderX offers calibration versus export of a GeoTIFF file. ;)


PS:

[EDITED]

NOTE: I have not had occasion to test extreme North or South Latitude test scenarios to be certain about this, but based on 'subjective' visual appearance in the SBuilderX work-space and in 1-piece output BMP files of imagery I have tested from generally 'non-warped' areas of the world globe, AFAIK: :scratchch

* Downloaded source imagery tiles and the 1-piece BMP output from the selected Background Map 'group' remain in their original 'non-warped' "Spherical Web Mercator" (aka "EPSG:3857") projection in the SBuilderX work-space and in the [SBuilderX install path]\Tools\Work sub-folder

* Those source imagery tiles and the 1-piece BMP output from the selected Background Map 'group' are re-projected internally by SBuilderX to "Geographic" (aka "EPSG:4326" - Lat-Lon / WGS 84) ONLY during BGL file compilation via the SBuilderX GUI.


I am probably mistaken about this, as it does not make sense considering the fact that a attempted manual compile of those 1-piece BMP output files projected in "Spherical Web Mercator" (aka "EPSG:3857") by SDK Resample would reject improperly projected source data. :alert:

So, it may just be my tentative mis-interpretation of the process due to my use thus far of predominantly 'non-warped' source data in test areas of the world globe that subjectively appeared 'less distorted' when I inspected, via a graphics application, SBuilderX 1-piece BMP output files (...that were 'probably' actually already projected in "Geographic" (aka "EPSG:4326" - Lat-Lon / WGS 84). :confused:


Regardless of this tentatively un-resolved question on my part, I am certain Arno's due diligence will verify the projection status of any such source files from SBuilderX that are intended for processing and use by ScenProc. :wizard:


UPDATE: SBuilder has the ability to NOT re-project 1-piece BMPs from selected imagery tiles to EPSG:4326:


[END_EDIT]

GaryGB
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Would you have a txt file for each image file that SBuilderX downloads? Or one for multiple files?
 
Messages
7,450
Country
us-illinois
Hi Arno:

The tiles are downloaded into various zoom-level related sub-folder chains (created as needed) under a top-folder named for the tile server in:

[SBuilderX install path]\Tiles sub-folder

...and do not have any Geo-referencing TXT files associated with them within those local sub-folders alongside the aerial imagery tiles.


AFAIK, SBuilderX automatically writes out a BMP with a Geo-referencing TXT file only when one has 'selected' a group of tiles that were downloaded and displayed as a "Background Image" in the SBuilderX work-space.


The file names used for the 1-piece output BMP image and the Geo-referencing TXT file when written into:

[SBuilderX install path]\Tools\Work sub-folder

...are the same.


IIUC, those fine names are based on a working knowledge of zoom-level and Geographic coordinate related tile server names for the files, or perhaps as well, their on-screen coordinates within a tile grid used to display them in the SBuilderX work-space (Luis Sa' and Dick would know more about this).

[EDITED]

Luis Sa' explained the SBuilderX tile name and background image scheme in this thread at PTSIM:

http://www.ptsim.com/forum/viewtopic.php?f=22&t=1053

[END_EDIT]


By default, all 1-piece output BMP images and the paired Geo-referencing TXT files when written into:

[SBuilderX install path]\Tools\Work sub-folder

...are allowed to remain within that sub-folder until the end user removes / deletes them (with an application or means other than via SBuilderX itself).


IIRC, this is the means by which one can perform multiple tile download sessions for adjacent Geographic extent areas, and write out paired files that are safely within the USERVA and/or I/O file size limits of SBuilderX and SDK Resample, then still be able utilize them as paired source files for a ex: multi-source INF file.


I am not certain whether the SBuilderX tile downloader GUI can prevent- or ensure- a Geographic extent overlap between different tile download sessions. :alert:


Whether those paired files are allowed to remain in the specific SBuilderX sub-folder, or copied / moved to another working folder elsewhere, it would be a good way to gather source files with their Geo-referencing data for use by ScenProc. :idea:


Maybe ScenProc can read all SBuilderX output file pairs copied by the end user into a working folder and generate a 1-piece GeoTIFF ? :scratchch


Hope this helps ! :)

GaryGB
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Thanks for the details. Guess I need to start SBuilderX and examine a bit. I never use the tile functionality.
 
Messages
115
Country
australia
Sorry for being absent for this, went for a break to Magnetic Island with the family at short notice.

SBX only creates the TXT file after you go thru the process of adding a map from background, in a screen-full by screen full. If something could take all the tiles downloaded by Dick's Tile Downloader in SBX (to SBuilderX\Tiles\Google_api3_NoRoads\<layer-sub-directories>), then hoovering up all the tiles at a particular zoom level in defined geographic bounds, that would be simpler for the user (not necessarilly anyone creating the tool) as you would just have to pan around at a zoom level and tell the tool to stitch all the tiles together. However I just had in mind the TXT file that goes with the BMP file in the work directory which is a fairly simple format with the cordinates of the 4 corners of the BMP.

Thanks Gary for explaining in my absence.

cheers

Braedon
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
So would you expect to select a TXT file and that scenProc then loads the image that belongs to it?
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
It's a guess but I think the georeference is also stated in the filename.
Even when the txt file is deleted SBX places the tiles correctly when re-importing.

Also the txt is equally named like the tile.
 
Messages
115
Country
australia
The large quantity of raw 256px square tiles that are downoaded by Dick's downloader have no georeferencing info in them or any accompanying world file with that informaton. The directory structure is a bit cryptic but it and the file names seem to convey the geographic informaton and zoom level.

ie:
SBuilderX\Tiles\Google_api3_NoRoads\3\1\3\0\1\0\0\2\3\3\3\3\1\0\L17X238574Y165833.PNG
SBuilderX\Tiles\Google_api3_NoRoads\3\1\3\0\1\0\0\2\3\3\3\3\1\0\L17X238574Y165834.PNG
SBuilderX\Tiles\Google_api3_NoRoads\3\1\3\0\1\0\0\2\3\3\3\3\1\0\L17X238574Y165835.PNG

etc...

So the Zoom level may corrrespond to a particular resolution (in linear or angular measure, I don't know), but the file names look like UTM measurements in meters. I think there is also a small overlap in the tiles (ie 1px on all sides). This is just a raw observation though, so it may just be conjecture.

Some of the subdirectories also have tiles in them at lower (less detailed) zoom levels, probably from the panning around to locate the area of interest.

Once SBX has downloaded them and you tell it (by virtue of what is currently on the screen, which zoom level and what you 'rubber band' on the map download dialogue), SBX stitches them together and creates a BMP and corresponding TXT file.

The generated BMP has a file name that is of the format:
L17X238173X238183Y165584Y165590.BMP, and corresponding TXT file which I could reasonably break into corner coordinates at zoom level 17 of:
L17 X238173 X238183 Y165584 Y165590
What these numbers equate to as a unit of measure or UTM zone I don't know. Maybe Dick knows more as he may have come across it when writing the downloader.

So SBX seems to know how to stitch the many small downloaded PNG files together. It just cannot do them on a large scale (ie creating a greater than ~2GB Geotiff/BMP of a large area at high zoom)

The little pausing thing that stalls on the download of the last few tiles that makes you cancel, remove the background, and re-process on-screen area (the 2nd time with most of it cached) just adds to the issue and the time it takes to get things together, multiplied by several hundred times to get a large area.

cheers

Braedon
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
I start to understand how it works. But what's your feature request for scenproc? You want to load and merge the tiles or load the bmp SBuilderX already merged?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
I start to understand how it works. But what's your feature request for scenproc? You want to load and merge the tiles or load the bmp SBuilderX already merged?
 
Messages
115
Country
australia
I guess the original request and the simplest is to get something to stitch the process output BMPs together with and let SBX and the user do the grunt work. And that would be the simplest from a programatic point of view.

The simplest for the user using SBX is to gather up the tiles from sbuilder without having to make the map, then they only have to pan around to get the tiles into the cache. But I don't know how you would set bounds and how much SbuilderX caches before deleting the excess.

Probably a more complete method would be to get rid of SBX altogether (It doesn't handle rasters very efficiently). Maybe use a polygon, a LOD ID, or 4 corners of an area as bounds, and set the zoom level, and use that to tell Dick's downloader to get the tiles the same way SBX does? and have scenproc or a GIS program mosaic them together (??). But that's not a small task.

cheers

Braedon
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Guess I need to have a chat with Dick...
 
Messages
115
Country
australia
I don't know of the challenges to getting that working in practice, but as a thought/logic exercise that would be my ideal.

Thanks again Arno (& Dick).
 

Luis_Sá

Resource contributor
Messages
326
Country
portugal
Hello,

As referred to in http://www.ptsim.com/forum/viewtopic.php?f=22&t=1053

SBuilderX uses a Lat/Lon Geographic projection. When SbuilderX displays tiles downloaded from Tile Servers it re-projects the images from Mercator to Lat/Lon (and makes an adjustment equivalent to a local azimuthal projection). In order to achieve that, SBuilderX keeps an internal representation of the earth identical to most Mercator Tile Server systems.

The relevant routines are:

Code:
    Friend Function XTilesFromLon(ByVal lon As Double, ByVal Z As Integer) As Integer

        Dim dXY As Double
        dXY = PI / (2 ^ Z)
        lon = PI + lon * pi_180
        XTilesFromLon = Int(lon / dXY)

    End Function

    Friend Function YTilesFromLat(ByVal lat As Double, ByVal Z As Integer) As Integer

        Dim dXY As Double
        dXY = PI / (2 ^ Z)
        lat = lat * pi_360  ' lat=lat/2  <<< equivalent
        lat = lat + pi_4
        lat = Math.Tan(lat)
        lat = Math.Log(lat)
        lat = PI - lat
        YTilesFromLat = Int(lat / dXY)

    End Function

and

Code:
 Friend Function LatFromYMerc(ByVal Y As Integer, ByVal Z As Integer) As Double

        Dim dXY, lat As Double
        dXY = PI / (2 ^ Z)
        lat = Y * dXY
        lat = PI - lat
        lat = Math.Exp(lat)
        lat = 2 * Math.Atan(lat)
        LatFromYMerc = (lat - pi_2) / pi_180

    End Function

    Friend Function LonFromXMerc(ByVal X As Integer, ByVal Z As Integer) As Double

        Dim dXY As Double
        dXY = PI / (2 ^ Z)
        LonFromXMerc = (X * dXY - PI) / pi_180

    End Function

I hope to publish all source of SBuilderX very soon.

Regards, Luis
 
Top