Esri / military-symbology

A user-focused add-in for searching, creating, and editing military symbols in ArcGIS Pro.
Apache License 2.0
38 stars 11 forks source link

Add SIDC as an attribute to the standard schema #184

Open topowright-zz opened 7 years ago

topowright-zz commented 7 years ago

As users will use the MSE to build military Symbols they will need to share these symbols with other systems that will ingest this information using SIDC codes. Currently this is not an field in the database for SIDC.

Expected Behavior: When each symbol is changed the SIDC code attribute should also be dynamically updated. The addition of an SIDC field in needed

csmoore commented 7 years ago

Currently there is no SIDC field/attribute in the Military Overlay Information Model schema so the addin has to work with the schema provided.

But if the schema were changed/updated to add this field, this should be achievable.

topowright-zz commented 7 years ago

@csmoore The real enhancement would be adding the SIDC field and having this field update dynamically when a symbol is changed.

joebayles commented 4 years ago

This is an imperative issue for customer interoperability.

csmoore commented 4 years ago

I'm not sure if the schema is likely to change short-term (before 2.7).

If this feature is needed immediately, you may need to create a customization. For this you have (at least) 2 options you can do now until this is available:

  1. Assuming you are using a newer (>2.5) version of Pro, you can create a SIDC field that is an "Attribute Rule" (basically a field that is calculated on the fly like you do with the CalculateField tool) - this field would be built by combining the other fields in an arcade script, see: https://pro.arcgis.com/en/pro-app/help/data/geodatabases/overview/an-overview-of-attribute-rules.htm (note: this is probably how we are going to implement this to enforce data consistently)

  2. If more of an export capability is desired, then a custom tool/script would work for this. We did start on this several (4-5) years ago - and it is here if you need for a starting point (note this would also help build the expression needed for option 1 above) : https://github.com/Esri/defense-solutions-feature-toolbox/blob/v.next/toolboxes/mil2525d/scripts/CalculateSidcField.py

dfoll commented 4 years ago

Just an fyi, Was having a convo with @jfrygeo and Armando today and this requirement came up again.

csmoore commented 4 years ago

I did test creating an Attribute Rule that updates a "sidc" field from the other fields and this seems to work well. Here are the steps in case anyone wants to use this method until new lpkx's can be created:

In ArcGIS Pro (>=2.4) Catalog View:

  1. Feature Dataset ("MilitaryOverlayXXX) | Manage | Add Global IDs a. This step is required to enable attribute rules
  2. For each military feature class: a. Design: Add "sidc" Field:
    1. Add new field field:"sidc" alias:"Symbol ID Code" type:TEXT length:15 (Save) b. Design: Add Attribute Rules: Add Rule: Add Immediate Calculation Rule
    2. Rule Name: CalculateSIDC
    3. Field: sidc
    4. Editable: False
    5. Expression: (Arcade script below: note there are 3 different scripts based on layer type) (Validate)
    6. Triggers Insert, Update
    7. Save

Arcade Expressions:

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Units, Equipment, Installations: CalculateSIDC
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var _coding_scheme = '-'; // 1
var _affiliation = '-';   // 2
var _battle_dimension = '-'; // 3
var _status = '-';  // 4 
var _function_code = '------'; // 5-10
var _HQ_TF_FD = '-'; // 11
var _echelon_mobility = '-'; // 12
var _country_code = '--'; // 13-14
var _order_of_battle = '-'; // 15

var _sidc = 'SUGP----------'

if (!IsEmpty($feature.extendedfunctioncode) && count($feature.extendedfunctioncode) == 10) {
  _coding_scheme = mid($feature.extendedfunctioncode, 0, 1);
  _battle_dimension = mid($feature.extendedfunctioncode, 2, 1);
  _function_code = mid($feature.extendedfunctioncode, 4, 6);
}

if (!IsEmpty($feature.affiliation) && count($feature.affiliation) == 1)
  _affiliation = $feature.affiliation;
if (!IsEmpty($feature.status) && count($feature.status) == 1)
  _status = $feature.status;
if (!IsEmpty($feature.hqtffd) && count($feature.hqtffd) == 1)
  _HQ_TF_FD = $feature.hqtffd;
if (!IsEmpty($feature.echelonmobility) && count($feature.echelonmobility) == 1)
  _echelon_mobility = $feature.echelonmobility;
if (!IsEmpty($feature.countrycode) && count($feature.countrycode) == 2) 
  _country_code = $feature.countrycode;

_sidc = _coding_scheme + _affiliation + _battle_dimension + _status + _function_code + _HQ_TF_FD + _echelon_mobility + _country_code + _order_of_battle;

return _sidc 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Control Measures: CalculateSIDC
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var _coding_scheme = '-'; // 1
var _affiliation = '-';   // 2
var _battle_dimension = '-'; // 3
var _status = '-';  // 4 
var _function_code = '------'; // 5-10
var _HQ_TF_FD = '-'; // 11
var _echelon_mobility = '-'; // 12
var _country_code = '--'; // 13-14
var _order_of_battle = '-'; // 15

var _sidc = 'SUGP----------'

if (!IsEmpty($feature.extendedfunctioncode) && count($feature.extendedfunctioncode) == 10) {
  _coding_scheme = mid($feature.extendedfunctioncode, 0, 1);
  _battle_dimension = mid($feature.extendedfunctioncode, 2, 1);
  _function_code = mid($feature.extendedfunctioncode, 4, 6);
}

if (!IsEmpty($feature.affiliation) && count($feature.affiliation) == 1)
  _affiliation = $feature.affiliation;
if (!IsEmpty($feature.status) && count($feature.status) == 1)
  _status = $feature.status;
if (!IsEmpty($feature.echelonmobility) && count($feature.echelonmobility) == 1)
  _echelon_mobility = $feature.echelonmobility;
if (!IsEmpty($feature.countrycode) && count($feature.countrycode) == 2) 
  _country_code = $feature.countrycode;

_sidc = _coding_scheme + _affiliation + _battle_dimension + _status + _function_code + _HQ_TF_FD + _echelon_mobility + _country_code + _order_of_battle;

return _sidc 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// METOC: CalculateSIDC
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var _coding_scheme = '-'; // 1
var _affiliation = '-';   // 2
var _battle_dimension = '-'; // 3
var _status = '-';  // 4 
var _function_code = '------'; // 5-10
var _HQ_TF_FD = '-'; // 11
var _echelon_mobility = '-'; // 12
var _country_code = '--'; // 13-14
var _order_of_battle = '-'; // 15

var _sidc = 'SUGP----------'

if (!IsEmpty($feature.extendedfunctioncode) && count($feature.extendedfunctioncode) == 10) {
  _coding_scheme = mid($feature.extendedfunctioncode, 0, 1);
  _affiliation = mid($feature.extendedfunctioncode, 1, 1);
  _battle_dimension = mid($feature.extendedfunctioncode, 2, 1);
  _status = mid($feature.extendedfunctioncode, 3, 1);
  _function_code = mid($feature.extendedfunctioncode, 4, 6);
}

_sidc = _coding_scheme + _affiliation + _battle_dimension + _status + _function_code + _HQ_TF_FD + _echelon_mobility + _country_code + _order_of_battle;

return _sidc 
kerryrobinson commented 4 years ago

That's awesome, @csmoore ! If that does work well, it's definitely worth writing a blog post to make sure people are aware until the schema gets updated.