Generic raster data
In addition to Elevation Data, Maria GDK also supports generic single channel raster data for analysis and visualization purposes. These data sets can for example include clutter data, building heights census, or other statistical geodata.
The main interface for this functionality is the IGenericRasterDataset with the default implementation GenericRasterDataset in the TPG.GeoFramework.MapLayer assembly.
/// <summary>
/// A generic single channel raster dataset consisting of a set of data layers according
/// to a programmable data query. Can be used to query data values in geographical positions.
/// </summary>
public interface IGenericRasterDataset
{
/// <summary>
/// Unique ID for this dataset.
/// </summary>
string Id { get; }
/// <summary>
/// Map content type for data in this set.
/// </summary>
MapContentType ContentType { get; set; }
/// <summary>
/// Data query to sort and filter data layers in this set.
/// </summary>
IGenericRasterLayerQuery DataLayerQuery { get; set; }
/// <summary>
/// Underlying ElevationData interface.
/// </summary>
IElevationData ElevationData { get; }
/// <summary>
/// Underlying ElevationDataManager interface.
/// </summary>
IElevationDataManager ElevationDataManager { get; }
/// <summary>
/// Initialize data layers from template specification.
/// </summary>
/// <param name="dataProvider"></param>
void SetFromRasterDataProvider(TemplateRasterDataProvider dataProvider);
/// <summary>
/// Query a geographical point for data values. The topmost layer which covers this
/// geo point is returned.
/// </summary>
/// <param name="lat">Input latitude of the query point.</param>
/// <param name="lon">Input longitude of the query point.</param>
/// <param name="queryParams">Query parameters</param>
/// <returns>A RasterValueResult with value, status and layer info.</returns>
RasterValueResult CalcRasterValue(double lat, double lon, RasterQueryParams queryParams);
/// <summary>
/// Query a geographical point for data valuyes. All layers intersecting this geo point
/// will be returned.
/// </summary>
/// <param name="lat">Input latitude of the query point.</param>
/// <param name="lon">Input longitude of the query point.</param>
/// <param name="queryParams">Query parameters</param>
/// <returns>A list of RasterValueResults for all intersecting layers.</returns>
List<RasterValueResult> CalcRasterValues(double lat, double lon, RasterQueryParams queryParams);
/// <summary>
/// Calculate a raster of values inside the given raster projector.
/// </summary>
/// <param name="rp">Raster projector defining the geographical area, projection and resolution of the raster. </param>
/// <param name="queryParams">Query parameters.</param>
/// <returns>A raster of single channel float values covering the given raster projector.</returns>
BitmapFloatData CalcRasterMap(IRasterProjector rp, RasterQueryParams queryParams);
/// <summary>
/// Generate layers from the current data layer query. This method should be called
/// before doing and data queries.
/// </summary>
void UpdateDataSources();
}
The generic raster data interface is actually a wrapper around the IElevationData and IElevationDataManager interfaces, and you have access to these lower level interfaces as well for more advanced purposes.
This means that the IGenericRasterData interface can be used for most analysis and visualization purposes in MariaGDK, such as elevation profiles and Color Map Layers.
Example
The following example illustrates how to set up a raster data set for clutter data and querying a point.
var clutterData = new GenericRasterDataset(_tileCacheManager, MapCatalogServiceClient)
{
ContentType = MapContentType.GenericData
};
var rasterLayerQuery = new GenericRasterLayerQuery();
rasterLayerQuery.Tags.Add("clutter");
clutterData.DataLayerQuery = rasterLayerQuery;
clutterData.UpdateDataSources();
var result = clutterData.CalcRasterValue(60, 10, new RasterQueryParams() { interpolationMethod = InterpolationMethod.Nearest });
_log.DebugFormat("clutter value = {0}, status = {1}, layer = {2}", result.Value, result.Status, result.MapEntry.MapSignature);