Hi,
can i use the 'Add to Definition' REST api to update a domain on a feature service, i want to add in an additional value into the domain
Stu
You can also add coded value domains through a list of values from the data tab in ArcGIS Online. Check out these resources for more information:
Define attribute lists and ranges—ArcGIS Online Help | ArcGIS
https://www.esri.com/arcgis-blog/products/arcgis-online/uncategorized/whats-new-with-managing-field-attributes-june-2018…
Hi Stuart,
You will have to use the Update definition operation. I have included a link to a very helpful document outlining what can be updated via this definition, including domain values.
How To: Add coded value domains to a hosted feature service from a REST endpoint
Hope this helps!
Best,
Marisa
I was looking to define an attribute list using ArcGIS API for Python. I would think its a function tied to the Feature_Layer Object, but I cant seem to find it. The furthest i get is......
from arcgis.features import FeatureLayerlayer_url = 'https://servername.arcgis.com/OrrtI/arcgis/rest/services/TreeWorks/FeatureServer/0'
layer = FeatureLayer(layer_url)
# Do a loop through all the fields in the feature layerfor f in layer.properties.fields: print(f['name'])
This will get me to the feature layer field names but not sure where to go from there.
this might help
<SPAN class="comment token">#!/usr/bin/env python</SPAN> <SPAN class="comment token"># -*- coding: utf-8 -*-</SPAN> <SPAN class="keyword token">import</SPAN> arcpy <SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env <SPAN class="keyword token">import</SPAN> os env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">"h:\Connection.sde"</SPAN> datasets <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListDatasets<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"All"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Write the name of the current fc in text file:</SPAN> txtFileFC <SPAN class="operator token">=</SPAN> open<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"H:\ListAll_FC.txt"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"w"</SPAN><SPAN class="punctuation token">)</SPAN> txtFileFC<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Dataset|Type|FeatureClass Name|Record Count'</SPAN><SPAN class="punctuation token">)</SPAN> txtFileFC<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>linesep<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Write the name of the current fields fc in text file:</SPAN> txtFileFields <SPAN class="operator token">=</SPAN> open<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"H:\ListAll_Fields.txt"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"w"</SPAN><SPAN class="punctuation token">)</SPAN> txtFileFields<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Dataset|Type|FeatureClass Name|Field Name|Alias Name|Data Type|Required|Length|Domain'</SPAN><SPAN class="punctuation token">)</SPAN> txtFileFields<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>linesep<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Write the name of Domains text file:</SPAN> txtFileDomains <SPAN class="operator token">=</SPAN> open<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"H:\ListAll_Domains.txt"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"w"</SPAN><SPAN class="punctuation token">)</SPAN> txtFileDomains<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Domain Name|Domain Type|Coded Value|Alias Name|Min Range|Max Range'</SPAN><SPAN class="punctuation token">)</SPAN> txtFileDomains<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>linesep<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">##----------------------------------</SPAN> <SPAN class="comment token">## List Features in Datasets</SPAN> <SPAN class="keyword token">for</SPAN> dataset <SPAN class="keyword token">in</SPAN> datasets<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN>dataset<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> RecCount<SPAN class="operator token">=</SPAN> <SPAN class="string token">'0'</SPAN> <SPAN class="comment token">##--- uncomment for counts</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeTableView_management<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"myTableView"</SPAN><SPAN class="punctuation token">)</SPAN> RecCount <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetCount_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"myTableView"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>getOutput<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Delete_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"myTableView"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">##--- uncomment for counts</SPAN> <SPAN class="comment token"># Write messages to a Text File</SPAN> txtFileFC<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN>dataset<SPAN class="operator token">+</SPAN><SPAN class="string token">'|FC|'</SPAN><SPAN class="operator token">+</SPAN>fc<SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>RecCount<SPAN class="punctuation token">)</SPAN> txtFileFC<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>linesep<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> field <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># Write messages to a Text File</SPAN> txtFileFields<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN>dataset<SPAN class="operator token">+</SPAN><SPAN class="string token">'|FCField|'</SPAN><SPAN class="operator token">+</SPAN>fc<SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>aliasName<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>type<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>required<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="operator token">+</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>domain<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> txtFileFields<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>linesep<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">##---------------------------------- </SPAN> <SPAN class="comment token">#close text file</SPAN> txtFileFields<SPAN class="punctuation token">.</SPAN>close<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> txtFileFC<SPAN class="punctuation token">.</SPAN>close<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.