Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »



This page is a work in progress for an as yet unreleased editing extension

The spatial editing extension for Weave provides a means to edit geometry and attributes for an entity.

Features:

  • Simple to setup for basic operation
  • Customisable for advanced operation
  • Supports transparent editing on an entity with multiple spatial layers
  • Can be initiated from URL parameters

Limitations:

  • Spatial mapper for entity must have <dynamic> set to true and <cache> set to false
  • But this is generally the case for any entity that can have it's underlying data altered on the fly

Installation

Currently the Weave editing sub-system is provided as a single bundle, com.cohga.spatial.edit, but this may change before release.

This bundle must be copied to the weave\platform\plugins directory and the server restarted for it to be available.

Configuration

Client Edit Plugin

Part of the client side editing sub-system is implemented as a 'plugin' for the map view, so the first thing that needs to be done when enabling the editing sub-system is to register the edit plugin with the map view in the client configuration.

Adding edit plugin to client
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

  <client:config id="edit">
    <!-- more config items here -->

    <view id="com.cohga.html.client.map.mapView">
      <label>Map</label>
      <location>center</location>

      <plugin id="weave.edit"/> <!-- Register the edit plugin with the map view -->

      <!-- map config items here -->
    </view>

    <!-- more config items here -->
  </client:config>

</config>

The provides the edit sub-system with a hook into the map view so that it can provide access to the editing layer.

Client Edit View

When performing an edit a view panel is required to enter/change the attributes associated with the entity being edited. This view is provided by the com.cohga.client.panel.edit view and so also needs to be added to the client configuration.

Adding edit view to client
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

  <client:config id="edit">
    <!-- more config items here -->

    <view id="com.cohga.client.panel.edit"> <!-- Add the Edit panel to the client -->
      <label>Edit</label>
      <location>west</location>
    </view>

    <view id="com.cohga.html.client.map.mapView">
      <label>Map</label>
      <location>center</location>

      <plugin id="weave.edit"/> <!-- Register the edit plugin with the map view -->

      <!-- more config items here -->
    </view>

    <!-- more config items here -->
  </client:config>

</config>

This view also provides the actions required to initiate editing and the tools required to perform the spatial edit operations.

Customising the client edit view

There are a number of customisation options available to alter the display of the edit view

name

type

default

description

enableCreate

boolean

true

Should the 'Create' button be displayed

enableUpdate

boolean

true

Should the 'Update' button be displayed

enableDelete

boolean

true

Should the 'Delete' button be displayed

enableModify

boolean

true

Should the 'Modify' button be displayed

enablePoint

boolean

true

Should the 'Point' button be displayed

enableLine

boolean

true

Should the 'Line' button be displayed

enablePolygon

boolean

true

Should the 'Polygon' button be displayed

enableRemove

boolean

true

Should the 'Remove' button be displayed

enableSnap

boolean

true

Should the 'Snapping' button be displayed

enableSettings

boolean

true

Should the 'Settings' button be displayed

showText

boolean

true

Should the text labels appear in the buttons

showIcons

boolean

true

Should the icons appear in the buttons

embedButtons

boolean

false

Should the 'Submit' and 'Cancel' buttons be embedded in the form (or remain in the toolbar)

Edit View with embedButtons set to true and showText set to false

Server Edit Configuration

Before entities can be edited it must have at least one edit associated with it via a configuration item. There are currently two types of edit configurations available, a simple one that infers the information it requires from the underlying spatial tables, and a custom one in which you provided all of the details.

You can have multiple edits associated with each entity, the user will be able to choose which edit to perform by selecting from a list.

Simple Server Edit Configuration

The simple edit configuration interrogates the underlying spatial tables for the information it requires, for example to determine what attributes the entity has associated with it or what spatial geometries (point, line or polygon) the user is allowed to create.

Simple edit configuration example
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:edit="urn:com.cohga.spatial.edit#1.0">

  <edit:simple id="simple.edit">
    <entity>graffiti</entity>
    <label>Spatial Attributes</label>
    <description>Edit the spatial attributes attached to the graffiti</description>
  </edit:simple>

</config>

This provides a simple way to edit an entity and allows the user to directly edit the attributes attached to the entity in the spatial table. The only customisation options the simple edit provides is the label and a description the rest of the information required is determined by the spatial table(s) that the entity is associated with.

The simple and custom edits both have a publish setting, which when set to false will stop the edit from appearing in the list of edits available for an entity. The edit will still be available but can only be initiated via code or a URL parameter, this provides for the creation of custom editing clients that don't have their edits listed in standard editing clients.

Simple editing attributes

The simple edit configuration offers no options to customise what attributes are available for editing, they all are, or how the user will be able to edit those values, which will be determined by the underlying column type in the spatial table and be limited to simple field types (text fields for string and numbers, calendar field for dates, etc).

Simple editing geometry

What types of geometry the user will be able to create/edit will also be determined by the underlying spatial table, if the spatial table contains polygons then the user will only be able to create polygons, they will not be able to create points or lines. If however the entity is linked to two spatial tables, one containing polygons and the other containing points then the user will be able to edit points and polygons.

Further there is differentiation between spatial layers that contain single instance geometry and those that contain multi-instance geometry, that is if the spatial table contains multipolygons, as opposed to just polygons, then the user will be allowed to create more than one polygon shape when editing the entity, when the spatial table contains polygons the user will be limited to a single polygon object. The same applies to points/multipoints and line/multilines.

Creating polygons with holes is currently not supported.

Finally the requirement for the user to actually create geometry is also determined by the underlying spatial table, if the spatial table allows nil geometry then the user will not be forced to create a geometry when creating a new entity, if the spatial table doesn't allow nil geometries then the user will be required to create a geometry before they'll be able to complete the edit.

Custom Server Edit Configuration

If you need more control over the attributes and geometry for an edit then you need to create a custom edit.

Basic custom edit configuration example
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:edit="urn:com.cohga.spatial.edit#1.0">

  <edit:custom id="custom.edit">
    <entity>graffiti</entity>
    <label>Custom Attributes</label>
    <description>Edit the attributes attached to the graffiti</description>
    <supportedGeometry>point</supportedGeometry>
    <requiredGeometry>point</requiredGeometry>
    <parameter id="description">
      <promptText>Description</promptText>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
  </edit:custom>

</config>

  • No labels