Work with Geometries

A geometry is the spatial component of a feature—it defines the feature's location and shape.

There are four types of geometry in Geocortex Workflow: point, polyline, polygon, and extent. Every geometry has a type property that you can use to access the geometry's type. The type property is a string with possible values "point", "polyline", "polygon", and "extent".

A feature does not have to have a geometry, but without a geometry, the feature cannot be represented on a map. To accurately represent a geometry on a map, the geometry's spatial reference should be the same as the map's spatial reference. Every geometry has a spatialReference property that you can use to access the geometry's spatial reference.

Each geometry type has additional properties that are specific to that type, for example, points have x and y properties that you can use to access the point's coordinates. The following table lists the properties for each type of geometry.

Properties of Geometries

Type of Geometry

Property

Type

Value

All geometry types

spatialReference

type

esri.SpatialReference (3.x, 4.x)*

String

The spatial reference of the geometry

The type of geometry: "point", "polyline", "polygon", or "extent"

Point

x

y

Number

Number

The x-coordinate of the point

The y-coordinate of the point

Polyline

paths

Number[][][]

A collection of line segments that make up the polyline

Polygon

rings

Number[][][]

A collection of rings that make up the polygon

Extent

center

maxX

maxY

minX

minY

esri.Point (3.x, 4.x)*

Number

Number

Number

Number

The extent's center point

The extent's maximum x-coordinate

The extent's maximum y-coordinate

The extent's minimum x-coordinate

The extent's minimum y-coordinate

* Geocortex Workflow uses different versions of Esri's ArcGIS API for JavaScript depending on the type of application. Web AppBuilder 2D apps and Geocortex HTML5 viewers use version 3.x of the JavaScript API. Web AppBuilder 3D apps use version 4.x.

See also...

Esri Geometry 3.x 4.x

Access a Feature’s Geometry

To access the geometry of a particular feature in a feature set, you can either use an expression or an activity.

Use an Expression to Access a Feature’s Geometry

When you use an expression to access a feature's geometry, the term that you use depends on which activity the feature set came from:

Use an Activity to Access a Feature’s Geometry

The Get Feature Geometry activity gets the geometry for a particular feature. To configure the activity:

  1. In the Features input, specify the feature using one of the forms described in Use an Expression to Access a Feature or its Components.

    For example, if you got the feature set from JSON, set the Features input to an expression similar to: =$featureSet1.featureSet.features[0]

You will be able to access the feature's geometry using a term similar to the following:

$getFeatureGeometry1.geometry

You can get all the geometries from a feature set by using the Get Feature Set Geometries activity.

Set the Geometry for a Feature

The Set Feature Geometry activity assigns a geometry to a feature. To use this activity, the geometry must already exist in the workflow.

To configure the Set Feature Geometry activity:

  1. In the Feature input, specify the feature using one of the forms described in Use an Expression to Access a Feature or its Components.

    For example, if you got the feature set from JSON, set the Features input to an expression similar to: =$featureSet1.featureSet.features[0]

  2. Set the Geometry input to the geometry that you want to assign to the feature.

    For example, if the geometry was output by the Project Geometry activity, set the Geometry input to an expression similar to: =$projectGeometry1.geometry

Create a Point

You can create a point geometry by using the Create Point activity. To configure the Create Point activity, you specify the point's x- and y- coordinates and its spatial reference. If you leave the Spatial Reference input blank, WKID 4326 is used.

The point is returned in the point output. To access the center output, use a term similar to the following in an expression:

$point1.point

Buffer a Geometry

Buffering geometries creates a zone of interest around the geometries. This is useful for finding features within a certain distance of the geometries.

Geocortex Workflow has two activities for buffering geometries: Buffer Geometry and Buffer Geometry (server). Both buffering activities buffer one or more input geometries. The buffer that is output by these activities is itself a geometry, specifically, a polygon.

The Buffer Geometry activity uses Esri's client-side asynchronous geometry engine (3.x 4.x) to perform the buffering, while the Buffer Geometry (server) activity uses Esri's geometry service (3.x 4.x). Because the geometry engine used by the Buffer Geometry activity runs on the client, the Buffer Geometry activity works when the user's device is offline. For the Buffer Geometry (server) activity to work, the user's device must either have network connectivity or run the Geocortex Mobile App Framework.

The Buffer Geometry (server) activity provides more options than the Buffer Geometry activity. For example, Buffer Geometry (server) allows you to control the spatial references used for the operation.

To configure the buffering activities, you use the Geometry input to specify the geometries to buffer and the Distance input to specify the width of the buffer. If the Distance input's units are different than the units of the input geometries, you must specify Distance's units in the Units input.

When you use one of the buffering activities to buffer multiple geometries, you can specify whether to combine the individual output polygons into a single polygon. To combine the polygons, set the Union input to true. If you leave Union blank or set it to false, the activities return a separate polygon for each input geometry.

The buffering activities have two outputs:

Get the Centroid of a Geometry

A centroid is a geometric center point that is calculated from one or more geometries. Centroids are useful for optimizing the distribution of resources relative to the input geometries.

The Get Centroid activity calculates the centroid of one or more input geometries. To configure the Get Centroid activity, you use the Geometry input to specify the geometries whose centroid you want to calculate. If you specify a single geometry, the activity calculates the centroid for that geometry. If you specify multiple geometries, the activity calculates the centroid for the group of geometries.

The Get Centroid activity has one output, centroid, which is a point. To access the centroid output, use a term similar to the following in an expression:

$centroid1.centroid

Get the Extent of a Geometry

The extent of a group of geometries is the minimum and maximum coordinates of the smallest bounding rectangle that encloses the geometries. You can use the extent to zoom the map to particular geometries.

The Get Geometry Extent activity calculates the extent of one or more input geometries. To configure the Get Geometry Extent activity, you use the Geometry input to specify the geometries whose extent you want to calculate. If you specify a single geometry, the activity calculates the extent of that geometry. If you specify multiple geometries, the activity calculates the extent of the group of geometries.

The Get Geometry Extent activity has two outputs, extent and center. The extent output is the extent of the input geometries, which is usually a polygon. Points are the exception—the extent of a point is Null.

To access the extent output, use a term similar to the following in an expression:

$geometryExtent1.extent

The center output is the extent's center point. To access the center output, use a term similar to the following in an expression:

$geometryExtent1.center

© 2018 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 5.9