Skip to main content
12 events
when toggle format what by license comment
Apr 30, 2015 at 20:58 comment added mr.adam yes, it would be misleading to give an answer to your second question here, and it's pretty messy to smash it all into the comments like this.
Apr 30, 2015 at 20:55 comment added dhowal Okay will do @Aaron . New to this so still need to get the hang of things. Thanks for your help.
Apr 30, 2015 at 20:54 comment added Aaron @DhowalDalal I would recommend opening a follow-up question if you cannot find a solution in the GIS SE archives.
Apr 30, 2015 at 20:51 comment added dhowal [email protected] , the merge tools do accept a list .
Apr 30, 2015 at 20:50 comment added dhowal Thanks @mr.adam , ill give it a try but not sure where to eneter the second bit of code as im quite a newbie .
Apr 30, 2015 at 20:50 comment added mr.adam like this: for value in fc_dict.values(): arcpy....merge(value,output_fc,etc.) I assume the Merge tools accepts a list for input.
Apr 30, 2015 at 20:48 comment added mr.adam Sure. What I would do is put fc_dict = {} right underneath fcs = []. While "walking", if filename in fc_dict.keys(): fc_dict[filename].append(os.path.join(dirpath, filename)) else fc_dict[filename] = [os.path.join(dirpath, filename)]. You'll create a dictionary where the key is the filename and the value is a list of all the corresponding files. At the very end of the script, iterate the dictionary and merge each value. dictionaries are one of the best things about python. docs.python.org/2/tutorial/datastructures.html#dictionaries
Apr 30, 2015 at 20:41 vote accept dhowal
Apr 30, 2015 at 20:40 comment added dhowal That`s right @mr.adam ,well spotted and thank you to @aaron as well for the quick reply. You have both been much help. Any ideas how I can take this one step further and merge all the shaepfiles that have same filenames ? thanks in advance.
Apr 30, 2015 at 20:26 comment added Aaron Nice addition @mr.adam.
Apr 30, 2015 at 20:17 comment added mr.adam Unsure if OP wants full directory path, or just the name of the folder. If just the name is desired, replace dirname = os.path.dirname(fc) with dirname = os.path.basename(os.path.dirname(fc)).
Apr 30, 2015 at 19:42 history answered Aaron CC BY-SA 3.0