|
POST
|
There were a couple of things in the field mapping that I noticed. First, the "255 Double" should probably be "8 Double" as the field size of a double is 8 bytes. In my tests, the 255 didn't seem to matter as Double may have overridden. But if the field names from the source table are not correct, this may be a problem. Second, you are using "TXT.txt" in the comment row mapping. This should probably be the variable TXT which is referencing your source txt/csv file. In the field mapping the first reference is to the field name in the new table, followed by (in double quotes) the alias for that field. The source table name is near the end of the mapping; in this case you are using the variable TXT. Following the source table name is the field name in the source table, in this case you appear to be using Field1...Field7 in your txt/csv table. I would try: arcpy.TableToTable_conversion(TXT, GDB, 'Output_Table', '#', r'IDCODE "Field1" true true false 4 Long 0 0 ,First,#,TXT,Field1,-1,-1;PARAM "Field2" true true false 8 Double 5 10 ,First,#,TXT,Field2,-1,-1;LON "Field3" true true false 8 Double 5 10 ,First,#,TXT,Field3,-1,-1;LAT "Field4" true true false 8 Double 5 10 ,First,#,TXT,Field4,-1,-1;VALUE "Field5" true true false 8 Double 5 10 ,First,#,TXT,Field5,-1,-1;REF_ID "Field6" true true false 4 Long 0 0 ,First,#,TXT,Field6,-1,-1;COMMENT "Field7" true true false 255 Text 0 0 ,First,#,TXT,Field7,-1,-1', '#')
... View more
07-28-2017
11:09 AM
|
1
|
5
|
2414
|
|
POST
|
After a quick look, Map Server - and the other string values - should be quoted: "Map Server". I would suggest using a service like jsonlint.com to verify that your json is properly formatted. See JSON Data Types (and related pages at w3schools.com) for some additional information on formatting numbers, booleans, arrays, and nulls.
... View more
07-27-2017
03:50 PM
|
0
|
0
|
2030
|
|
POST
|
Can you post your json file? The error indicates it is missing the type parameter. There is a sample json file on the page you referenced. According to the sample, the type should be something like: "type": "MapServer"
... View more
07-27-2017
03:06 PM
|
0
|
0
|
2030
|
|
POST
|
I have tried the OP's code, and it seems to work. It could be the visibility scale or one of the items Joshua Bixby is asking about in his first post.
... View more
07-27-2017
10:10 AM
|
0
|
0
|
4683
|
|
POST
|
Can you show how you were trying to implement this code in your tool?
... View more
07-26-2017
02:14 PM
|
0
|
0
|
3307
|
|
POST
|
Following Pan gis's suggestion, after running the Remove Domain From Field tool from the ArcToolbox in ArcMap, I clicked on the Geoprocessing tab, then copied the Results as a Python snippet. This will show how ArcMap populates the tool's parameters. arcpy.RemoveDomainFromField_management(in_table="PW_Conduit_Wire",
field_name="FLOOR_ID",
subtype_code="'1: Earth NET';'2: ELTW';'3: LTW';'4: Conduit'") After checking the ListSubtypes documentation, I came up with the following code which should remove the domains from the features using subtypes. import arcpy
gdb = r'C:\Path\To\COBW_Power.gdb'
arcpy.env.workspace = gdb
domains = ['CD_Level','CD_FittingDiameter','CD_FittingMaterial',
'CD_Diameter','CD_Material','CD_Ownership','CD_Parcel ID']
for fds in arcpy.ListDatasets('','Feature'):
print "DS: {}".format(fds)
for fc in arcpy.ListFeatureClasses("*","",fds):
print "\tFC: {}".format(fc)
subtypes = arcpy.da.ListSubtypes(fc)
# loops through feature class' subtypes one at a time
for stcode, stdict in list(subtypes.items()):
for stkey in list(stdict.keys()):
# if there is a Subtype Field (that is, it is not an empty string)
if not stdict['SubtypeField'] == '':
st_code = "'{}: {}'".format(stcode, stdict['Name'])
if stkey == 'FieldValues':
fields = stdict[stkey]
for field, fieldvals in list(fields.items()):
# if field has a domain
if not fieldvals[1] is None:
# and the domain is in our list
if fieldvals[1].name in domains:
# delete the domain
print("\t\t{} domain deleted from field {} in subtype {}".format(fieldvals[1].name, field, st_code))
arcpy.RemoveDomainFromField_management(in_table=fc, field_name=field, subtype_code=st_code)
print "Done." My previous code should remove the remaining domains from features not using subtypes. ===== Edit: After some additional thought, here is a version that will remove domains from fields whether using subtypes or not. Basically, I added an else on line 21 to pass RemoveDomainFromField a "#" if the feature doesn't use a domain. The indentation, starting at line 23, was changed as a result. import arcpy
gdb = r'C:\Path\To\COBW_Power.gdb'
arcpy.env.workspace = gdb
domains = ['CD_Level','CD_FittingDiameter','CD_FittingMaterial',
'CD_Diameter','CD_Material','CD_Ownership','CD_Parcel ID']
for fds in arcpy.ListDatasets('','Feature'):
print "DS: {}".format(fds)
for fc in arcpy.ListFeatureClasses("*","",fds):
print "\tFC: {}".format(fc)
subtypes = arcpy.da.ListSubtypes(fc)
# loops through feature class' subtypes one at a time
for stcode, stdict in list(subtypes.items()):
for stkey in list(stdict.keys()):
# if there is a Subtype Field (that is, it is not an empty string)
if not stdict['SubtypeField'] == '':
st_code = "'{}: {}'".format(stcode, stdict['Name'])
# if no Subtype Field, use "#" in RemoveDomainFromField for subtype_code
else:
st_code = "#"
if stkey == 'FieldValues':
fields = stdict[stkey]
for field, fieldvals in list(fields.items()):
# if field has a domain
if not fieldvals[1] is None:
# and the domain is in our list
if fieldvals[1].name in domains:
# remove the domain
print("\t\t{} domain removed from field {} using subtype {}".format(fieldvals[1].name, field, st_code))
arcpy.RemoveDomainFromField_management(in_table=fc, field_name=field, subtype_code=st_code)
print "Done."
... View more
07-25-2017
10:23 PM
|
3
|
2
|
8237
|
|
POST
|
You mentioned a "custom basemap." Does the map work offline with a different basemap?
... View more
07-25-2017
05:13 PM
|
0
|
1
|
1890
|
|
POST
|
Glad to be of help. It's a learning experience for me, too.
... View more
07-24-2017
10:40 AM
|
1
|
0
|
2981
|
|
POST
|
The "#" is a place holder. It is basically a python comment that can be used in arcpy instead of None. You might try the SetSeverityLevel tool to trap on warnings. >>>
... # Set the severity level to 1 (tool warnings will throw an exception)
... arcpy.SetSeverityLevel(1)
... try:
... arcpy.Delete_management("MyDataxyz","#")
... except arcpy.ExecuteWarning:
... print(arcpy.GetMessages(1))
... except arcpy.ExecuteError:
... print(arcpy.GetMessages(2))
...
WARNING 000110: MyDataxyz does not exist
>>>
... View more
07-24-2017
09:06 AM
|
2
|
2
|
2981
|
|
POST
|
Under the Feature Layer's Settings, verify that "Enable Sync (disconnected editing with synchronization)" is checked. And in the Web Map's Settings, there is a check box to "Enable offline mode."
... View more
07-23-2017
09:06 PM
|
0
|
1
|
4245
|
|
POST
|
Since you are working with feature datasets, the loop should start with ListDatasets. I added a few lines to Mitch Holley's code. import arcpy
gdb = r'C:\Path\To\COBW_Power.gdb'
arcpy.env.workspace = gdb
domains = ['CD_Level','CD_FittingDiameter','CD_FittingMaterial',
'CD_Diameter','CD_Material','CD_Ownership','CD_Parcel ID']
for fds in arcpy.ListDatasets('','Feature'):
print "{}".format(fds)
for fc in arcpy.ListFeatureClasses('','',fds):
print "\t{}".format(fc)
for field in arcpy.ListFields(fc):
if field.domain in domains:
arcpy.RemoveDomainFromField_management(fc,field.name)
print "\t\t{} domain removed from field {}.".format(field.domain, field.name)
print "Done."
... View more
07-23-2017
08:33 PM
|
2
|
3
|
6660
|
|
POST
|
The arcpy.Delete_management tool presents a warning message 000110 <item> does not exist and not an error which would stop execution. The tool then continues with a succeeded message. You may need to look at a log file to see the warnings, or use your second option to check for existence of item before attempting a delete. See GetMessage and the related help files to access these messages. >>> arcpy.Delete_management("MyDataxyz","#")
<Result 'true'>
>>> for i in range(0,arcpy.GetMessageCount()):
... print arcpy.GetMessage(i)
...
Executing: Delete MyDataxyz #
Start Time: Fri Jul 21 15:12:42 2017
WARNING 000110: MyDataxyz does not exist
Succeeded at Fri Jul 21 15:12:42 2017 (Elapsed Time: 0.00 seconds)
>>>
... View more
07-21-2017
03:11 PM
|
0
|
4
|
2981
|
|
POST
|
Your first section of code in the def_main() function appears not to be indented properly. That may be the an issue. Also, when posting code, it helps to use the syntax highlighter. See: Code Formatting... the basics
... View more
07-21-2017
02:48 PM
|
0
|
1
|
2981
|
|
POST
|
Typically, when I create domains, I create a table, add the fields and then import data from a spreadsheet. Then I convert the table to a domain. The process is automated with a python script. See my comments in Importing domains from Excel for a sample script.
... View more
07-19-2017
11:19 AM
|
0
|
1
|
1067
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-27-2016 02:23 PM | |
| 1 | 09-09-2017 08:27 PM | |
| 2 | 08-20-2020 06:15 PM | |
| 1 | 10-21-2021 09:15 PM | |
| 1 | 07-19-2018 12:33 PM |
| Online Status |
Offline
|
| Date Last Visited |
02-12-2026
07:13 PM
|