VERIFIED SOLUTION i

How to setup Feature Editing in Spectrum Spatial Analyst

Starting Spectrum Spatial Analyst 7.0, administrators have the capability of allowing users to insert new feature and edit the existing features of underlying data source in the browser. The insertion/editing will be done in the browser and only one record at a time will be inserted/edited.

Once a user has committed an edit it will update the source table and other users who subsequently request the data will be able to see the updated record provided that client side map caching is disabled. A new setting has been provided in admin console to manage whether maps are cached on the client browser and how long for.

The table below lists the data sources which are supported for editing in Spectrum Spatial Analyst 7.0.
Note: The TAB file are not supported for editing.
Data SourceSpatial TableXY Table
Oracle 11gR2Read/Insert/UpdateRead/Insert/Update
SQLServer 2008 R2/2012Read/Insert/UpdateRead/Insert/Update
PostgreSQL 8+ / PostGIS 1.5 and 2.xRead/Insert/UpdateRead/Insert/Update
GeoPackage / Windows and LinuxRead/Insert/UpdateNA

The circumstances in which a user can initiate an edit in Spectrum Spatial Analyst will be:
  1. The user’s roles need to have the following permissions in the Platform module (granted using Spectrum Management Console).
  2. The tables are present in that map configuration and are one of the types that support editing (listed in the above table).
  3. The map configuration has editing enabled as a capability (Either Full Editing or Attribute Editing Only)
  4. Assigning permissions on namedTables- New ACL permissions (Location Intelligence. Dataset) have been introduced in Spectrum 11.1. By which we can individually set the edit permissions of create/modify/delete access control on namedTables. A few points to be noticed here are:
    1. Only namedTables will be shown in this Dataset category because edit permissions are to be set only on namedTables.
    2. Create/Modify/Delete will be controlled from this category. Earlier “Modify” permission was enough to have create/edit/delete access rights on a resource. Now any role that has Modify permission on any namedTable, will have edit access control only. For example, if a role want to have all access rights, then he/she should have must checked the Create, Modify and Delete check box (like shown in above image). So, any combination is possible. A table can have delete access right alone.
    3. View does not have any mean here. It will not impact visibility of a resource.
    For details refer to Managing permissions in Spectrum Management Console below.

    If all four conditions above are met, then editing is enabled in the user interface and the user will be able to initiate an edit on the table(s) they have permission on Access Control over a particular resource.

Managing permissions in Spectrum Management Console through Access Control

Spectrum management console provides the ability to edit access control secured on specific named resources for a specific Role. Below is the screen shot of the Spectrum 11 Web UI showing permissions that can be enabled for the given role on the available named tables.

Figure: Spectrum Management Console




In order to assign permissions, the administrator will:
  1. Log into Spectrum’s Web Management Console.
  2. Go to the Access Control tab under Security.
  3. Select the Role for which you want to grant edit rights and click on Edit Access Control button.
  4. Assign modify permissions on named tables to selected Role.

There are some important considerations/limitations to be aware of:
  1. Permissions must be assigned to roles. Permissions assigned to users will not be picked up by Analyst as we only recognize role based permissions.
  2. Permissions assigned to roles that do not start with the text “Analyst” will not be relevant as Analyst does not consider these as roles which pertain to Analyst.
  3. Create/Edit and Delete permissions are grouped together and any role that has Modify permission on any resource will have Create/Edit and Delete right over the resource in Analyst provided all other conditions are met.

Primary Key Requirements

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

Below is an example of creating a sequence on ‘cycleparks’ table and using the 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

Analyst provides a layer of validation rules that are used when editing. These rules are defined in an XML file that can be created for each and every table that can be edited. They include rules defining whether a column is required, whether it used default values, value ranges, whether a picklist is to be shown, etc.

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 and can be done by specifying 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.

The validation XML files need to be placed into this (customerconfigurations\analyst\theme\featureEditTemplates) folder in Analyst and can be assigned to map configurations using the new (Edit Template Mapping) sub tab.

Below is the sample XML and its usage-

<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 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.

ElementRequired/OptionalUsage
tableoptionalRepository path of the table
showAllAttributesrequired

If set to true, all the table columns will be presented in the attribute form. Also, the column names, if provided, will be ignored in this case.

If set to false, you must specify one or more columns that need to be displayed.

primaryKey > includeInInsertrequiredSet to true for Oracle/Geopackage, false otherwise
primaryKey > hiddenoptionalSet to false if primary key column needs to be displayed
primaryKey > showDisabledoptional

Valid if primaryKey > hidden is false.

Set to true if this should be displayed but as read only.

Set to false, if a user input is required. Please note the value provided by the user will get overridden by any sequence/auto-increment set in the database.

geometrySupportedoptionalUsed for restricting the geometries that can be drawn while inserting/editing features. If none provided, the geometry toolset will allow all shapes. Inserting or editing of combination of geometries is not supported e.g. user can draw one or more polygons but not the combination of polygons, lines and points.
columnsoptionalThe columns provided here will be presented in the attribute form
dbColumnNamerequiredName of the column as present in the actual table
namerequiredFriendly name that will be displayed in the attribute form
requiredoptionalSet to true if a user input is mandatory
defaultValueoptionalProvides a default value
minLengthoptionalFor text columns, use this to specify a minimum length criteria
maxLengthoptionalFor text columns, use this to specify a maximum length criteria
minValueoptionalFor numeric columns, use this to specify a minimum value
maxValueoptionalFor numeric columns, use this to specify a maximum value
pickListoptionalProvide the options to allow user to choose one of the pre-defined values

For a given combination of map configuration and table, there can only be one configuration XML. However, multiple XML configurations can exist for the same table if the map configurations are different. This mapping among map configuration, table and XML configuration can be set using admin console.

Spectrum allows a column of the table to be marked as ‘read only’. In such cases, that column should not be provided in the template.

Applying Style to Inserted/Edited Features

The style of the inserted feature is not defined when an insert takes place. If the data source being edited has table-level styling (rather than a style column per row) the inserted feature will adopt the style of the table. If the data source being edited has per row styling enabled then the feature inserted will adopt 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 Professional. This will ensure that all features are shown in a desired style in Spectrum and Analyst regardless of per row styling.

Environment Details
Product Feature: Map Configuration Settings

 
UPDATED:  October 11, 2017