Feature Editing

Spectrum Spatial™ Analyst administrators have the capability of allowing users to insert new feature and edit the existing features of the underlying data source in the browser.

Insertion or editing features happen in the browser only one record at a time. Once a user has committed an edit, Spectrum Spatial™ Analyst updates the source table. Other users who subsequently request the data can see the updates.

The following table lists supported data sources for editing with Spectrum Spatial™ Analyst.

Data Source Spatial Table XY Table
Oracle 11gR2 Read/Insert/Update/Delete Read/Insert/Update
SQLServer 2008 R2/2012 Read/Insert/Update/Delete Read/Insert/Update
PostgreSQL 8+ / PostGIS 1.5 and 2.x Read/Insert/Update/Delete Read/Insert/Update
GeoPackage / Windows and Linux Read/Insert/Update/Delete NA
MapInfo TAB Read/Insert/Update/Delete NA
Note: The MapInfo TAB files are supported for editing in Windows. For more details about the limitations applicable to the insert, update and delete operations on these native files, refer to MapInfo Native TAB.

A user can edit or delete the record if the following conditions are met:

  1. The functionality profile referenced by the map project has editing enabled as a capability (either Full Editing or Attribute Editing Only).
  2. The tables are present in that map project and are one of the types that support editing (listed in the previous table).
  3. Edit permissions are assigned on namedTables in Spectrum Spatial™ Manager to the user who is logged into Spectrum Spatial™ Analyst or to one or more of the roles that they belong.

All of these conditions must be met for a user to add new records or edit existing records in Spectrum Spatial™ Analyst.

Primary Key Requirements

For Oracle data source, the primary key column must be configured to increment automatically for a successful add record operation by applying a sequence in the database.

The following example calls the cycleparks table using a sequence to create a trigger for auto-incrementing the primary key column MI_PRINX.

CREATE SEQUENCE STRATUS.cycleparks_seq 
START WITH     44 
INCREMENT BY   1 
NOCACHE 
NOCYCLE;

CREATE OR REPLACE TRIGGER STRATUS.cycleparks_auto_inc
BEFORE INSERT ON STRATUS.CYCLEPARKS 
FOR EACH ROW
BEGIN  
SELECT STRATUS.cycleparks_seq.NEXTVAL  
INTO  :new.MI_PRINX  
FROM   dual;
END;

As SQL server and Postgres takes care of auto-incrementing the primary key, there is no additional step required.

Configuring the Feature Edit/Insert Validation Form

Spectrum Spatial™ Analyst provides a layer of validation rules that are the default values to apply when editing a table. They define whether or not to include a column, use default values, use value ranges, show a picklist, and so on. These rules are defined in an XML file for each editable table.

Administrators have the flexibility of choosing which attributes of the table a user can edit including the geometry of the current feature and what types of geometry should be allowed. They also have the fine-grained control on what information a user can submit for inserting a new feature. This is a manual step that sets the rules via an XML file. If the admin does not specify any XML, then by default, all the columns of the table will be presented for insertion/editing.

Validation XML files must be saved to the customerconfigurations\analyst\theme\featureEditTemplates folder where Spectrum Spatial™ Analyst is installed. You can assign a validation XML file to a named layer in Spectrum Spatial™ Analyst on the Project Settings page, under the Templates tab for the business maps.

The following sample XML applies validation rules when editing a feature from WorldTable:

<FeatureEditing>
  <table>
      <table>/Samples/NamedTables/WorldTable</table>
      <showAllAttributes>false</showAllAttributes>                       
        <primaryKey>
           <includeInInsert>true</includeInInsert>                                   
           <hidden>false</hidden>                                   
           <showDisabled>true</showDisabled>
   </primaryKey>                       
          <geometrySupported>                                                                   
               <line>false</line>                                   
               <point>false</point>                                   
               <polygon>true</polygon>                       
          </geometrySupported>                        
          <columns>
	      <column>                                               
               <dbColumnName>Column_1</dbColumnName>                                               
               <name>Column 1</name>                                               
               <required>true</required>                                                                                
               <defaultValue>Enter Unique Value</defaultValue>                                               
               <minLength>4</minLength>                                      
               <maxLength>25</maxLength>                                
             </column>
	   <column>                                               
              <dbColumnName>Column_2</dbColumnName>                                               
              <name>Column 2</name>                                               
              <required>true</required>                                               
              <pickList> 
                   <Option></Option>                                                          
                   <Option>Option 1 </Option>                                               
                   <Option>Option 2</Option>                                                           
                   <Option>Option 3</Option>                                               
              </pickList>
          </column>
	        <column>                                               
               <dbColumnName>Column_3</dbColumnName>                                               
               <name>Column 3</name>                                               
               <required>false</required>                                               
               <showDisabled>true</showDisabled>                                               
               <minValue>1</minValue>                                                
               <maxValue>365</maxValue>                                   
           </column>
	 </columns>           
   </table>
</FeatureEditing>  

Please refer to the below table for more information about the XML elements and their usage.

Element Required/Optional Usage
table optional Repository path of the table.
showAllAttributes required When set to true, all table columns display in the Attribute form and column names are ignored.

When set to false, you must specify one or more columns to display.

primaryKey > includeInInsert required Set to true for Oracle/Geopackage, false otherwise.
primaryKey > hidden optional Set to false to display the primary key column.
primaryKey > showDisabled optional Valid if primaryKey > hidden is false.

Set to true to display are as read-only.

Set to false if user input is required. The value the user provides is overridden by a sequence or auto-increment set in the database.

geometrySupported optional Used for restricting the geometries that can be drawn while inserting/editing features. If none are provided, the geometry toolset allows all shapes. Inserting or editing a combination of geometries is not supported (a user can draw one or more polygons but not a combination of polygons, lines, and points).
columns optional The columns provided are included in the Attribute form.
dbColumnName required Name of the column in the table.
name required Friendly name that will display in the Attribute form.
required optional Set to true when user input is mandatory.
defaultValue optional Provides a default value.
minLength optional For text columns, specifies a minimum length criteria.
maxLength optional For text columns, specifies a maximum length criteria.
minValue optional For numeric columns, specifies a minimum value.
maxValue optional For numeric columns, specifies a maximum value.
pickList optional Provides options for the user to choose one of the pre-defined values.
Note: If provided, an empty option inserts a null value into the database or tab file.

You can use a single XML file to combine map configuration with a table. However, multiple XML configurations can exist for the same table when map configurations are different. Mapping between map configuration, table, and XML configuration is done in the Spectrum Spatial™ Manager under the Properties menu option.

A column in a table may be set to read only. A read only column should not be in the template.

Applying Style to Inserted/Edited Features

A feature’s style is not defined when inserting it into a table (when editing a table). When the data source has table-level styling rather than a style column per row, the feature adopts the style of the table. If the data source has per row styling enabled, then the feature adopts the default style of white fill and black outline.

We always recommend that the administrator applies a style override to the table while uploading it using MapInfo Pro to ensure that all features are shown in the desired style in Spectrum™ Technology Platform and Spectrum Spatial™ Analyst regardless of per row styling.