Hot answers tagged

12

Here is something I put together that works on the simple gdb's I have on hand. I don't know how it might or might not handle sub-types with multiple domains (see Brent's comment). Usage: python export_gdb_domains.py [input geodatabase] It exports the tables to the same gdb it's getting the domains from. It will fail if the table(s) exist already. ''' ...


8

I think what you are actually trying/wanting to do is create subtypes as shown in the graphic here. You can then apply domains by subtype. In your example type would be a domain of plastic and metal, which in turn would be subtypes, and then metal would have a domain of yes/no for rusted, but plastic would have a domain of N/A or whatever other option. ...


8

The following should do the job: codedDomains = {domain.name: domain.codedValues.keys() for domain in arcpy.da.ListDomains(gdb) if domain.domainType == 'CodedValue'} Basically, it uses a list comprehension to populate a dictionary, but only if it is a coded value domain. If you wanted to have it populated with the description instead of the coded value, ...


7

I'm not sure which version of ArcGIS you are working with, or if you've come across this since posting, but in version 10.1 there is an environment setting under "Fields" called "Transfer Field Domain Descriptions". I've used it on occasion in the Feature Class to Feature Class tool to export to shapefile and it seems to do the trick (if you don't mind your ...


7

Business rules vs data integrity rules When you model your database, you specify the business logic in two spaces: a. The data integrity rules. This includes among others having an integer column so users won't be able to enter strings. b. The business domain rules. This includes having check/unique/foreign key constraints on columns so it won't be ...


6

I think the easiest way to do this would simply be to use the Table to Domain GeoProcessing tool, which you could run directly within the software or call via arcpy. You can get details about the tool at http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000025000000 but basically it assumes you have a table that in your case would have a ...


6

Maybe a few pictures would help. A subtype field can be set to categorize the main types (rock, soil, debris); This would correlate to Field_1. Notice the desc field domain is set to rock. Each subtype can set a domain for the desc field. The soil subtype has the soil subtype for the desc field. You will need to make domains for acceptable values for ...


6

You cannot use a domain to do this and as far as I know you cannot do this, since it violates the tableview design. You want to violate a coded value domain, which will generate a validation violation when you run Validation for the field. A coded value domain can only be violated with runtime user defined values if the user uses the Field Calculator to ...


6

In a coded value domain, the values are stored as 1, 2, 3 and not as ARTERIAL_CRACKSEAL, ARTERIAL_MICROSEAL, ARTERIAL_OVERLAY. To make your code work with the coded values, change your if lines to refer to the codes: def checkValue(c, d): if c == 1: return 'ACS' if c == 2: return 'AMS' if c == 3: return 'AOL' if c == ...


6

When you copy a feature class to an in_memory workspace then all that I would have expected you to be copying is a feature class. However, when I ran the test below it created output that indicates that the domains associated with a feature class are copied into the in_memory workspace, and if that in_memory feature class is copied out to a new file ...


6

You could export a featureclass that uses the domain from the original gdb to the new one and select transfer field domain descriptions from the 'Fields' section of Environments. The process is described in more detail here: http://support.esri.com/technical-article/000011973 Or you could use the "Domain To Table" tool (in ArcToolBox > Data Management Tools ...


6

Your database has Domain or dataset has subtype. If you want to manage them you can add more parameters for the domain or subtype. see Create subtypes and attribute domains to manage domains : Right click to the database , select properties then click Domains tab. now you can edit or delete domains. to manage subtypes: right click to the feature class , ...


5

The domains workspace property returns a Python list. If there are no domains in the workspace, then the list is empty: >>> desc3 = arcpy.Describe(r'D:\Temp\NcLidar.gdb') >>> domains3 = desc3.domains >>> domains3 [] If you have one domain, you get a list with a single element: >>> desc2 = arcpy.Describe(r'D:\Projects\...


5

This code should return what is being asked. It will succinctly traverse all feature classes and tables in a workspace GDB/FS and return all fields associated with a domain, the field name, and the feature class/table it belongs in. import os import arcpy lst=[] for dirpath,dirnames,files in arcpy.da.Walk( # the path to your workspace , datatype=["...


5

You will need to be using ArcGIS 10.1 to use the da (Data Access) module but it looks like the Domain class has a codedValues property that can be used to obtain a Python dictionary containing the coded values for attribute domains.


5

My guess is the gdb the featureclass lives in does not have any domains defined. Without any domains in the GDB, the feature class fields doesnt have any to display. Try creating some in the GDB: http://resources.arcgis.com/en/help/main/10.1/index.html#/Creating_a_new_coded_value_domain/001s00000004000000/


5

arcpy.Exists doesn't handle domains. The ESRI help indicates what it does handle. So you'll need to get a list of existing domains, and then check your potential new name against the list. What version of ArcGIS are you using? 10.1 introduces a new ListDomains function. If you're on ArcGIS 10.0, then you don't have this ListDomains. In that case I think ...


5

Create lookup tables like @GeoKelvin discribed. Or use tool Domain To Table to create a lookup table. Join lookup table to feature class Export feature class to Shapefile You can automate this with Modellbuilder.


5

There is a number of toolboxes that let you work with the geodatabases (analyze feature classes, compare workspaces, etc). The toolboxes can be downloaded from here. You can reuse some of those tools in your work. The easiest way to list the fields and see what domains are used (you need to delete domains from fields first before you will be able to delete ...


5

I would suggest using QGIS for Android (or if you have a Windows tablet you have use the default desktop app). You can load any type of raster or vector data as a basemap It can work offline with GPS It has a point capture tool within the GPS Info. panel This last criteria most likely you will have to develop since this type of control is specialized. ...


5

Yes, you can do this with arcpy. I usually use arcpy.da.ListDomains to iterate through the domains but in your case you just need to see if there are any domains assigned to a field in feature classes. This code can iterate really quickly through multiple feature classes and report those that have a field that has been assigned to the domain you've specified....


5

You can get this from the FeatureLayer class. There is an attribute called fields, which is an array of Field objects. The Field class has domain attribute. The following will output the domains in the console (if any): var map = new Map(...); var fl = new FeatureLayer(...); map.addLayer(fl); // when layer is ready fl.on("load", ()=>{ for (var i = 0;...


5

I ran into this issue a month or so ago, they don't make things easy, but I was able to find a solution--as long as you have admin rights to the layer that you want to update. You'll need to go to your REST page for the layer and add 'admin' between the Rest\Services part of the URL: From here, scroll to your attributes that contain a domain (...


5

The behaviour you describe is correct. All because you give a field a domain and set field to not allow NULLS does not mean that ArcMap will capture the fact they the user may not touch that field during editing. So when they save edits they can insert a nothing even though you have a domain. There are 2 routes here: Accept this odd behaviour then do some ...


4

As @PolyGeo mentioned, If you are using 10.1, the arcpy.da (Data Access) module contains a ListDomains function which returns a list of Domain objects, each with a codedValues property you can examine to determine if the specified value exists in a given domain. Alternatively, if this is an SDE geodatabase at version 10 or greater (in earlier versions, ...


4

There is some good documentation on the ESRI Website for setting up Domains. Here, here and here. See the links on the left of the page for even more detailed information. Is there something more specific that you need help with that isn't in the ESRI help?


4

Here's some code that exports all the domains to Excel files. Also, you are getting the error when trying to export to DBF because the word "description" is 11 characters long. ''' Export all coded value domains in a geodatabase to Excel files in the same directory ''' import os, sys import arcpy ## Ideal when testing so you don't keep getting errors arcpy....


4

This is what I imagine Matt Wilkie had to look up and write to augment Brian's code. I had to get all domains for tables, feature classes in the root directory of a database, and features in all feature datasets. I exported the information as a csv to allow some other workers to clean up our geodatabase environments of old domains. def domainInfo(...


4

Zip and upload is not going to work. As it says at the bottom of hypelink you have to share your MAP as feature service.


Only top voted, non community-wiki answers of a minimum length are eligible