Feature type sort order in drop-down list

7272
15
Jump to solution
06-04-2015 06:05 PM
RandyBurton
MVP Regular Contributor

In a feature class, I have a field that controls the feature type and, therefore, the symbology.  This field uses a coded-value domain list that is carefully sorted.  I can get the legend to use the domain sorting without difficulty.  The difficulty in sorting comes with the drop-down menu in Collector where the user changes the feature type.   When I create a new feature and add it to a new ArcGIS on-line map, I end up having to go into the “Edit - Manage New Features” and reorder items to get the drop-down list in the same order as the legend - this can be tedious if there are many feature types. I have also used the REST API to reorder the types - this is quicker, but could create other problems.

Can this reordering be done in ArcMap when the feature class is created?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RandyBurton
MVP Regular Contributor

RTC,

Thanks for the javascript link.  I started looking for a python method of sorting the 'types' section of the JSON file and updating it using the REST API.  The python code is here: Feature type sort order in REST API using Python

I think using the REST API is the best solution to this issue, and python can help.

View solution in original post

0 Kudos
15 Replies
BenNadler
New Contributor III

Try sorting the domain values in the geodatabase and see if that propagates through the stack.

You may have to shake the various parts (start/stop the service, republish map, etc...)

RandyBurton
MVP Regular Contributor

Before uploading any map, I always use the sort coded value domain tool on all the databases' domains.  This keeps things sorted everywhere except when the domain is used to identify the feature type.  I can go to the "Edit - Manage New Features" in ArcGIS Online and rearrange the order, but I haven't found where the sort order is getting messed up or where it can be fixed in ArcMap.  I have used the REST API to fix the order, but I think I would rather do it in ArcMap.

0 Kudos
RandyBurton
MVP Regular Contributor

It appears that ArcGIS Online maps use the domain sort from the database's settings to populate the dropdown.  However, Collector seems to use an unsorted list from Online's "Edit-Add Features" section.  Using the manage button (Manage New Features), I can move the items in the list up or down, eventually matching the domain sorting.  I can also go in and edit the "Types" in the JSON file to reorder the list.

When using ether method, Collector uses the new sorting in the dropdown. However, the map can no longer be downloaded for off-line work.  In Android it looks like the layer has been turned off.  For iOS it seems to dump back to the map index.

When I look at the JSON file, I notice that the "drawingInfo" item of "contentType" has changed from "contentType":"image/png" to "contentType":"".  This happens when the order is changed with online's Manage button or by updating the JSON file.

Is there an issue with contentType being set to null?

0 Kudos
DavinShokes1
Occasional Contributor

I've suffered this known issue for 2 years now without a solutionWrong Feature Template Order​.

Here is another post with the same issue Order of Feature Templates Not Honored in ArcGIS Online​.

For me, the template order is already incorrect at service definition staging for publishing. I too have resorted to updating the service definition's json through REST. Maybe this will be helpful with sorting https://jsfiddle.net/Rx6jQ/15/ .

I too have noticed that "contentType" is blank after altering the service definition. Not sure that this impacts in Collector though.

RandyBurton
MVP Regular Contributor

RTC,

Thanks for the javascript link.  I started looking for a python method of sorting the 'types' section of the JSON file and updating it using the REST API.  The python code is here: Feature type sort order in REST API using Python

I think using the REST API is the best solution to this issue, and python can help.

View solution in original post

0 Kudos
GISSupport3
Regular Contributor

Hello rvburton,

Great script. Thanks for sharing.

Do you know if anyone has been able to use it with Portal? I have tried to use it with Portal and get this error.

It is a feature server though the folder FeatureServer does not exist in config-store\service\UAT_FieldObsCapture

{  "error": {   "code": 500,   "message": "Service 'UAT_FieldObsCapture'.'FeatureServer' does not exist in folder 'FieldObs'.",   "details": []  } }

Thanks!

0 Kudos
RandyBurton
MVP Regular Contributor

I'm sorry.  I have not used Portal.   For AGOL the path to the layer definition update page uses something like:

http<s>://services.arcgis.com/<abc123>/arcgis/rest/admin/services/<featuer layer>/FeatureServer/<layer id>/updateDefinition

Should you be using a slash instead of a dash?  'UAT_FieldObsCapture/FeatureServer'

0 Kudos
DavinShokes1
Occasional Contributor

My feature classes don't have subtypes. The feature templates and symbology are based on a text field with a coded value domain. The symbology is match to a style file with names in the domain. I'm curious if your feature class has a similar setup?

0 Kudos
RandyBurton
MVP Regular Contributor


RTC, Sounds like we are using the same basic approach. I haven't explored subtypes yet. Ben in his comment mentioned using the domain sorting tool, and I highly recommend using it.  I had been looking for the easiest spot to fix the sorting in regards to adding new features.  It seems to me that using the REST API is the best place to do it. Your link to jsfiddle looks like an interesting tool to help sort the Types section of the JSON file.  And before making updates, I recommend jsonlint.com for JSON validation.

When I used the Manage New Features in ArcGIS Online, I found that the contentType in the drawingInfo section was being changed from image/png to null.  When contentType gets set to null, the layer is no longer downloadable in Collector for off-line use.  The layer will still work in Collector for on-line use.  ESRI support is aware of this issue; their response: " This anomaly can be classified as an ArcGIS Online where the AGOL changes the "contentType" in the symbology description to <null>. Essentially, this leads to the symbology contentType defined as null in the  offline geodatabase and as such the Collector for ArcGIS fails to read and assimilate the features."

For fixing the feature template order, I would recommend using the REST API and just updating the Types section only.  Using the whole JSON file, particularly the DrawingInfo section, has, in my experience, causes the contentType null problem, which you would want to avoid.  Experimenting with a copy of your layer and making backups is also recommended.

RTC and Ben, I appreciated receiving your comments.  Thank you.

0 Kudos