Pyramid SDK Reference

Core Classes๐Ÿ”—

The following are the core classes of the SDK, and source code is provided for all of them. They are encapsulated in the Sdk.Core project.

ClassDescription
BoundaryDefines a bounding rectangle.
ConstantsDefines a range of global constants.
DataColorMapImplements IColorMap, to generate color pixels corresponding to latitude and longitude from the source grid.
DataGridImplements IGrid, providing a two dimensional array of data.
DemPlateFileGeneratorImplements IDemPlateFileGenerator, to produce a single file containing all the DEM data tiles.
DemTileSerializerImplements IDemTileSerializer to save and load DEM tiles on the file system.
EnumsDefines the global enumerations.
EquirectangularGridMapImplements IProjectionGridMap, using equirectangular projection.
HelperDefines a few utility methods related to unit conversions.
ImageColorMapImplements IColorMap, and references IProjectionGridMap.
ImageGridImplements IGrid, providing a two dimensional array of image data.
ImageTileSerializerImplements IImageTileSerializer to save and load image tiles on file system.
MercatorDemTileCreatorImplements ITileCreator to create Mercator DEM tiles.
MercatorTileCreatorImplements ITileCreator to create Mercator image tiles.
MultipleDemPlateFileGeneratorImplements IDemPlateFileGenerator, to produce multiple DEM plate files containing DEM data tiles.
MercatorPlateFileDetailsUsed to calculate and store the details of multiple plate files.
MultiplePlateFileGeneratorImplements IPlateFileGenerator to produce multiple plate files containing image tiles.
MultiTileCreatorImplements ITileCreator for different tile creator instances.
OctTileMapDefines an octahedral tile map.
PlateFileDefines utility methods for plate file operations.
PlateFileGeneratorImplements IPlateFileGenerator, used to create plate files.
PlateFileHelperDefines a range of utility methods for plate files.
TileSimple class holding tile coordinates.
TileChopperImplements ITileCreator to create image tiles without changing the projection.
TileCreatorFactoryCreates an image or DEM tile creator instance for the specified projection type.
TileGeneratorThis class contains the main control/workflow code for the tile generation process.
TileHelperDefines a range of utility methods for tiles and bitmaps.
ToastDemTileCreatorImplements ITileCreator to create Toast DEM tiles.
ToastHelperHelper class, in particular working with Toast coordinates.
ToastTileCreatorImplements ITileCreator to create Toast image tiles.
WtmlCollectionDefines a new Wtml collection, a WorldWide Telescope data file.

Interfaces๐Ÿ”—

The Tile Pyramid SDK requires that the following interfaces are implemented.

InterfaceDescription
IColorMapUsed to retrieve color data.
IDemPlateFileGeneratorUsed to generate plate files for DEM tiles (plate files are single files containing all or part of a tile pyramid for easy copying, sharing and backup).
IDemTileSerializerUsed to serialize and deserialize (save and load) DEM data.
IElevationMapUsed to retrieve elevation data.
IGridUsed to read source data into a source grid which can be accessed using UV or XY co-ordinates.
IImageTileSerializerUsed to serialize and deserialize (save and load) image data.
IPlateFileGeneratorUsed to generate plate files for image tiles (plate files are single files containing all or part of a tile pyramid for easy copying, sharing and backup).
IProjectionGridMapUsed to query the data grid based on the projection.
ITileCreatorUsed to build the tile pyramids.

IColorMap Interface๐Ÿ”—

The IColorMap interface is used to retrieve color data, and exposes the following methods. It does not inherit from another interface.

MethodDescription
GetColorRetrieves the color corresponding to a longitude and latitude.

Implemented in Classes๐Ÿ”—

IColorMap.GetColor๐Ÿ”—

The GetColor method retrieves the color corresponding to a longitude and latitude.

Syntax๐Ÿ”—

Color GetColor(
  double longitude,
  double latitude
);

Parameters๐Ÿ”—

  • longitude โ€” Specifies longitude in decimal degrees.
  • latitude โ€” Specifies latitude in decimal degrees.

Return Values๐Ÿ”—

The method returns a Color object, containing the color of the pixel at the given latitude and longitude.

Remarks๐Ÿ”—

Typically the color returned comes from the source image. Note the order of the parameters, longitude first.


IDemPlateFileGenerator Interface๐Ÿ”—

The IDemPlateFileGenerator interface is used to generate plate files for DEM tiles (plate files are single files containing all or part of a tile pyramid for easy copying, sharing and backup). It does not inherit from another interface.

MethodDescription
CreateFromDemTileUsed to create a plate file from a DEM tile pyramid.
PropertyTypeGet/SetDescription
TilesProcessedlongGet only.Number of tiles for the level that have been processed.

Implemented in Classes๐Ÿ”—

IDemPlateFileGenerator.CreateFromDemTile๐Ÿ”—

The CreateFromDemTile method is used to create a plate file from a DEM tile pyramid.

Syntax๐Ÿ”—

void CreateFromDemTile(
  IDemTileSerializer serializer
);

Parameters๐Ÿ”—

Return Values๐Ÿ”—

The method does not return a value.

Remarks๐Ÿ”—

None.


IDemTileSerializer Interface๐Ÿ”—

The IDemTileSerializer interface is used to serialize and deserialize (save and load) DEM data, and exposes the following methods. It does not inherit from another interface.

MethodDescription
DeserializeDeserializes a binary object from the file system.
SerializeSerializes the binary file to the file system.

Implemented in Class๐Ÿ”—

IDemTileSerializer.Deserialize๐Ÿ”—

The Deserialize method deserializes (loads) a DEM tile from the file system.

Syntax๐Ÿ”—

short[] Deserialize(
  int level,
  int tileX,
  int tileY
);

Parameters๐Ÿ”—

  • level โ€” Specifies the tile level, from zero to the maximum level for the data.
  • tileX โ€” Specifies the X index of the tile in the tile pyramid.
  • tileY โ€” Specifies the Y index of the tile in the tile pyramid.

Return Values๐Ÿ”—

The method returns an array of short values, containing the binary data.

Remarks๐Ÿ”—

The size of a DEM tile is fixed depending on the projection, refer to the remarks for Serialize.

IDemTileSerializer.Serialize๐Ÿ”—

The Serialize method serializes (saves) the DEM tile to the file system.

Syntax๐Ÿ”—

void Serialize(
  short[] tile,
  int level,
  int tileX,
  int tileY
);

Parameters๐Ÿ”—

  • tile โ€” Specifies the array of values that make up the DEM tile.
  • level โ€” Specifies the tile level, from zero to the maximum level for the data.
  • tileX โ€” Specifies the X index of the tile in the tile pyramid.
  • tileY โ€” Specifies the Y index of the tile in the tile pyramid.4

Return Values๐Ÿ”—

The method does not return a value.

Remarks๐Ÿ”—

The size of a DEM tile is fixed depending on the projection, for Mercator it is 1089 values (33 rows of 33), organized by rows. Refer to the MercatorDemTileCreator class. For TOAST it is 513 values, these values are not in a perfect grid. Refer to the static tables listed first in the ToastDemTileCreator class.


IElevationMap Interface๐Ÿ”—

The IElevationMap interface is used to retrieve elevation data, and exposes the following methods. It does not inherit from another interface.

MethodDescription
GetElevationRetrieves the elevation corresponding to the longitude and latitude.

Implemented in Class๐Ÿ”—

This interface is implemented in the ShadedReliefColorMap class in the SpecificRegionDataSet sample.

IElevationMap.GetElevation๐Ÿ”—

The GetElevation method retrieves the elevation corresponding to the longitude and latitude.

Syntax๐Ÿ”—

short GetElevation(
  double longitude,
  double latitude
);

Parameters๐Ÿ”—

  • longitude โ€” Specifies longitude in decimal degrees.
  • latitude โ€” Specifies latitude in decimal degrees.

Return Values๐Ÿ”—

The method returns a short, containing the elevation value.

Remarks๐Ÿ”—

Note the order of the parameters, longitude first.


IGrid Interface๐Ÿ”—

The IGrid interface is used to read source data into a source grid which can be accessed using UV or XY co-ordinates. It does not inherit from another interface.

MethodDescription
GetValueRetrieves the value contained at the specified coordinate.
GetValueAtRetrieves the value contained at the specified pixel location.
GetXIndexRetrieves the X pixel index for the given coordinate.
GetYIndexRetrieves the Y pixel index for the given coordinate.
PropertyTypeGet/SetDescription
HeightintGet/SetHeight of the grid.
WidthintGet onlyWidth of the grid.

Implemented in Classes๐Ÿ”—

IGrid.GetValue๐Ÿ”—

The GetValue method retrieves the value contained at the specified coordinate.

Syntax๐Ÿ”—

double GetValue(
  double u,
  double v
);

Parameters๐Ÿ”—

  • u โ€” Specifies u coordinate.
  • v โ€” Specifies v coordinate.

Return Values๐Ÿ”—

The method returns a double, containing the value for the given coordinate.

Remarks๐Ÿ”—

UV coordinates are floating point in the range 0 to 1. The top left hand corner of the map is 0,0.

IGrid.GetValueAt๐Ÿ”—

The GetValueAt method retrieves the value contained at the specified pixel location.

Syntax๐Ÿ”—

double GetValueAt(
  int i,
  int j
);

Parameters๐Ÿ”—

  • i โ€” Specifies X index.
  • j โ€” Specifies Y index.

Return Values๐Ÿ”—

The method returns a double, containing the value.

Remarks๐Ÿ”—

These coordinates are in pixels, from 0 to the full width or height of the map. The top left hand corner of the map is 0,0.

IGrid.GetXIndex๐Ÿ”—

The GetXIndex method retrieves the X pixel index for the given u coordinate.

Syntax๐Ÿ”—

int GetXIndex(
  double u
);

Parameters๐Ÿ”—

  • u โ€” Specifies u coordinate in decimal degrees.

Return Values๐Ÿ”—

The method returns an int, containing the X pixel value for the given coordinate.

Remarks๐Ÿ”—

The U coordinate is in the range 0 to 1.

IGrid.GetYIndex๐Ÿ”—

The GetYIndex method retrieves the Y pixel index for the given V coordinate.

Syntax๐Ÿ”—

int GetYIndex(
  double v
);

Parameters๐Ÿ”—

  • v โ€” Specifies v coordinate in decimal degrees.

Return Values๐Ÿ”—

The method returns an int, containing the Y pixel value for the given coordinate.

Remarks๐Ÿ”—

The V coordinate is in the range 0 to 1.


IImageTileSerializer Interface๐Ÿ”—

The IImageTileSerializer interface is used to serialize and deserialize (save and load) image data, and exposes the following methods.

MethodDescription
DeserializeDeserializes an image from the file system.
SerializeSerializes the image to the file system.

Implemented in Class๐Ÿ”—

ImageTileSerializer

IImageTileSerializer.Deserialize๐Ÿ”—

The Deserialize method deserializes (loads) an image from the file system.

Syntax๐Ÿ”—

Bitmap Deserialize(
  int level,
  int tileX,
  int tileY
);

Parameters๐Ÿ”—

  • level โ€” Specifies the tile level, from zero to the maximum level for the data.
  • tileX โ€” Specifies the X index of the tile in the tile pyramid.
  • tileY โ€” Specifies the Y index of the tile in the tile pyramid.

Return Values๐Ÿ”—

The method returns a Bitmap, containing the binary image.

Remarks๐Ÿ”—

Indexes of the tile pyramid are zero based. The size of an image tile is fixed at 256ร—256 pixels.

IImageTileSerializer.Serialize๐Ÿ”—

The Serialize method serializes (saves) the tile image to the file system.

Syntax๐Ÿ”—

void Serialize(
  Bitmap tile,
  int level,
  int tileX,
  int tileY
);

Parameters๐Ÿ”—

  • tile โ€” Specifies the Bitmap for the tile.
  • level โ€” Specifies the tile level, from zero to the maximum level for the data.
  • tileX โ€” Specifies the X index of the tile in the tile pyramid.
  • tileY โ€” Specifies the Y index of the tile in the tile pyramid.

Return Values๐Ÿ”—

The method does not return a value.

Remarks๐Ÿ”—

Indexes of the tile pyramid are zero based. The size of an image tile is fixed at 256 x 256 pixels.


IPlateFileGenerator Interface๐Ÿ”—

The IPlateFileGenerator interface is used to generate plate files for image tiles (plate files are single files containing all or part of a tile pyramid for easy copying, sharing and backup). It does not inherit from another interface.

MethodDescription
CreateFromImageTileUsed to create a plate file from an image tile pyramid.

Properties๐Ÿ”—

PropertyTypeGet/SetDescription
TilesProcessedlongGet only.Number of tiles for the level that have been processed.

Implemented in Classes๐Ÿ”—

IPlateFileGenerator.CreateFromImageTile๐Ÿ”—

The CreateFromImageTile method is used to create a plate file from an image tile pyramid.

Syntax๐Ÿ”—

void CreateFromImageTile(
  IImageTileSerializer serializer
);

Parameters๐Ÿ”—

Return Values๐Ÿ”—

The method does not returns a value.

Remarks๐Ÿ”—

The image pyramid must be created before a plate file can be generated. Plate files are single files that make it easier to send or archive the tile pyramid.


IProjectionGridMap Interface๐Ÿ”—

The IProjectionGridMap interface is used to query the data grid based on the projection. It does not inherit from another interface.

MethodDescription
GetValueRetrieves the value contained at the specified coordinate.
GetXIndexRetrieves the X pixel index for the given coordinate.
GetYIndexRetrieves the Y pixel index for the given coordinate.
IsInRangeRetrieves a Boolean indicating whether a given coordinate falls within the scope of the map.

Properties๐Ÿ”—

PropertyTypeGet/SetDescription
InputBoundaryBoundaryGet onlyBounding box of the map.
InputGridIGridGet onlyThe source grid for the map.

Implemented in Class๐Ÿ”—

IProjectionGridMap.GetValue๐Ÿ”—

The GetValue method retrieves the value contained at the specified coordinate.

Syntax๐Ÿ”—

double GetValue(
  double longitude,
  double latitude
);

Parameters๐Ÿ”—

  • longitude โ€” Specifies longitude in decimal degrees.
  • latitude โ€” Specifies latitude in decimal degrees.

Return Values๐Ÿ”—

The method returns a double, containing the value for the given coordinate, depending on the projection.

Remarks๐Ÿ”—

Note the order of the parameters, longitude first.

IProjectionGridMap.GetXIndex๐Ÿ”—

The GetXIndex method retrieves the X pixel index for the given longitude.

Syntax๐Ÿ”—

int GetXIndex(
  double longitude
);

Parameters๐Ÿ”—

  • longitude โ€” Specifies longitude in decimal degrees.

Return Values๐Ÿ”—

The method returns an int, containing the X pixel value for the given longitude, depending on the projection.

Remarks๐Ÿ”—

None.

IProjectionGridMap.GetYIndex๐Ÿ”—

The GetYIndex method retrieves the Y pixel index for the given latitude.

Syntax๐Ÿ”—

int GetYIndex(
  double latitude
);

Parameters๐Ÿ”—

  • latitude โ€” Specifies latitude in decimal degrees.

Return Values๐Ÿ”—

The method returns an int, containing the Y pixel value for the given latitude, depending on the projection.

Remarks๐Ÿ”—

None.

IProjectionGridMap.IsInRange๐Ÿ”—

The IsInRange method retrieves a Boolean indicating whether a given coordinate falls within the scope of the map.

SySyntax๐Ÿ”—

bool IsInRange(
  double longitude,
  double latitude
);

Parameters๐Ÿ”—

  • longitude โ€” Specifies longitude in decimal degrees.
  • latitude โ€” Specifies latitude in decimal degrees.

Return Values๐Ÿ”—

The method returns a bool.

Remarks๐Ÿ”—

Note the order of the parameters, longitude first.


ITileCreator Interface๐Ÿ”—

The ITileCreator interface is used to build the tile pyramids, and exposes the following methods. It does not inherit from another interface.

MethodDescription
CreateCreates tiles of the pyramid at the specified level.
CreateParentCreate tiles of the pyramid at the parent of the specified level.

Properties๐Ÿ”—

PropertyTypeGet/SetDescription
ProjectionTypeProjectionTypesGet only.Specifies or retrieves the projection type, one of: Toast, Mercator

Implemented in Classes๐Ÿ”—

ITileCreator.Create๐Ÿ”—

The Create method creates tiles of the pyramid at the specified level.

Syntax๐Ÿ”—

void Create(
  int level,
  int tileX,
  int tileY
);

Parameters๐Ÿ”—

  • level โ€” Specifies the tile level, from zero to the maximum level for the data.
  • tileX โ€” Specifies the X index of the tile in the tile pyramid.
  • tileY โ€” Specifies the Y index of the tile in the tile pyramid.

Return Values๐Ÿ”—

This method does not return a value.

Remarks๐Ÿ”—

If the input to this method was Create(N,X,Y), the output would be the tile with coordinates (X,Y) at level N.

ITileCreator.CreateParent๐Ÿ”—

The CreateParent method creates tiles for the parent of the specified level.

Syntax๐Ÿ”—

void CreateParent(
  int level,
  int tileX,
  int tileY
);

Parameters๐Ÿ”—

  • level โ€” Specifies the tile level, from zero to the maximum level for the data.
  • tileX โ€” Specifies the X index of the tile in the tile pyramid.
  • tileY โ€” Specifies the Y index of the tile in the tile pyramid.

Return Values๐Ÿ”—

This method does not return a value.

Remarks๐Ÿ”—

If the input to this method was CreateParent(N,X,Y), the output would be the tile with coordinates (X/2,Y/2) at level N-1.