Link to TerraServer Using HTMLThis page describes how to include TerraServer imagery or topographical map images on your web page. All USGS imagery on TerraServer is public domain data. Thus you can include TerraServer tiles on your own web pages! We do ask that you give visible credit to the US Geological Survey. On your web page, create an <img src> tag that references the TerraServer image tile you wish to include on your web page. The TerraServer script file, http://terraserver-usa.com/tile.ashx, returns either a Jpeg or GIF image. All tiles returned are 200 pixels wide by 200 pixels high. For example, use the <img src> tag in your web page to include a copy of the Statue of Liberty on your web page. You can also use the <a href> tag to link your image to the TerraServer image page.
Image courtesy of the US Geological Survey The tile.ashx script requires five parameters in order to return a Jpeg or GIF image -- T (data theme), S (image scale), X (relative tile on x-axis), Y (relative tile on y-axis), Z (UTM zone number). Each parameter requires a digit string as follows:
The following is the valid Scale values for each Theme. The diagram on the right shows how the zones sub-divide the conterminous United States.
Converting TerraServer Tile Parameter Values to UTM CoordinatesAll USGS imagery stored in TerraServer is projected in UTM NAD83. The X and Y tile identifiers can easily be converted to the UTM coordinates by multiplying the X and Y tile identifier by the muliplier value associated with the Scale number. For example, the one-meter resolution Statue of Liberty tile has an X tile value of 2903, a Y tile value of 22523. The Scale 10 multiplier is 200 and a Z value of 18. Thus the UTM address of the tile is 580600 easting (2903 X 200), 4504600 northing (22523 X 200) in UTM zone 18. It is the lower left hand corner point of the tile that has this address. The other corner points can be calculated by adding the multiplier to the easting and northing values. If you have a UTM easting, northing, and zone value, then you can compute the TerraServer tile address by doing the reverse calculation. Say you knew the Golden Gate Bridge was at 545,700 easting, 4,186,400 northing, and in zone 10. What would the 16-meter resolution tile address be? The answer is to divide the easting and northing UTM value and "drop" any fraction.
Thus the UTM address 545,700 easting, 4,186,400 northing, and zone 10 would equate to the TerraServer tile address X=170, Y=1308 and Z=10. Try clicking on http://terraserver-usa.com/image.aspx?T=1&S=14&X=170&Y=1308&Z=10&W=0 to see if our example works. Converting TerraServer Tile Addresses from One Resolution to AnotherSimple arithmetic can be applied to a Tile's X and Y value to compute the parent (lower resolution tile) or child tile (higher resolution tile). Using our Golden Gate Bridge example, suppose we wanted to view the Golden Gate Bridge at 32 meter resolution. What would the tile address be?
To go from a high resolution tile to a lower resolution tile, simply divide by
2 raised to the difference in the low resolution scale number minus the high
resolution scale number. In our example, the 16-meter tile address is X=170,
Y=1308, Z=10, and S=14. The Scale value for 64-meter tile is 16. Thus we divide
the X and Y value by 2
The math for computing a high resolution tile from a low resolution tile is
similar. Instead of dividing the X and Y value by 2 Building a TerraServer image larger than 200 x 200 pixelsWe picked 200 x 200 pixel tiles on TerraServer so that we could dynamically change the size of an image on an HTML web page. On the TerraServer web site, we offer small (600 x 400 pixel), medium (800 x 600 pixel), and large (1000 x 800 pixel) image sizes. We use HTML table format several 200 x 200 pixel tiles together to form a small, medium, or large image. To build a web page with more than one image tile, our code begins to surround the "center tile of reference" with additional tiles. The logic in our code simply subtracts or adds one to the X and Y address to compute the adjacent tiles. The "center tile of reference" in our Statue of Liberty example at the top of this page is X=2903, Y=22523, Z=18 and S=10 (1-meter resolution). A medium size image in the TerraServer application requires a table of 2 rows with 3 tiles each. The "center tile of reference" would be the middle tile on the second row. The following is the tile addresses of the "center tile of reference" (displayed in red), and the surrounding tiles:
The resulting image looks like this:
When forming HTML tables like the one above, make sure you set the table's border, cellspacing, and cellpadding properties to zero (0). |