• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Numeric Values
      • String Values
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
        • Geometry Statement
        • Geometry.area Function
        • Geometry.clear Function
        • Geometry.load Function
        • Geometry.maxLatitude Function
        • Geometry.maxLongitude Function
        • Geometry.minLatitude Function
        • Geometry.minLongitude Function
        • Geometry.perimeter Function
        • Geometry.save Function
        • Geometry.tracePolygon Function
        • Geometry.walkPolygon Function
        • Geometry.getProperty Function
        • Geometry.setProperty Function
        • JSON Representation
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • StringWriter Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Geometry.setProperty Function

Format
b = geometry_name.setProperty(property_name, property_value);
Description
The Geometry.setProperty function modifies the value associated with the Geometry object's property specified by the string expression property_name. The property will be modified to the value given in the string or numeric expression property_value. Properties may not be applied to empty Geometry objects so you must first call the Geometry.load, Geometry.tracePolygon, or Geometry.walkPolygon functions to add items to the Geometry before setting properties. Property names are case sensitive.
When a geometry item contains multiple features, the property is set to property_value in ALL of the features of the geometry. When a geometry item is saved to a GeoJSON file using the Geometry.save function, the properties are written to the GeoJSON file.
When displaying the geometry on a map, the following properties may be set to change the visual styling of the vector items:
NameValue
strokeColor used to draw lines and polygon outlines as an HTML color string (e.g. "#FF0000").
stroke-widthWidth of the lines and outlines of polygons in display pixels.
fillColor used to draw the interior of polygons as an HTML color string (e.g. "#FF0000").
Return Value
The function returns a logical value of 1 (true) because it will always successfully set a property.
Example 1
// Declare a geometry
Geometry outline;

// Have the user walk the outline of a polygon
if outline.walkPolygon() then

   
// Add the ID items of the case as properties to make it easier to identify when importing into GIS system
    // PROV, DIST and HHNO are the names used in the GIS system
    outline.setProperty("PROV", PROVINCE);
    outline.
setProperty("DIST", DISTRICT);
    outline.
setProperty("HHNO", HOUSEHOLD_NUMBER);

   
// Save the outline to a GeoJSON file
    outline.save("outline.geojson");

endif;
Example 2
// Declare a map
Map mymap;

// Load geometry from a file
Geometry boundary;
boundary.
load("boundary.geojson");

// Set the polygon fill color to purple
boundary.setProperty("fill", "#94219");

// Set the outline color to red
boundary.setProperty("stroke", "#ff0000");

// Set the outline width to 3
boundary.setProperty("stroke-width", 3);

// Add geometry to the map
numeric geometryId = mymap.addGeometry(boundary);

// Show the map
mymap.show();
See also: Geometry Object, Geometry.getProperty Function