In logic, a
Geometry is an object that can be used to display and manipulate vector geometry: points, lines, and polygons. The
Geometry object can load and save data in GeoJSON format. You can display the geometry on a map, interactively trace polygons on a map, and compute the area and perimeter of polygons.
Note that displaying geometry on a map and polygon tracing are currently only supported on Android. These functions will do nothing when run on Windows.
Function | Description |
load | Read geometry from a GeoJSON file. |
save | Write geometry to a GeoJSON file. |
clear | Delete all data from the geometry. |
tracePolygon | Allow user to draw polygon by tapping points on a map. (Android only.) |
walkPolygon | Allow user to draw polygon by walking the perimeter and saving the locations using the GPS. (Android only.) |
area | Compute the area of a polygon. |
perimeter | Compute the perimeter of a polygon. |
maxLatitude | Get the largest latitude value of the geometry. |
maxLongitude | Get the largest longitude value of the geometry. |
minLatitude | Get the smallest latitude value of the geometry. |
minLongitude | Get the smallest longitude value of the geometry. |
getProperty | Retrieve one of the geometry's properties. |
setProperty | Set the value of one of the geometry's properties. |
|
getLabel | Returns the symbol's label. |
getName | Returns the symbol's name. |
getJson | Returns the symbol's metadata and value represented in JSON. |
getValueJson | Returns the symbol's value represented in JSON. |
updateValueFromJson | Modifies the symbol based on a JSON representation of the value. |
Geometry objects can be assigned to other Geometry objects, which will replace the vector geometry with the contents from the assigned Geometry object.
geometry_name = another_geometry_name;
It is also possible to assign Geometry objects to a
Document:
document_name = geometry_name;
You can also make the reverse assignment, assigning a Document to a Geometry object. A runtime error will occur if the Document's data was not valid geometry data.
geometry_name = document_name;
// Declare a geometry
Geometry mygeometry;
// Capture polygon
mygeometry.tracePolygon();
// Compute the area of the captured polygon
AREA = mygeometry.area();
// Save the geometry to a file
mygeometry.save("polygon.geojson");