
Next Post
Creating and registering a custom dataset for detailed information
Create and register custom datasets. Learn how to integrate your own proprietary data reader in Carmenta Engine.
View Post
In Carmenta Engine we define data flows by linking operators together. An operator reads features from its input, processes or manipulates those features and pass the result to the next operator. In the typical case, operators are added and configured in a configuration file and calls are managed by the map view without direct user interaction with the operators. However, in some cases a more custom approach is necessary and the application need to access the processed features directly in code. For example, the application may want to display information produced by the operators or an external component (or service) may want to use the result as input. In this article, we will explain how to approach such use-case. All codes and pictures shown in this article are from the sample that can be downloaded here.
The first step is to get the operator chain set up in your application, there are two ways to do this:

Configuration routingConfig = new Configuration("bathymetry_routing.px");
Operator terrainRouteOperator = routingConfig.GetPublicObject("TerrainRouteOperator0") as Operator
The second step is to call the getFeatures function which retrieves all features produced by the operator chain. The number of features returned depends on the operator used, check the documentation for information on specific operators. When called from code, the result will be returned as a FeatureEnumerator object allowing you to enumerate over all features in the result.
Additionally, depending on the operator called, the features may get new attributes. The documentation indicates if a feature is updated with new attributes and what information these attributes holds.
Note: The getFeatures function also exist on DataSet and Layer classes. Providing the same functionality, retrieving features directly in code.
Calling the getFeatures function with a Crs will return features projected to the coordinate reference system (CRS) specified.
Before choosing a CRS it is good practice to check the documentation about the operator to understand how it works and in which CRS it usually output its result. Using an appropriate CRS help getting accurate result; for example a VerticalProfileOperator usually expect a NonGeoreferenced CRS and an EllipseOperator use the CRS of the View.
In the code below, result will contain all features produced by the operator.
FeatureEnumerator result = terrainRouteOperator.GetFeatures(Crs.Wgs84LongLat);
The featureQuery parameter will limit the number of returned features. Only the features matching the query will go through, all others will be discarded. To limit the number of features returned you can use the following properties:
In the code below, result will only contain the features with the attribute isLastLeg set to true (see documentation about TerrainRouteOperator for more information about the attribute)
FeatureQuery featureQuery = new FeatureQuery();
featureQuery.Condition = new Condition("isLastLeg = true");
FeatureEnumerator result = terrainRouteOperator.GetFeatures(Crs.Wgs84LongLat, featureQuery);
The sample describes a simple use-case where a TerrainRouteOperator and the getFeatures method are used in the code to determine the travel time from start to finish and display it in the UI.
To use the sample:

Create and register custom datasets. Learn how to integrate your own proprietary data reader in Carmenta Engine.
View Post
Explore how Carmenta Engine manages geographical coordinates with efficient CRS transformations. Includes advanced use cases and best practice guidance.
View Post