Map Class
The map of a region: its layers, read from the files of the map when they are loaded.
public abstract class MapRemarks
The positions are longitudes and latitudes, in degrees (WGS 84).
The properties that MapLayer documents have the same type in every format: a format that does not store the types, such as GeoJSON, where every number is a Double, gets the documented types, such as an Int32 for the rank of a city. The other properties are returned as the format reads them.
Constructors
| Name | Description |
|---|---|
| Map(MapMetadata) | Initializes a new instance of the Map class. |
Map(MapMetadata)
Map.csInitializes a new instance of the Map class.
protected Map(MapMetadata metadata)Parameters
metadataMapMetadata- The description of the map.
Properties
| Name | Description |
|---|---|
| Attribution | Gets the attribution the licenses of the data require, to show on the maps, or null when the metadata of the map has none. |
| Bounds | Gets the bounds of the region: the box of its borders, which the other layers are cut to. It comes from the metadata of the map, else from the MapLayer.Borders layer; null without either. |
| Layers | Gets the layers the map has: the layers whose source has nothing in the region, such as the coastline of a country without sea, are not there. |
| Metadata | Gets the description of the map, as its files store it. |
| Name | Gets the name of the region, from the metadata of the map, else Map.Region. |
| Region | Gets the name of the region in its catalog, such as World, Europe or Switzerland. |
Attribution
Map.csBounds
Map.csGets the bounds of the region: the box of its borders, which the other layers are cut to. It comes from the metadata of the map, else from the MapLayer.Borders layer; null without either.
public GeoBounds? Bounds { get; }Layers
Map.csGets the layers the map has: the layers whose source has nothing in the region, such as the coastline of a country without sea, are not there.
public IReadOnlyList<MapLayer> Layers { get; }Property value
Metadata
Map.csGets the description of the map, as its files store it.
public MapMetadata Metadata { get; }Property value
Name
Map.csGets the name of the region, from the metadata of the map, else Map.Region.
public string Name { get; }Property value
Region
Map.csMethods
| Name | Description |
|---|---|
| HasLayer(MapLayer) | Gets a value that indicates whether the map has a layer. |
| Load(MapLayer) | Reads the features of a layer. |
| Load(MapLayer, GeoBounds) | Reads the features of a layer whose bounds intersect a box, such as the cities of the part of the region a map shows. |
| LoadLayer(MapLayer, GeoBounds?) | Reads the features of a layer the map has. |
HasLayer(MapLayer)
Load overloads
Load(MapLayer)
Map.csReads the features of a layer.
public GeoFeatureCollection Load(MapLayer layer)Parameters
layerMapLayer- The layer.
Returns
GeoFeatureCollection The features, in a collection named after the layer.
Exceptions
ArgumentOutOfRangeExceptionlayeris not a layer.KeyNotFoundException- The map does not have the layer.
FormatException- The layer is not valid.
Load(MapLayer, GeoBounds)
Map.csReads the features of a layer whose bounds intersect a box, such as the cities of the part of the region a map shows.
public GeoFeatureCollection Load(MapLayer layer, GeoBounds bounds)Parameters
Returns
GeoFeatureCollection The features, in a collection named after the layer. They are not cut to the box: use GeoGeometry.Clip to cut them.
Exceptions
ArgumentOutOfRangeExceptionlayeris not a layer.KeyNotFoundException- The map does not have the layer.
FormatException- The layer is not valid.
LoadLayer(MapLayer, GeoBounds?)
Reads the features of a layer the map has.
protected abstract IEnumerable<GeoFeature> LoadLayer(MapLayer layer, GeoBounds? bounds)Parameters
layerMapLayer- The layer, one that
Map.HasLayerreports. boundsGeoBounds?- The box the features must intersect, or
nullfor every feature. The result can have more features, such as the features a spatial index finds:Map.Loadkeeps those whose bounds intersect the box.
Returns
IEnumerable<GeoFeature> The features.
Exceptions
FormatException- The layer is not valid.