|
POST
|
First, I would use a date format that is suitable for sorting: YYMMDD. Append this to your feature names when backing up. You can then append the feature name to a list (if it starts with, contains, etc. what you are looking for) when you loop through a ListFeatureClasses or ListLayers, sort the list and then pick the first or last item in the sorted list as the oldest or newest. features = ['Hyrdo_FINAL_ALL_171218','Hyrdo_FINAL_ALL_171012',
'My_Feature_170101', 'Another_Feature_161012']
found = []
for feature in features:
if feature.startswith('Hyrdo_FINAL_ALL_'): # assumes this is name up to date
found.append(feature)
found.sort()
print found[-1:]
... View more
12-21-2017
10:53 AM
|
1
|
0
|
5541
|
|
POST
|
In the ArcGIS REST API there is mention of how to Update Definition (Feature Service) and Update Definition (Feature Layer). In your workflow, I would suggest that you copy and save the desired settings from the service/layer you are updating, overwrite the service and then use the saved settings make any final tweaks.
... View more
12-20-2017
11:57 AM
|
0
|
0
|
732
|
|
POST
|
To use the input from your original post, you might try: import json
jsonIn = r'input.json'
jsonOut = r'output.json'
input_file=open(jsonIn, 'r')
result = json.loads(input_file.read())
# start a geojson file - change spatial reference as required
geo = {
"type" : "FeatureCollection",
"crs" : { "type" : "name",
"properties" : {
"name" : "EPSG:4326"
}
},
"features" : None
}
feature_list = []
fCount = 0
for k, v in result.iteritems():
for x in v: # values are in a list
fCount += 1
features = {"type" : "Feature", "id" : fCount, "properties" : None, "geometry" : None }
props = []
if isinstance(x, dict):
for k1, v1 in x.iteritems():
if isinstance(v1, dict):
# found dictionary, assume geometry
for k2, v2 in v1.iteritems():
features["geometry"] = {k2: v2}
else:
props.append({k1: v1})
features["properties"] = props
feature_list.append(features)
geo["features"] = feature_list
with open(jsonOut, 'w') as outfile:
json.dump(geo, outfile) This reformats your original json into geojson.
... View more
12-19-2017
12:28 PM
|
3
|
1
|
3452
|
|
POST
|
And it might also be helpful to review this question: Convert JSON into FeatureCollection. You will probably want to insert some projection info, to make this valid ESRI json. COUNTYRINGFEATURE would become geometry; and COUNTY and COUNTYOID would become attributes.
... View more
12-18-2017
02:23 PM
|
1
|
0
|
3452
|
|
POST
|
Check out example 2 in this blog: Turbo Charging Data Manipulation with Python Cursors and Dictionaries. It describes a process that could help since there are issues with doing a join for your project..
... View more
12-15-2017
09:31 AM
|
0
|
0
|
4494
|
|
POST
|
Can you print the field names of your joined feature? I suspect they might be different than what you are expecting.
... View more
12-14-2017
11:27 PM
|
2
|
4
|
4494
|
|
POST
|
Thanks. And things like "include arcpy" are not part of the section being timed?
... View more
12-14-2017
12:41 PM
|
0
|
3
|
2557
|
|
POST
|
How are you timing the scripts? Also, is this inside/outside arcmap?
... View more
12-14-2017
12:25 PM
|
1
|
5
|
2557
|
|
POST
|
A clean, efficient solution. Thanks for sharing bixb0012.
... View more
12-14-2017
09:27 AM
|
0
|
0
|
7530
|
|
POST
|
There are no properties documented to select the advanced option or parser for the LabelClass. You can use some Formatting tags in your labels to display color. You might use the Field Calculator to populate a second label field with text that includes color tags, such as: # code block
def colorLabel(attrib, label):
if attrib == 1:
return '<CLR red = "255">{}</CLR>'.format(label)
elif attrib == 2:
return '<CLR blue = "255">{}</CLR>'.format(label)
elif attrib == 3:
return '<CLR red = "255" green = "255">{}</CLR>'.format(label)
else:
return label
# expression
colorLabel(!AttributeField!, !LabelField!)
... View more
12-13-2017
08:19 PM
|
0
|
0
|
1627
|
|
POST
|
And using your code, this would go in the code block: from string import ascii_lowercase
import itertools
def iter_all_strings():
size = 1
while True:
for s in itertools.product(ascii_lowercase, repeat=size):
yield "".join(s)
size +=1
s = iter_all_strings()
The expression would be: s.next() The generator needs to be set up in the code block.
... View more
12-13-2017
05:24 PM
|
2
|
1
|
7530
|
|
POST
|
Using a modified number base function, try this in the code block: i = -1
def letterString():
global i
i += 1
return toStr(i,26)
def toStr(n,base):
convertString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if n < base:
return convertString[n]
else:
return toStr(n//base-1,base) + convertString[n%base] and this for the expression letterString() Basically, you will need to set up a global variable in your code block and increment it each time your function is called.
... View more
12-13-2017
04:25 PM
|
1
|
0
|
7530
|
|
POST
|
It might be related to license level. From the page you mentioned: all geoprocessing tools in the Attachments toolset require an ArcGIS for Desktop Standard or Advanced license. For options, you might find something helpful in this thread: How to manage Collector app photos and features without Standard license.
... View more
12-05-2017
09:43 PM
|
0
|
1
|
909
|
|
POST
|
Nice trick Joshua Bixby. I tried the lyr._arc_object.getsymbology() in version 10.2.1. Looks like it gives RGB and a transparency? value. (Additional note: This isn't a perfect way as it sometimes gets the wrong style and no colors -- which is probably why it is undocumented.) I created a copy of ArcMap's standard color selections as an Excel spreadsheet (attached). It displays a color swatch along with RGB values and a gray-scale value. I will print the sheet to see what the colors will look like when printed on different printers. For custom colors, you will need to note the RGB value.
... View more
12-05-2017
04:16 PM
|
1
|
0
|
8231
|
|
POST
|
I ran your code both inside and outside ArcMap without missing any joins in my test map. If you remove the "and not l.isBroken" from line 8, do you get the same results?
... View more
12-04-2017
08:27 PM
|
0
|
1
|
3612
|
| 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
|