Feature Class
Represents an object with a geographical position and a set of attributes.
NuGet/Assembly: Carmenta.Engine.5.17.0.nupkg (in the CECore assembly)
Syntax
public class Feature : EngineObjectRemarks
A Feature represents an object with a geographical position and a set of attributes. The position of a Feature consists of a Geometry and a Crs that the geometry is defined in. The Attributes property holds a set of named values that are associated with a Feature.
Carmenta Engine does not currently support features with a multi geometry and attempts to create a Feature with a MultiLineGeometry, MultiPointGeometry, MultiPolygonGeometry or MultiGeometry will result in an exception being thrown.
Example
// Create a Feature to represent a city at a specific longitude and latitude
public static Feature CreateCityFeature(double longitude, double latitude,
string name, int population)
{
// Create the feature at the specified position
Feature city = new Feature(
new PointGeometry(new Point(longitude, latitude)),
Crs.Wgs84LongLat);
// Set the city specific attributes. If a large number of features
// are being created it is more efficient to cache the atoms, NAME
// and POPULATION, that specify the attribute names and reuse them
// instead of creating a new Atom each time an attribute is set.
city.Attributes["NAME"] = name;
city.Attributes["POPULATION"] = population;
// Return the feature that represents the city
return city;
}
Inheritance Hierarchy
System.Object
EngineObject
Feature
Platforms
Windows, Linux, Android
Feature Members
The Feature type has the following members.
Constructors
| Name | Description |
|---|---|
| Feature | Initializes a new instance of the Feature class. |
Properties
| Name | Description |
|---|---|
| Attributes | Gets the set of attributes this Feature is associated with. |
| Crs | Gets the Crs the geometry of the feature is defined in. |
| Geometry | Gets the Geometry that defines the position of this feature. |
| GeometryType | Gets a value that tells what kind of Geometry is associated with the Feature. |
| Id | Gets the identity of the Feature. |
| IsDisposed | Gets a value that tells whether the current Feature has been disposed. Inherited from EngineObject |
| IsReadOnly | Gets a value that tells whether the Feature is marked as read-only. |
| NativeHandle | Gets the native Carmenta Engine kernel object the current Feature represents. Inherited from EngineObject |
Methods
| Name | Description |
|---|---|
| CalculateBounds | Overloaded. Calculates the bounding rectangle of this Feature. |
| Clone | Creates a copy of an object. Inherited from EngineObject |
| Dispose | Releases the reference to the native Carmenta Engine kernel instance the EngineObject represents. Inherited from EngineObject |
| Equals | Determines whether this instance is equal to another. Inherited from EngineObject |
| EstimateMemoryUsage | Estimates how many bytes are used to represent this Feature. |
| Initializes a new instance of the Feature class from the specified binary data. | |
| GetGeometryAsLine | Gets the geometry as a LineGeometry. |
| GetGeometryAsMesh | Gets the geometry as a MeshGeometry. |
| GetGeometryAsPoint | Gets the geometry as a PointGeometry. |
| GetGeometryAsPolygon | Gets the geometry as a PolygonGeometry. |
| GetGeometryAsRaster | Gets the geometry as a RasterGeometry. |
| MoveOnEarthAsCompass | Moves the Feature while keeping its true size and shape on Earth. |
| ProjectTo | Overloaded. Reprojects this feature into another coordinate reference system. |
| Save | Saves this feature to a binary representation. |