|
POST
|
I used to have this data years ago in a previous job, but can't recall where I got it. Maybe we bought it. Anyway, what I was told is that WV used to have legal descriptions based on the old colonial days, e.g. '300 feet northwest of the big oak tree, then to the southern bend in Yancy Creek', or some such. This wasn't very accurate, and trees fall, streams move, etc. So at some point WV said screw it, measured all their parcels and said 'This is it'. I've been told by surveyors that other new England area states have/had the same problem.
... View more
11-25-2014
01:01 PM
|
2
|
0
|
1167
|
|
POST
|
Yes, what I was thinking is that maybe the field name is correct, but Arc is only associating it internally with the new features. There could be a corrupt table in the gdb, but I wouldn't play with those.Try removing the layer and adding it back. Or add it to a new map and see if it works. You could also try running MXD Doctor against the mxd. If none of those work, try exporting the file to a shapefile or new feature class and exporting it back (or just add it back in if that works for you).
... View more
11-25-2014
07:54 AM
|
0
|
2
|
1681
|
|
POST
|
Hmm... not getting an error in a script I just wrote, but maybe it's not overwriting either? Will have to check this out. Good to know.
... View more
11-25-2014
07:48 AM
|
0
|
0
|
1267
|
|
POST
|
Wait - are you saying that if I set arcpy.overwriteOutput = True in a stand alone script run from an IDE (PyScripter, in my case) it has no effect? Or maybe I'm misunderstanding. That's not my takeaway from the help files, 'Environment values set within scripts only apply to the execution of the script'. Am I missing something?
... View more
11-25-2014
05:01 AM
|
0
|
3
|
7703
|
|
POST
|
Did you go into the Labels tab and check which field(s) are being used for labelling? You could try removing labelling, then adding it back. Was the field indexed? Even though you restored the original field name, maybe Arc uses some kind of internal ID to reference it, so doesn't 'see' the old fieldname (just a guess). You could add a new field and calculate the values into that if needed, then use that for labelling.
... View more
11-24-2014
04:57 AM
|
0
|
4
|
1681
|
|
POST
|
This post might be more useful if posted in the Python 'space', rather than the general 'Developers' space. Good link though.
... View more
11-21-2014
04:15 PM
|
2
|
1
|
1384
|
|
POST
|
Xander Bakker, your first bullet point was actually correct. It didn't occur to me until just now, because I'd previously used a longer function that did rename the feature class. Didn't take that into account when I refactored the code. Once I checked and renamed k when sfc = Chatham, it ran fine. It would be nice if ESRI actually had a specific exception class for this, instead of handing it to a generic 999999 ExecuteError exception, but oh well. Thanks for your help.
... View more
11-21-2014
09:16 AM
|
0
|
1
|
1855
|
|
POST
|
If you use r before the string, use the regular Windows backslash in your path - \. Using a forward slash is for when you don't use r. Using it the way you have above, python interprets the forward slash as just that, a forward slash, which does not work on Windows.
... View more
11-21-2014
05:58 AM
|
0
|
0
|
2945
|
|
POST
|
Yes, the feature class name is unique. To be precise, it overwrites an existing one, but env..overwriteOutput is True The where clause should be correct, since it works for AllCounties. Almost all the where clauses are in the format "FCC" LIKE 'H1%', (the letter/number changes for different feature classes). This string is stored in the Definitions field of the relevant table. No selection, this is all done in a stand-alone script. I guess I don't know if the where clause returns results. I don't know why it wouldn't, since it does for AllCounties, which has the same schema as Chatham. AllCounties is just a merge of Chatham and three other counties, all same schema. If both AllCounties and Chatham failed I might have a path to understanding what went wrong, but since one works and the other doesn't, I'm at a loss. I've tried running Chatham first, but that doesn't work either.
... View more
11-21-2014
05:28 AM
|
0
|
0
|
1855
|
|
POST
|
Thanks Xander Bakker , that's just a typo when I copied the code over. The error occurs on line 24 of the 2nd code block. arcpy.FeatureClassToFeatureClass_conversion(src, target, k, v) When I've printed all the values, they all appear to be correct. The only thing I can think is that the sql expression, v above, is incorrect, but they're the same in the AllCounties version which does work. They come from the same tables.
... View more
11-20-2014
02:48 PM
|
0
|
2
|
1855
|
|
POST
|
I've got two feature classes, one with data for four counties, and one with data for just one of the counties. I extract data from these feature classes into new feature classes in other feature datasets via arcpy.FeatureClasstoFeatureClass. The calling code is the first code block below. The relevant code for extractFeatures() is in the second code block The the new feature class names, and the expressions used to extract them, are in tables. However, although they seem identical,AllCounties runs fine, but Chatham fails with a 999999 Execute Error function. A typical expression would be something like "FCC" LIKE 'H1%'. I've printed out all the values and they seem correct. I don't see any essential difference between one run through the code and another. Can anyone see what's going wrong here? Thanks.
# CALLING CODE
# tbls = dictionary of table name : feature dataset pairs
# extract features for all four counties
sfc = 'AllCounties'
tbls = {'BoundaryDefinitions' : 'Boundaries',
'TransportationDefinitions' : 'Transportation',
'HydroDefinitions' : 'Hydrology'}
for k, v in tbls.iteritems():
extractFeatures(k, sfc, v)
# extract features for Chatham County only.
sfc = 'Chatham'
tbls = {'BoundaryDefinitions' : 'ChathamBoundaries',
'TransportationDefinitions' : 'Chathamransportation',
'HydroDefinitions' : 'ChathamHydrology'}
for k, v in tbls.iteritems():
extractFeatures(k, sfc, v)
# in extractFeatures()
# get feature class name/extraction expression pairs
tbl = os.path.join(targetGDB, tblnm)
flds = ('Name', 'Definition') # field names in table
defs = {}
try:
with arcpy.da.SearchCursor(tbl, flds) as rows:
for row in rows:
defs[row[0]] = row[1]
# print error message and return empty dictionary to prevent further processing
except exception as e:
s = '\n\tError: unable to retrieve values from {0}.\n\t{1}\n'
print(s.format(tbl, e.message))
defs = {}
# data was returned from the definition table
if defs:
sds = 'Framework'
src = os.path.join(targetGDB, sds, sfc)
target = os.path.join(targetGDB, tds)
for k, v in defs.iteritems():
try:
arcpy.FeatureClassToFeatureClass_conversion(src, target, k, v)
print('\tExtracted {0} from {1} to {2}.'.format(k, sfc, tds))
except Exception as e:
s = '\tError: {0} not extracted. Halting extraction of {1} features.\n\t{2}'
print(s.format(k, tds, e.message))
break
... View more
11-20-2014
01:18 PM
|
0
|
6
|
3140
|
|
POST
|
Maybe show what you've got so far, then get help for that.
... View more
11-12-2014
11:51 AM
|
0
|
1
|
2963
|
|
POST
|
I think the problem with that would be in the formatting of data. There are potentially n number of commas in n number of fields. Not to say it couldn't be done, but it wouldn't be a very efficient process.
... View more
11-11-2014
05:44 PM
|
0
|
0
|
3666
|
|
POST
|
Well, that is the format for csv files. You could do some fancy checking and replacing. It looks like from your example that the first intended field is the problem one. You could check if the next value is a year, and if not, replace the comma with a zero length string. That could be prone to error, and you may have the same problem in other fields anyway. It might be easier to make it a tab delimited or fixed length file. That's what I'd look at, anyway.
... View more
11-10-2014
01:45 PM
|
0
|
0
|
3666
|
|
POST
|
What is the field type? If it's numeric (since you mention number), you can't put a string into it. Otherwise, I don't think you can run a multiple replace in one line like that; at least, I've never seen it. Assuming this is in Field Calculator, set the parser to Python and check Show Codeblock. In Pre-Logic Script Code, enter something like: def DoThis(myField):
if myfield == '1':
val = 'description1'
elif myfield == '2':
val = 'description2'
elif myfield == '3':
val = 'description3'
.
.
.
elif myfield == '14':
val = 'description14'
else:
val = 'somedefaultvalue'
return val
In the Fieldname = box, enter
DoThis(!Fieldname!)
This assumes that Fieldname is text. If not, you'll have to add a new text field and calculate that instead. There are other ways to handle this; you could add subtypes or domains to your new feature class, for example, but the above should work ok.
... View more
10-29-2014
07:33 AM
|
0
|
0
|
848
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 08-22-2019 07:41 AM | |
| 1 | 05-05-2014 04:30 AM | |
| 1 | 08-15-2018 06:23 AM | |
| 3 | 08-06-2018 07:31 AM | |
| 1 | 03-30-2012 08:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
12-12-2021
01:00 PM
|