• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • Data Requirements
      • CSPro Program Structure
      • Programming Standards
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
        • Compiler Mode
        • Variables
        • Alias Statement
        • User-Defined Functions
        • Array Object
        • Audio Object
        • Case Object
        • Document Object
        • File Object
        • Freq Object
        • Geometry Object
        • HashMap Object
        • Image Object
        • List Object
        • Map Object
        • Pff Object
        • SystemApp Object
        • ValueSet Object
      • Procedural Sections
      • Logic
      • Language Elements
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Geometry Object

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.
Functionality
A Geometry is a CSPro logic object that can be defined as a binary dictionary item or created as a logic variable. The following functions can be called via dot notation:
FunctionDescription
loadRead geometry from a GeoJSON file.
saveWrite geometry to a GeoJSON file.
clearDelete all data from the geometry.
tracePolygonAllow user to draw polygon by tapping points on a map. (Android only.)
walkPolygonAllow user to draw polygon by walking the perimeter and saving the locations using the GPS. (Android only.)
areaCompute the area of a polygon.
perimeterCompute the perimeter of a polygon.
maxLatitudeGet the largest latitude value of the geometry.
maxLongitudeGet the largest longitude value of the geometry.
minLatitudeGet the smallest latitude value of the geometry.
minLongitudeGet the smallest longitude value of the geometry.
getPropertyRetrieve one of the geometry's properties.
setPropertySet the value of one of the geometry's properties.
 
getLabelReturns the symbol's label.
getNameReturns the symbol's name.
getJsonReturns the symbol's metadata and value represented in JSON.
getValueJsonReturns the symbol's value represented in JSON.
updateValueFromJsonModifies the symbol based on a JSON representation of the value.
In addition to these object functions, Geometry objects can be used as arguments to the filename, Map.addGeometry, Map.clearGeometry, and Map.removeGeometry functions.
Assignments
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;
When a Geometry object is used as an argument to a user-defined function, it is passed by reference.
Example
// 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");
See also: Document Object, Map Object