• <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.walkPolygon Function

Format
b = geometry_name.walkPolygon(ʃmap_nameʅ);
Description
The Geometry.walkPolygon function displays an interactive map-based interface allowing the user to create a polygon by walking the perimeter of an area and recording their location using the GPS. The interface is similar to that used by Geometry.tracePolygon except that rather than tapping on the map to place the vertices of the polygon, there is an add vertex button that places a vertex at the user's current location as determined by GPS. While walking the outline, the user may also drag vertices of the polygon by long pressing on them in order to modify the polygon. The function returns when the user has finished creating the polygon on the map and taps the save button.
The optional argument map_name is the name of a Map object that will provide the display parameters used for the map that is shown while the user walks the polygon. You can use this parameter to set the base map, title, and location/zoom level of the map. You can also use the map parameter to display markers and geometry on the map, however any callbacks for clicking on markers or on the map itself are ignored while walking the polygon. Any buttons on the map are replaced by buttons for adding a vertex, saving, clearing, and deleting the last point placed while the polygon is being walked. If the argument map_name is omitted, a map with default settings is displayed while walking the polygon.
After walking the polygon, you can save the geometry to a file, compute the area of the polygon, or compute the perimeter of the polygon.
If geometry_name already contains a polygon, this polygon will be displayed and the user will be able to modify it by long pressing on the vertices to drag them. If the geometry contains more than one polygon, only the first polygon is shown. All entities in the geometry other than polygons are ignored. If the geometry was loaded from GeoJSON, any polygons in entities of type MultiPolygon are ignored. If you wish to capture a new polygon rather than editing the existing geometry, use the Geometry.clear function before calling Geometry.walkPolygon.
Return Value
The function returns a logical value of 1 (true) if the user created a polygon and 0 (false) if the file user canceled polygon walking by tapping the back button.
Example 1
// Declare a geometry
Geometry outline;

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

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

endif;
Example 2
// Declare a geometry
Geometry plot;

// Declare a map
Map mymap;

// Set map display parameters
mymap.setBaseMap("basemap.mbtiles");
mymap.
setTitle("Tap points on the map to outline the plot");

// Have the user walk the outline of a polygon using the map
if plot.walkPolygon(mymap) then

   
// Capture the plot area
    PLOT_AREA = plot.area();

endif;
See also: Geometry Object, Geometry.tracePolygon Function