|
POST
|
I suppose it depends somewhat on your choice of font, but you can also copy/paste from the good, old Character Map. And, it's no coincidence that the code at the bottom is the same as in Dan's example.
... View more
06-06-2016
04:25 PM
|
1
|
1
|
22573
|
|
POST
|
Just to beat a dead horse, I get the following error when I try to save using your file name, because it contains a hyphen. No hyphen, no problem. I'm not sure why you don't see this error.
... View more
06-06-2016
11:38 AM
|
1
|
1
|
2981
|
|
POST
|
Whether or not this works for you, I don't know, but it would be intuitive to me that for each building you would consolidate the points into one, and have a single field listing the occupants/unit number separated by a special character (not sure if you can achieve this without using arcpy. Reply if you want help going down this route). Then, when labeling, in the placement properties, stack label options, specify that special character as a stacking separator.
... View more
06-03-2016
03:37 PM
|
0
|
0
|
1249
|
|
POST
|
Perhaps share the Python script you're using, or a screenshot of your tool dialog. Also, what version and product are you using? More details, please.
... View more
06-03-2016
11:16 AM
|
1
|
9
|
2981
|
|
POST
|
Aha, I stand corrected. I thought you were suggesting to use a polygon covering all points as the constraining feature class. I didn't realize you could use points as a constraint. Good answer.
... View more
06-02-2016
10:41 AM
|
0
|
0
|
1831
|
|
POST
|
>>> fc = 'all_aoi' # path to feature class or name of layer in map
... arcpy.env.workspace = r'in_memory' # default folder
... OID_field = arcpy.Describe(fc).OIDFieldName # get OID/FID field name
... with arcpy.da.SearchCursor(fc,OID_field) as cursor: # create cursor
... for row in cursor: # loop through features
... where = '{0} = {1}'.format(arcpy.AddFieldDelimiters(fc,OID_field),row[0]) # set up where clause
... arcpy.SelectLayerByAttribute_management(fc,"NEW_SELECTION",where) # select the current feature
... arcpy.CopyFeatures_management(fc,'Output_' + str(row[0])) # output feature to new feature class
... View more
06-02-2016
10:03 AM
|
1
|
0
|
7626
|
|
POST
|
I believe you'd never be guaranteed to get 10% of the points using this method because some of the new random points would be closest to duplicate original points, or vice versa. But perhaps you could provide an example. edit: fitting to the previous discussion, this would be an example of sampling with replacement.
... View more
06-02-2016
09:09 AM
|
0
|
2
|
2633
|
|
POST
|
I think Dan Patterson made a tool to do this (SplitFeatureClassByAttribute, or similar). Oh, he beat me to it. Or, you could make a ModelBuilder model using Iterate Feature Selection, followed by Copy Features. Or, if you prefer a Python answer, let me know.
... View more
06-01-2016
03:08 PM
|
1
|
3
|
7626
|
|
POST
|
I think I see what you're getting at. I was thinking of replacement within the initial sample, and you're talking about other parallel samples. It's possible that what I'm describing has a different term.
... View more
06-01-2016
11:57 AM
|
0
|
1
|
4477
|
|
POST
|
Not trying to be too confrontational, but none of that relates to my example fitting under "sampling with replacement". Even if you technically replace the possible choices (like using random does), but ignore duplicates (like using a set does), that is still sampling without replacement (you can ignore the probability of selecting a duplicate). Maybe I'm wrong, but I'd like an explanation rather than a link to an entire stats forum. Maybe the point you're missing and I need to be explicit about is that this only works using the FID field, which is guaranteed to be unique.
... View more
06-01-2016
11:01 AM
|
0
|
3
|
4477
|
|
POST
|
I'm not sure how that applies to my example. I'm not making 10% number of choices, I'm growing the set until it reaches 10% of the size of the feature count. The sample size has not been reduced by the set.
... View more
06-01-2016
10:36 AM
|
0
|
5
|
4477
|
|
POST
|
I believe using a set (vs. list) ensures that this is essentially sampling without replacement, without the performance benefit of ignoring pre-selected values. Using a list would be sampling with replacement.
... View more
06-01-2016
10:27 AM
|
0
|
7
|
13700
|
|
POST
|
I'm sure there are some gotchas with this, but quick & dirty, here's how you can do it without adding a new field: >>> import random
... fc = 'bc_geoname' # your feature class
... arcpy.SelectLayerByAttribute_management(fc,"CLEAR_SELECTION") # clear selection to consider all features
... feature_count = int(arcpy.GetCount_management(fc).getOutput(0)) # count features
... percent = 0.10 # enter your desired percentage
... rnd_set = set([]) # create a set
... while len(rnd_set) < (feature_count * percent): # do until your set is full
... rnd_set.add(random.randint(0,feature_count-1)) # make a random integer and try to add it to the set
... where = '"FID" in ({0})'.format(','.join(map(str,rnd_set))) # include set in SQL where clause
... arcpy.SelectLayerByAttribute_management(fc,"NEW_SELECTION",where) # select the FIDs in the set This runs instantly on 40,000 features, so I assume it will work for you, unless it hits some memory limit.
... View more
06-01-2016
10:10 AM
|
1
|
9
|
22179
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|