Appendix |
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.
Data Source | Spatial Table | XY Table |
---|---|---|
Oracle 11gR2 | Read/Insert/Update | Read/Insert/Update |
SQLServer 2008 R2/2012 | Read/Insert/Update | Read/Insert/Update |
PostgreSQL 8+ / PostGIS 1.5 and 2.x | Read/Insert/Update | Read/Insert/Update |
GeoPackage / Windows and Linux | Read/Insert/Update | NA |
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.
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
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.
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.
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.
Element | Required/Optional | Usage |
---|---|---|
table | optional | Repository path of the table |
showAllAttributes | required |
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 > includeInInsert | required | Set to true for Oracle/Geopackage, false otherwise |
primaryKey > hidden | optional | Set to false if primary key column needs to be displayed |
primaryKey > showDisabled | optional |
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. |
geometrySupported | optional | Used 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. |
columns | optional | The columns provided here will be presented in the attribute form |
dbColumnName | required | Name of the column as present in the actual table |
name | required | Friendly name that will be displayed in the attribute form |
required | optional | Set to true if a user input is mandatory |
defaultValue | optional | Provides a default value |
minLength | optional | For text columns, use this to specify a minimum length criteria |
maxLength | optional | For text columns, use this to specify a maximum length criteria |
minValue | optional | For numeric columns, use this to specify a minimum value |
maxValue | optional | For numeric columns, use this to specify a maximum value |
pickList | optional | Provide 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.
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.