POST
|
Awesome, worked perfectly. I knew it shouldn't be that hard, but I was getting stuck. Thanks a lot!
... View more
11-07-2016
05:51 AM
|
0
|
0
|
570
|
POST
|
I have two shapefiles, one with unclassified polygons representing farms, and one with a smaller spatial scale that represents different crop types. I need to attribute the larger polygons based on the class within it with the greatest area. I've run an intersect between the two polygons and calculated the area of the resulting data. See below: FID_Unclass is an ID corresponding with every polygon I need classified. Acres is just that. I need to attribute each polygon represented in FID_Unclass with the crop type in "Value" based on the largest area Any and all help is greatly appreciated!
... View more
11-07-2016
05:39 AM
|
0
|
2
|
1282
|
POST
|
Whenever I try to access "Customize" (Add-in Manager, Extensions, Etc.) I get the following dialog box: "Retry" leaves the program hanging, waiting for a debugger to be defined, and "cancel" gives me these: Accessing "Customize" after these warnings causes ArcMap to crash. Recently I updated my .NET Framework to 4.6.1 in order to update ArcPro. I also began using ESRI's FMV add-in around the same time. I have uninstalled the add-in, uninstalled and reinstalled different versions of .NET, Repaired ArcMap installations, and nothing has worked. I know nothing about Add-in coding, Debugging, or any of this, and I cannot seem to get any answers. Please, please, please, any help is greatly appreciated! David UPDATE: I had another user log into my computer and the same error occurred for them as well.
... View more
09-13-2016
08:46 AM
|
0
|
0
|
639
|
POST
|
I'm looking to collect metadata needed for GoPro video to be used in FMV. Video is not shot with a drone (no log info), it is collected on the ground, so how can I collect the metadata needed to use this video in FMV? Can I use the multiplexer tool with GPS data collected from a handheld GPS, biking computer, or smartphone? I know this will have limitations as far as defining the camera orientation, but what is the best way to do this? Also, are there any data loggers that could be used to collect camera orientation as well? Thanks!
... View more
09-01-2016
06:06 AM
|
0
|
3
|
1987
|
POST
|
Alex, This is perfect! Worked like a charm! I really appreciate you taking the time to help me! Cheers! Dave
... View more
07-19-2016
04:41 AM
|
1
|
1
|
993
|
POST
|
Alex, Yeah that's where I was at too. Thank you for taking a look, appreciate the help! Cheers, David
... View more
07-18-2016
10:23 AM
|
0
|
3
|
993
|
POST
|
Thanks for the response Alex! So I tried creating the empty list by replacing line 58, however, it did not appear to have an updated field order It was working when I ran the just the script, but it does not appear to be setting that parameter correctly. The output was identical to the input. Also, I would like to set the input and output as parameters as well ex: intable = arcpy.GetParameterAsText(0) outtable = arcpy.GetParameterAsText(1) new_field_order = [] and then write in the field order as a string depending on the shapefile input. Thanks again for the help!
... View more
07-18-2016
07:21 AM
|
0
|
5
|
993
|
POST
|
I'm trying to make a script tool that reorders the fields in an attribute table and exports a new shapefile with the updated field order. I found a previous discussion (arctoolbox - How to re-order fields permanently using ArcGIS Make Query Table tool? - Geographic Information Systems Sta… ) with code that used the Merge tool to accomplish this, and when I hardcoded it for a test shapefile, it worked well (despite having to list out the fields in the order desired in a string - line 59). In making a script tool, I'm not sure how to set the parameter to define new_field_order. I tried setting the parameter as a string, but am getting the exception in line 38 raised. How do I set this parameter to read a user-defined order for the fields in the same way I hardcoded it? Also, is there any way to reorder the fields in a temporary attribute table in ArcMap, write code to read the temporary order, and use that order to export the new shapefile (in order to avoid having to type out the desired order)? Thanks! Dave import arcpy
def reorder_fields(table, out_table, field_order, add_missing=True):
"""
Reorders fields in input featureclass/table
:table: input table (fc, table, layer, etc)
:out_table: output table (fc, table, layer, etc)
:field_order: order of fields (objectid, shape not necessary)
:add_missing: add missing fields to end if True (leave out if False)
-> path to output table
"""
existing_fields = arcpy.ListFields(table)
existing_field_names = [field.name for field in existing_fields]
existing_mapping = arcpy.FieldMappings()
existing_mapping.addTable(table)
new_mapping = arcpy.FieldMappings()
def add_mapping(field_name):
mapping_index = existing_mapping.findFieldMapIndex(field_name)
# required fields (OBJECTID, etc) will not be in existing mappings
# they are added automatically
if mapping_index != -1:
field_map = existing_mapping.fieldMappings[mapping_index]
new_mapping.addFieldMap(field_map)
# add user fields from field_order
for field_name in field_order:
if field_name not in existing_field_names:
raise Exception("Field: {0} not in {1}".format(field_name, table))
add_mapping(field_name)
# add missing fields at end
if add_missing:
missing_fields = [f for f in existing_field_names if f not in field_order]
for field_name in missing_fields:
add_mapping(field_name)
# use merge with single input just to use new field_mappings
arcpy.Merge_management(table, out_table, new_mapping)
return out_table
intable = r"Y:\Huggins_D\2016\Tool\Export_Output.shp"
outtable = r"Y:\Huggins_D\2016\Tool\Export_Output_TEST.shp"
new_field_order = ['ZIP4', 'NAME', 'TYPE', 'ADDRESS', 'CITY', 'ZIP5', 'STATE' ,'TYPE2', 'PHONE']
reorder_fields(intable, outtable, new_field_order, add_missing=True)
... View more
07-18-2016
05:52 AM
|
1
|
7
|
2861
|
Title | Kudos | Posted |
---|---|---|
1 | 07-18-2016 05:52 AM | |
1 | 07-19-2016 04:41 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|