Rules Engine¶
The Rules Engine allows you to create a set of rules with conditions when you import data from either a file such as a Shape, CSV or a MS Excel file. Or you can connect directly to an ArcGIS Map server. The rules you create based on the input data will trigger corresponding FieldTwin Actions.
FieldTwin can then auto-create a field layout including 3D assets and connections using your set of import rules. You can also import and export your rule set to use it in multiple projects.
A typical use case could be to auto create brownfield assets or connections for tie in, slot in considerations etc.
See the following example video explaining this powerful functionality:
You can also go straigth to the tutorial section
File Setup¶
Select the Import drop down menu and then select the Data from files using rules option.
This will display the following dialog box:
Click on the Create a new import/Clone an existing import button. This will then display the next dialog box:
The types of files that can be imported are shape files (inside a .zip file), containing the coordinate information of the shape (.shx, .shp, .prj and .dbf). Also excel files can be imported.
Shape file import¶
After importing the shape .zip file, press next.
The dialog box that opens allows you to simplify connections using the Ramer–Douglas–Peucker algorithm. This maintains the geometry of your connections but optimises them for 3d visualisation. The simplification tolerence can also be set here.
Excel and CSV file import¶
After importing the Excel or CSV file, press next.
The dialog box that opens will then be to configure the excel file.
Header start at: This is the row number where the header starts.
Header count: This is the number rows the header contains.
Column Coord X: Column containing the X coordinate location of the asset.
Column Coord Y: Column containing the Y coordinate location of the asset.
Column id: The id/name of the asset.
Use for all files: Tick this box to apply the same format for all files selected to import.
EPSG: This can either be the same coordinate projection system as the project or a different one.
Example of how the input fields will look:
The excel file should have the following format:
ArcGIS Setup¶
ArcGIS Documentation
Note! Detailed information about the various ArcGIS dialog box settings show below can be found in the WMS/WFS specific sections in the documentation e.g. WMS.
Select the Import drop down menu and then select the Data from ArcGis using rules option.
This will display the following dialog box:
Click on the Create a new import/Clone an existing import button. This will then display the next dialog box:
In this example we will use the free mapping service from the Norwegian Petroleum Directorate (NPD), shown below:
https://factmaps.sodir.no/arcgis/rest/services/FactMaps/3_0/MapServer
Input this in the Server URL field, and then we need to Override the Project CRS if not set up already. In this example we will use:
EPSG:23031,ED50/UTM zone 31 N
Transformations can also be handled manually if the ARGIS Server has a list of possible transformations available. Then a dialog box will appear in this case so the user can select the correct transformation method. Additional information about the way FieldTwin handles ARCGIS data can be found here
We will also give it a Name, so the completed dialog entries look like this:
Now press Next to continue.
This will display the next ArcGIS dialog, which for this example does not require any input from us:
Press Next to continue.
This will then query the ArcGIS map service and bring back a list of all available data layers as shown here:
For this example we want the Facilities, in place amd Pipeline layers. Press Next to continue. This is shown in the Tutorial Section
Rules Dialog¶
After you have connected your ArcGIS server and selected the data layers of interest you will now need to build one or more set of import rules to map the data to be ingested to the FieldTwin equivalent. You do this in the Rules Builder screen:
This dialog has the following commands:
Remove previously inported records that are not part of the new import - Check this box to discard previous records that are not present of a new import.
+Add - Press this button to create a new ruleset. This will look like this:
+Add Child - This will add a new rule (child) under the current ruleset.
Clone - This will create a copy of the current selected rule in the ruleset treeview to the left, but not any child rules.
Clone Tree - Use this to create a copy of the selected ruleset including any child rules.
Export - Press this button to export the set of rules as JSON to your download folder. This file can then be imported and used in another project.
Name - Enter/change the name of your ruleset in the text box.
In the top right corner you will find the Delete commands for the rules as shown here:
-Remove - This will remove the currently selected rule.
-Remove tree - This will remove the currently selected rule and any child rules.
Rule Creation¶
After you have selected to create a new ruleset you will see the following new if condition rule entry appear in the dialog:
The leftmost drop down list displays all the selected ArcGIS data layers you have selected in the setup of the import as shown here_
We are selecting fclKind from ArcGIS here, and then you need to add the rule logic operator in the next drop down list:
These logic operators are self explanatory so they are not detailed here. We select equal so the rule so far is as follows. If "fclKind" equal. We then need to select the last type from the map service:
The right most drop down list then displays all the map service "fclKind" data entries. We select the Multi Well Template from here. This means we have created the following rule:
If "fclKind" equal "Multi Well Template"
Delete - Click on the red Trashcan icon to the right of the rule to delete it.
The next step is to create a corresponding FieldTwin Action for this rule.
Action Creation¶
For a rule to have any meaning you have to create an action to be excuted when the rule conditions are met.
+Add Action - Press this button to create your action for the rule above.
This will then display a list of the available FieldTwin Actions that can be executed:
Note! Based on your rule you will only by able to select meaningful actions based on the ingested map data so some entries will be non selectable.
The available Actions are as follows:
FieldTwin Action | Description |
---|---|
Create or update connection | This will create or update a connection in the Viewport |
Set name from attribute | Paste selection at mouse location |
Set connection type | This will allow you to specify the connection type e.g. oil |
Create or update stagedAsset | This will create or update a stagedAsset in the Viewport |
Create or update well | This will create or update a well in the Viewport |
Set Well type | This will allow you to specify the type of well |
Set Well radius | This will allow you to set a numeric value for the Well radius |
Set asset | Allows you to specify assets as part of the import process |
Map attributes to metadata | Allows you to assign map service attributes to FT Metadat e.g. Inner Diameter |
Set tags | Allows you to specify tags as part of the import process |
We will select the Action called Create or update stagedAsset:
Note! Depending on the action selected the follow on parameters/selection might vary:
Map name to - Here you select a name attribute from the map service, which will then name the asset.
Asset - This will display a drop down asset list of your FieldTwin assets from the asset library. Select the one you want to use for the selected action.
Your first ruleset is now complete, and you can execute the rule by pressing Next.
Tutorial¶
After you have connected your ArcGIS server and selected the data layers of interest you will now need to build one or more set of import rules to map the data to be ingested to the FieldTwin equivalent. You do this in the Rules Builder screen:
Add - Press this button to create a new ruleset.
Name - Enter the name of your ruleset.
+Add Rule - Press this button to create your first rule for this ruleset.
In the example we select the fclKind type from the Map Service entity drop down list and set the operator to equal and then select Multi Well Template from the list of fclKind entities returned from the Map Service.
+Add Action - Click this button to create a corresponding action to the newly created Import rule.
Here we selected Create or update stagedAsset and map the name of the asset to the fclName map service attribute, and select a Template 4 slot to be created in FieldTwin.
We will then add a new rule for importing pipelines. Same principle as the example above, but with the following set up:
For the Pipeline rule set we use pplMedium type from the Map Service entity drop down list and set the operator to equal and then select Oil from the list of pplMedium entities returned from the Map Service.
Then we create a corresponding Action, which is Create or update connection and map the name of the pipeline to the pplMapLabel map service attribute, and select a Type of Oil Production* to be created in FieldTwin.
You are now ready to execute your first ruleset. Do this by pressing Next. This will then read out all the requested data from the map server based on the rules, and create the corresponding FieldTwin entities and attributes based on the defined actions. After processing you will see the imported data in FieldTwin as shown here:
Sample Rules¶
This sections shows some illustrations on varius rules and corresponding actions that you might find useful:
Pipeline & Metadata example¶
This rule and action will create or update a connection in FieldTwin of type oil production with the name. In addition we map the pipeline dimension to the standard FieldTwin Metadata schema for inner diameter:
XMT shallow water example¶
This rule and action will create or update a staged asset in FieldTwin of type XMT Shallow Water if the water depth is less than 200 m.