Page 1 of 12

Tile Server Plug-Ins for SBuilderX

Posted: Fri Jun 22, 2007 11:38 pm
by Luis Sa
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:

<font color="green">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</font id="green">

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:

Image

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:

Image

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.

You can use this forum if you have developed a Plug-In that implements this interface and want to share it with other SBuilderX users.

Edited bY Luis Sá

Implementations of Tile Server Plug-Ins were sent to PTSim and we are glad to make them available to SBuilderX users. These DLLs are distributed in the SBuilderX install so you only need to download them if you want to modify them. They can

http://www.ptsim.com/sbuilderx/TileServerPack.zip
http://www.ptsim.com/sbuilderx/TileServerPackSource.zip

Any more contributions are welcome!

Edited, October, 21, 2007

An update for one of the map server's Plug-Ins was made available by a SBuilderX user. The executable and the source code can be downloaded from here:

http://www.ptsim.com/sbuilderx/Ask_v1_T ... erPack.zip
http://www.ptsim.com/sbuilderx/Ask_v1_T ... Source.zip

Edited, December, 6, 2008

This new plug-in should work for Google Maps:

http://www.ptsim.com/sbuilderx/GoogleServer_v3.zip
http://www.ptsim.com/sbuilderx/GoogleSe ... rce_v3.zip

Edited, June, 15, 2009

A revision of the Google Maps DLL in this set:

http://www.ptsim.com/sbuilderx/TileServerPack_v4.zip
http://www.ptsim.com/sbuilderx/TileServ ... rce_v4.zip


Other contributions are welcome!

Re: Tile Server Plug-Ins for SBuilderX

Posted: Wed Dec 10, 2008 2:33 pm
by Luis Sa
Hello FSim63,

Could you move the existing cache tiles to another file and try again? Or could you try in a part of the Earth where you have not been before?

May be you need to clean the folders from blanks tiles.

Regards,

Luis

Re: Tile Server Plug-Ins for SBuilderX

Posted: Thu Dec 11, 2008 12:32 am
by rhumbaflappy
Hi Luis.

I also cannot recieve the Google satellite tiles. I can get the map tiles.

Dick

Re: Tile Server Plug-Ins for SBuilderX

Posted: Thu Dec 11, 2008 3:17 am
by Luis Sa
Hello,

Thanks for the information. It seems there was an error in GoogleServer_v2.zip! Please try again with this one:

http://www.ptsim.com/sbuilderx/GoogleServer_v3.zip

It just worked for me now! Please report if the same applies to you!

Kind Regards, Luis

Re: Tile Server Plug-Ins for SBuilderX

Posted: Fri Dec 12, 2008 3:52 am
by meshman
Luis Sa wrote:It just worked for me now! Please report if the same applies to you!
Luis,

Copied the .DLL into SBX and went and found a much clearer image for an airport background with Google. I don't use Google as much as Virtual Earth, but still nice to have a backup.

Thanks for all your efforts and let me wish you the very best this holiday season,

Lance

Re: Tile Server Plug-Ins for SBuilderX

Posted: Fri Dec 12, 2008 3:26 pm
by rhumbaflappy
Hi all.

I downloaded the version 3 of Luis' Google DLL ( from FSDevloper.com ) and I now DO get the satellite images. Many thanks Luis.

I am still perplexed why I could not get them before!

Dick

Re: Tile Server Plug-Ins for SBuilderX

Posted: Fri Dec 12, 2008 11:24 pm
by Luis Sa
Hi Dick,

I just uploaded the source. I was getting an error "403 forbidden" and I just added a line setting the UserAgent property of the WebRequest.

Code: Select all

           Dim req As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create(imageURL), Net.HttpWebRequest)
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0;Windows NT 5.1"
            Dim res As Net.HttpWebResponse = DirectCast(req.GetResponse, Net.HttpWebResponse)
When I was trying to debug this dll, I got pages with the captcha images (you referred to that) and my web site page even failed to work. I think that had to do with cookies. I hope that I get no ore surprises.

Regards,

Luis

Re: Tile Server Plug-Ins for SBuilderX

Posted: Sat Dec 13, 2008 8:48 pm
by rhumbaflappy
Hi Luis.

Today, I get no satellite tiles... but being curious, I checked Google maps, and their own site gives me no satellite images. I've seen this before. Sometimes for several days there are no images. I think their servers get overloaded.

Dick

Re: Tile Server Plug-Ins for SBuilderX

Posted: Sun Dec 14, 2008 12:23 am
by Luis Sa
Hi,

I think that they use cookies. I myself could not get tiles (even when accessing my web page) after I encountered a captcha image when I was trying to debug the dll.

Regards,

Luis

Re: Tile Server Plug-Ins for SBuilderX

Posted: Sun Dec 14, 2008 2:57 pm
by rhumbaflappy
Hi Luis.

An idea I found to accomidate the captcha was to pause a program on encountering the 403 exception, open the url in a browser window, allow the enduser to solve the captcha, and then unpause the program and continue downloading tiles.

I have not tested this.

Dick

Re: Tile Server Plug-Ins for SBuilderX

Posted: Mon May 10, 2010 2:17 am
by rhumbaflappy
Hi all.

Here is a new revision of the GoogleServer.dll
GoogleLibrary_050910.zip
Google Server.dll revision
May 09, 2010
(101.74 KiB) Downloaded 7789 times
Dick

Re: Tile Server Plug-Ins for SBuilderX

Posted: Mon May 10, 2010 5:28 am
by meshman
Thank you, Dick.

Re: Tile Server Plug-Ins for SBuilderX

Posted: Mon May 10, 2010 7:20 am
by ananda
Thanks from me too.

Re: Tile Server Plug-Ins for SBuilderX

Posted: Tue May 11, 2010 11:53 pm
by ananda
Hi Dick,

Using the GE plugin I can zoom only to level 18 whereas with GMaps at the same position I can zoom to level 19. Do you have an explanation?

Re: Tile Server Plug-Ins for SBuilderX

Posted: Wed May 12, 2010 2:22 pm
by rhumbaflappy
In Chicago, I can get to level 19 in SBX, so it may be a function of Google, rather than of the DLL. In Google maps, I can get zoom level 20.

I'll look into this. :)

Dick