|
POST
|
Try the command without giving a width and height. I think if you use just "resolution=300" then the height and width will be calculated for you.
... View more
09-08-2017
02:17 PM
|
0
|
0
|
4843
|
|
POST
|
As Dan Patterson mentioned, some of you issues may be with formatting. The indentation is not very clear from the code posted. In line 41 you are creating a new field "YEAR", and in line 44 you are using the codeblock to populate that new field. Since the new field is set to null, the codeblock section probably isn't doing a valid comparison. I would suggest removing the codeblock and replacing the expression with the year. year = 1997 # this is essentially year from the loop
# Execute CalculateField
arcpy.CalculateField_management(inPointFeatures, fieldName, year, "PYTHON_9.3", "#")
... View more
09-08-2017
10:24 AM
|
2
|
1
|
3084
|
|
POST
|
I hope I am understanding your question. I don't believe that you can update a table and have it automatically update a domain. After updating a table, you can use the Table to Domain tool to create or update a domain. Depending on how your service is hosted, you will probably need to do some additional steps to push it to your crews. For AGOL, you can update the JSON file associated with a feature service to add items to a field's domain. See Updating Hosted Feature Services in ArcGIS Online (specifically the PDF article mentioned in the blog) for instructions. Basically, you will be updating one field, and the section of the JSON would look something like this: {
"fields": [{
"name": "roadCrew",
"type": "esriFieldTypeString",
"alias": "Road Crew",
"sqlType": "sqlTypeOther",
"length": 2,
"nullable": false,
"editable": true,
"domain": {
"type": "codedValue",
"name": "crew",
"codedValues": [{
"name": "Team One",
"code": "01"
},
{
"name": "Team Two",
"code": "02"
}]
},
"defaultValue": null
}]
}
Just add another item ("Team Three", for example) to the domain list: {
"fields": [{
"name": "roadCrew",
"type": "esriFieldTypeString",
"alias": "Road Crew",
"sqlType": "sqlTypeOther",
"length": 2,
"nullable": false,
"editable": true,
"domain": {
"type": "codedValue",
"name": "crew",
"codedValues": [{
"name": "Team One",
"code": "01"
},
{
"name": "Team Two",
"code": "02"
},
{
"name": "Team Three",
"code": "03"
}]
},
"defaultValue": null
}]
} Use a service like jsonlint.com to validate your planned changes. Experiment with a backup or test service so you can work out any issues. I also recommend not deleting items from a domain as that may cause unexpected issues. Once updated, your crew will need to refresh their maps to see the changes. I hope this helps.
... View more
08-30-2017
09:28 PM
|
0
|
0
|
994
|
|
POST
|
Thanks, Dan. It does appear that the array declaration needs to happen after the InsertCursor line for the removeAll method to work. I have modified the code in my previous post to show this correction.
... View more
08-27-2017
11:24 AM
|
0
|
1
|
3580
|
|
POST
|
It looked as if ID wasn't being properly adjusted. I also did not see where "date" in your insertRow code (renamed to refDate/feature_date in code below) was being set to anything. For testing, I omitted the try/except code; you will probably want that back in. Check the field names in line 18, and make sure they are properly defined in the shapefile you are using. import arcpy
output = [
[1, 495793.75484, 4136019.7269, u'N_1_3', u'7_11_2014'],
[1, 495807.176907, 4135867.38434, u'N_1_3', u'7_11_2014'],
[1, 495798.121445, 4135755.3755, u'N_1_3', u'7_11_2014'],
[1, 495748.534282, 4135576.17606, u'N_1_3', u'7_11_2014'],
[2, 488489.093623, 4134784.63412, u'W_3_1', u'7_11_2014'],
[2, 488300.441633, 4134703.96516, u'W_3_1', u'7_11_2014'],
[2, 488056.638959, 4134616.0752, u'W_3_1', u'7_11_2014']
]
fc = r"C:\Path\To\test.shp"
ID = -1
# assumes names of fields are properly defined in shapefile
cur = arcpy.da.InsertCursor(fc, ["SHAPE@", "Name", "refDate"])
array = arcpy.Array([]) # array needs to be created after InsertCursor
for coords in output:
if coords[0] == ID:
array.append(arcpy.Point(coords[1], coords[2]))
else: # next feature
# process previous array
if ID > 0:
polyline = arcpy.Polyline(array)
cur.insertRow([polyline, feature_name, feature_date])
# begin new array
array.removeAll()
ID = coords[0]
array.append(arcpy.Point(coords[1], coords[2]))
feature_name = coords[3]
feature_date = coords[4]
# add the last feature
polyline = arcpy.Polyline(array)
cur.insertRow([polyline, feature_name, feature_date])
del cur
print 'Done.' Hope this helps. Update: I was having some problems with "array.removeAll()" in line 33. It didn't seem to be always clearing the array. After following Dan Patterson's advice to move the array declaration to follow InsertCursor, line 33 appears to be working correctly.
... View more
08-26-2017
06:07 PM
|
1
|
3
|
3580
|
|
DOC
|
The error suggest there is no field named OBJECTID (this is set at line 9 "uniqueID"). The field names are listed on your layer screen when you scroll down.
... View more
08-24-2017
09:41 AM
|
1
|
0
|
36417
|
|
POST
|
There is some discussion on this topic in an older thread: Collector: use related layer to symbolise feature. It may have some things to try, but I don't believe there is a solid solution.
... View more
08-21-2017
05:07 PM
|
1
|
0
|
2438
|
|
POST
|
Perhaps this may help: Using the current and scratch workspace environments
... View more
08-20-2017
09:20 PM
|
0
|
0
|
1361
|
|
POST
|
Not a python question, but... Right click on the map's legend and select properties. On the Items tab, right click on the FA_Switch layer and select properties. On the General tab, check "Show Layer Name" and click OK. On Legend Properties, click Apply.
... View more
08-20-2017
08:20 PM
|
1
|
1
|
1504
|
|
POST
|
The JSONToFeatures Tool does not like the OBJECTID definition in the JSON file. The JSON contains the following in the "fields" section: "fields" : [
{
"name" : "OBJECTID",
"type" : "esriFieldTypeInteger",
"alias" : "OBJECTID",
"sqlType" : "sqlTypeOther",
"domain" : null,
"defaultValue" : null
},
{ Note the setting for "type" which is "esriFieldTypeInteger". When testing it with ArcMap 10.5 using a file geodatabase, the tool wanted to duplicate this field as it wants the type of the OBJECTID to be "esriFieldTypeOID". There are a couple of things you can do. The easiest is to edit the JSON by changing the type on line 12 as indicated below. Your script that processes the JSON could include some code to make the edit for you. {
"objectIdFieldName" : "OBJECTID",
"globalIdFieldName" : "",
"geometryType" : "esriGeometryPoint",
"spatialReference" : {
"wkid" : 102100,
"latestWkid" : 3857
},
"fields" : [
{
"name" : "OBJECTID",
"type" : "esriFieldTypeOID",
"alias" : "OBJECTID",
"sqlType" : "sqlTypeOther",
"domain" : null,
"defaultValue" : null
},
{
A second option would be to do a global replace of "OBJECTID" with something like "OBJ_ID" in the JSON file. You would also need to set line 2 to an empty string ( "objectIdFieldName" : "" ). Then the tool would create a new OBJECTID. As this option is a bit more complicated, I would use the first suggestion - just change the type to "esriFieldTypeOID". Hope this helps.
... View more
08-17-2017
08:16 PM
|
1
|
2
|
4155
|
|
POST
|
Per Dan's suggestion, paste the following code into the codeblock (top) section. def func_shun(a, b):
the_result = [a, ""][a == b]
return the_result
In the lower section, paste only the following (I think I have the spelling of your joined tables correct): func_shun( !asrerror_log_20170803.STR_NUM!, !cam_apn_old.SITUS_NR!) VB would use square brackets around the field names, but Python uses exclamation marks. So field calculator is getting confused. You do have the Python parser selected. The photo in my post below should help.
... View more
08-17-2017
05:53 PM
|
1
|
0
|
5389
|
|
POST
|
Agreed. I hadn't noticed the [ False, True ][ Condition ] check before this post. It has a nice elegance to it, and it will come in handy. Thanks.
... View more
08-17-2017
05:25 PM
|
0
|
0
|
1334
|
|
POST
|
Following up on Dan Patterson's response: It is also possible to do this in 1 line (without the codeblock section): Also, it looks like you are trying to compare strings and store the result in a field that holds a string (result_field in the photos). If not, you may also need to do some type conversion: [!STR_NUM!,""][!STR_NUM!==str(!SITUS_NR!)]
... View more
08-17-2017
04:53 PM
|
1
|
2
|
1334
|
|
BLOG
|
I believe there should be a total of 3 xml files. "Field Match Tools.InsertSelectedFeaturesOrRows.pyt.xml" and "Field Match Tools.MultiToSingleFieldKey.pyt.xml" should also be included. The toolbox wants to create these files if they do not exist.
... View more
08-14-2017
10:27 AM
|
1
|
0
|
2434
|
|
BLOG
|
Richard, I didn't see the tool sidebar help in the 10.3 version. But the version for 10.2 includes help.
... View more
08-13-2017
09:41 PM
|
0
|
0
|
2434
|
| 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
|