TerraServer Service
The format of the generated http request string is:
http://terraservice.net/GetImageArea.ashx?t=T&s=S&lon=LON&lat=LAT&w=IW&h=IH
&f=Arial&fs=6&fc=ff000000
Where
T is set to 1 for DOQ imagery
S is set to 10 thru 16 for resolution
Lon is set to the center point’s longitude
Lat is set to the center point’s latitude
IW is set to the image width in pixels
IH is set to image height in pixels
http://terraservice.net/image.aspx?t=1&s=10&x=2512&y=18514&z=16&w=1
TerraServer returns either a Jpeg or GIF image 200 pixels wide by 200 pixels
high. You can also build a larger image with more than one tile by surrounding
the "center tile of reference" with additional tiles.
The TerraServer script file, http://terraserver.microsoft.com/tile.ashx, returns
either a Jpeg or GIF image. All tiles returned are 200 pixels wide by 200 pixels
high.
The tile.ashx script requires five parameters in order to return a 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:
T = 1 or 2
The T parameter identifies the data theme. The value 1 indicates that
you want a USGS DOQ (Digital Ortho Quadrangle) aerial image tile. All
USGS DOQ tiles are Jpeg images. The value 2 indicates you want a USGS
DRG (Digital Raster Graphic) topographic map tile. USGS DRG tiles can
be Jpeg or GIF images.
S = 10, 11, 12, 13, 14, 15, 16, or 17
The S parameter identifies the resolution or "scale" of the image
tile. Scale 10 identifies 1 meter per pixel resolution data. Scale
11 identifies 2 meter per pixel resolution data. Scale 12 identifies
4 meter per pixel resolution data. Data is not available for all
themes in all resolutions.
X = 1 .. 5000
Identifies the tile offset from the western most edge of the UTM
zone. Thus, tiles are numbered left-to-right within a UTM zone.
Tile # X=50 is adjacent to and west of Tile # X=51.
Y = 0 .. 50000
Identifies the tile offset from the southern most edge of the UTM
zone. Thus, tiles are numbered bottom-to-top within a UTM zone.
Tile # Y=2000 is adjacent to and south of Tile # Y=2001.
Z = 1 .. 60
Identifies UTM zone of the data. All USGS data is projected into the
Universe Transverse Mercator projection using the North American
Datam of 1983 (NAD83). UTM zones are 6 degrees wide. Zone 1 begins
at the International Date Line and are sequentially numbered west
to-east. The conterminous United States is in Zone 10 through 19 as
depicted below:
The following is the valid Scale values for each Theme:
Theme: Digital Ortho Quadrangle (photo), Digital Raster Graphic (Topo)
Scale: Value
Resolution: Meters Per Pixel
Theme Scale Resolution UTM Multiplier
DOQ 10 1 200
DOQ,DRG 11 2 400
DOQ,DRG 12 4 800
DOQ,DRG 13 8 1600
DOQ,DRG 14 16 3200
DOQ,DRG 15 32 6400
DOQ,DRG 16 64 12800
DRG 17 128 25600
DRG 18 256 51200
DRG 19 512 102400
Converting TerraServer Tile Parameter Values to UTM Coordinates
All 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.
545,700 / 3200 = 170.53125 = 170 X
4,186,400 / 3200 = 1308.25 = 1308 Y
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.microsoft.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 Another
Simple 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 216 - 14, which equals 22 , which equals 4.
Like before, we drop any fraction. Thus, the 64-meter tile address that
contains the Golden Gate Bridge is X=42, Y=327, Z=10, and S=16.
The math for computing a high resolution tile from a low resolution tile is
similar. Instead of dividing the X and Y value by 2high scale - low scale,
the operation is multiply.
Building a TerraServer image larger than 200 x 200 pixels
We 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 (400 x 200 pixel), medium (600 x 400 pixel), and large (800 x
600 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:
X=2902 Y=22524 Z=18 S=10 | X=2903 Y=22524 Z=18 S=10 | X=2904 Y=22524 Z=18 S=10
X=2902 Y=22523 Z=18 S=10 | X=2903 Y=22523 Z=18 S=10 | X=2904 Y=22523 Z=18 S=10
When forming HTML tables, make sure you set the table's border, cellspacing,
and cellpadding properties to zero (0).