Starting with version 3.10, SBuilderX is prepared to use a background image created from tiles downloaded from the Internet. This background image can then assist the scenery designer in creating roads, rivers, lakes, cities, etc, and in placing scenery objects. In this way, scenery items created by SBuilderX can be precisely positioned in the Flight Simulator world.

There are a number of sites, referred to here as “Tile Servers” from where tiles can be downloaded. However SBuilderX is only capable of working with a Tile Server if:

1. the Tile Server sends images of 256 x 256 pixels
2. the Tile Server uses the Mercator projection and the WGS84 datum
3. there is a SBuilderX compatible Plug-In for that Tile Server

Most Tile Servers available in the Internet comply with rules 1 and 2 above. A notable exception are LandStat7 tiles that work with Nasa World Wind (the tiles in this case have a size of 512 x 512 pixels and use the Lat/Lon Geographic projection).

This document describes how a SBuilderX compatible Tile Server Plug-In can be implemented. The Plug-In consists of a DLL file that the user needs to place inside the “../SBuilder/Tiles” folder. Each time SBuilderX starts, it reads this folder to check if compatible Tile Server Plug-Ins exist. If so, they are loaded and used by SBuilderX. You can add many as many Plug-Ins as you wish.

So what is a SBuilderX compatible Tile Server Plug-In? The answer: it is a .Net Class that implements the IServer Interface. And what is the IServer Interface? It is a .Net Class that defines the rules for accessing a Tile Server. The IServer Interface resides in the TileServer.dll assembly file that can be found inside the “../SBuilder” folder. The source code for this file is the following:

Public Interface IServer

ReadOnly Property ImageType() As String
ReadOnly Property ServerName() As String
ReadOnly Property MaximumZoom() As Integer
Function DownloadTile(ByVal X As Integer, _
ByVal Y As Integer, _
ByVal Zoom As Integer, _
ByVal Filename As String) As Boolean

End Interface

As you see the interface has 4 members (3 properties and 1 method). The most important one is the function called DownloadTile. It has 4 parameters: X that refers to the longitude of the tile; Y that refers to the latitude of the tile; Zoom that refers to the resolution of the tile; and Filename that contains the full path name where the tile will be saved after downloading. Here is a description of the interface:

ImageType – gets the file extension of the tiles (“.jpg” or “.png”);
ServerName – gets the name of the server;
MaximumZoom – gets the maximum Zoom of available tiles;
DownloadTile – downloads the tile specified by X Y and Zoom and saves it in the specified filename. The function returns True if it succeds.

As you see, no implementation is contained in the IServer Interface. The particular implementations reside in the Plug-Ins. The Plug-In must implement all the members of the interface. To finalize this document, we describe the meaning of the parameters X, Y and Zoom defined in the IServer Interface.

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.

In order to explain this representation, we note that SBuilderX displays tiles at Zoom levels greater or equal to 3. At Zooms of 0, 1 and 2, the background that appears in the SBuilderX display is a fixed image called globe.jpg that can be found inside the “../SBuilder/Tiles” folder. If you could get SBuilderX to represent tiles at Zoom=0, the SBuilderX display would look like:


As you see there are 4 tiles that span longitudes from W180 to E180 and latitudes from approximately N85 to S85. At Zoom=1, the display would look like:


You can get the meaning of the X, Y and Zoom parameters from the names of the shown tiles. Tile name L1X3Y2 means Zoom=1, X=3 and Y=2. You can easily discover what is the position of a tile in the Globe, giving the Zoom Level (“L” in the tile name means Level) and the X and Y parameters.

We can see that the number of tiles increases very fast as the Zoom increases. At Zoom=0 we need 4 tiles to represent the Earth and at Zoom=1 we need 16. The total number of tiles at a given Zoom is given by the formula: N = 2 ^ (Zoom + 1). For example, at the Zoom of 18 there should be 274,877,906,944 tiles to span the entire Earth.