POST
|
Thanks for the suggestions! Especially about arcpy.da.Walk, that will be very helpful for my future scripts.
... View more
11-03-2015
05:42 PM
|
0
|
0
|
3125
|
POST
|
Wow, thanks! That explains why I have the "duplicated inputs" error message. There are many shapefiles of the same name but residing in different subfolders (or sub-subfolders). I totally missed out adding the root to the os.path.join to list the full path. Thanks for pointing my error out. Works perfectly fine now. Bless you two, Luke and Darren.
... View more
11-03-2015
05:37 PM
|
0
|
0
|
3125
|
POST
|
Hi, I am trying to build a script that combs through all shapefiles within a folder, and all it's subdivisions, and merge them together into a new shapefile. I modified it slightly from another script (sorry can't rem the source to acknowledge...). However, it prompted me this error "ExecuteError: Failed to execute. Parameters are not valid. ERROR 000400: Duplicate inputs are not allowed Failed to execute (Merge)." The script is as stated below. Can anyone tell what is wrong with it? Thank you! import arcpy, os workspace = r'C:\Users\xxx\Desktop\boundary' output_folder = r'C:\Users\xxx\Desktop\New folder' Dict = {} for root, dirs, files in os.walk(workspace): for dir in dirs: arcpy.env.workspace = os.path.join(root,dir) for fc in arcpy.ListFeatureClasses(): if not fc in Dict: Dict[fc] = [] Dict[fc].append(os.path.join(root,fc)) else: Dict[fc].append(os.path.join(root,fc)) for key in Dict: output = os.path.join(output_folder,key[:-4]) + '_merge' arcpy.Merge_management(Dict[key], output) print output + " created"
... View more
11-02-2015
05:48 AM
|
0
|
8
|
8265
|
POST
|
After playing around with some arcpy, I managed to overcome the limitation of the field calculator by using this stand alone Python script: import arcpy
#input path of gdb where original feature class resides
gdb = "C:\Users\XXX\Test.gdb"
#input original feature class path with outdated XY
basefc = "C:\Users\XXX\Test.gdb\featureclass_old"
#input feature class path of points with updated XY
newfc = "C:\Users\XXX\Test.gdb\featureclass_new"
#input field name which has a unique ID to both original and new point feature class
field = "fieldname"
list_idxy = []
with arcpy.da.SearchCursor(newfc, [field, "SHAPE@X", "SHAPE@Y"]) as cur:
for row in cur:
list_idxy.append(row)
i = 0
with arcpy.da.Editor(gdb) as edit:
with arcpy.da.UpdateCursor(basefc, [field, "SHAPE@X", "SHAPE@Y"]) as cur:
for row in cur:
print row
if row[0] == list_idxy[0]:
row[1] = list_idxy[1]
row[2] = list_idxy[2]
i += 1
cur.updateRow(row)
print "points shifted!"
... View more
09-04-2015
08:11 AM
|
0
|
0
|
1526
|
POST
|
I made a simple toolbar of 2 buttons to export the map into JPEG and PDF using Python Add-in wizard. However, I wanted to improve the script such that when I click the button, it will prompt a window to select the location to place the file, and also input the file name. Does any know how to do it? The present script is pasted below. Thanks! ----------------- import arcpy import pythonaddins class export2_jpg(object): """Implementation for export2_jpg_addin.button (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): mxd = arcpy.mapping.MapDocument('current') arcpy.mapping.ExportToJPEG(mxd,r'C:\Users\xx\Desktop\output.jpg, resolution=300') pass class export2_pdf(object): """Implementation for export2_pdf_addin.button (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): mxd = arcpy.mapping.MapDocument('current') arcpy.mapping.ExportToPDF(mxd,r'C:\Users\xx\Desktop\output.pdf') pass
... View more
07-30-2015
07:47 AM
|
0
|
2
|
5433
|
POST
|
Ok, that's a better way to do then my method. Appreciate it.
... View more
07-21-2015
07:19 AM
|
0
|
0
|
318
|
POST
|
Hi, I have created a world map in the form of a globe by defining the projection as orthographic. The feature class for display consists of the world's countries. How do I fill in the sea with a background colour for such a case? I can't use the data frame's frame tab for the defining the background colour since it will render the entire screen with that colour. Currently I have to manually create a circular feature class and set it as the background. Just wondering whether there is an easier way to accomplish the same objective. I am using ArcGIS 10.2.2 Thanks!
... View more
07-20-2015
01:32 AM
|
0
|
2
|
2962
|
POST
|
Oh, man! I should have known this! Thanks neer. What I did earlier was just moving the ranking of the symbols for display in the legend. 😕
... View more
07-09-2015
06:47 PM
|
0
|
0
|
320
|
POST
|
Hi, I have a set of symbols defined under Symbology > Unique Values, and I want to set the ranking so that the hatched symbols all appear on top of the filled ones in the map display. The arrows to assign them does not seem to do this (see print screen attached). Is this function faulty? 😕 Besides creating individual layers and arranging them in TOC, is there any other easier way to go about this? I am using 10.2.2. Thanks!
... View more
07-07-2015
05:23 AM
|
0
|
2
|
2887
|
POST
|
What I did was to changed my model to output as a shapefile instead of a feature class, and then use that function to open the .dbf table in Excel.
... View more
06-19-2015
06:58 AM
|
0
|
2
|
1630
|
POST
|
Thanks James, for pointing out to this module. I still have an elementary knowledge of Python usage so this is helpful.
... View more
06-18-2015
06:05 PM
|
0
|
0
|
1630
|
POST
|
I have a model that runs a data check with an output table listing the number errors it found. I am wondering if I can complete the the model with a python statement that calls it to open the table. I know I can just right click and open the attribute table in ArcMap, but I just thought it will be cool to have a really complete model from start to end. I am using 10.2.2. Thanks!
... View more
06-17-2015
10:51 PM
|
0
|
9
|
5756
|
POST
|
Thanks Price, I have my hands tied on that option unfortunately. The feature class is hosted in an ArcSDE gbd and I do not have the administrator access. It also requires quite a bit of effort (and $$) to make the changes. 😕 For now before a solution can be found, I have to stick to manual shifting by eye-balling and snapping the points together.
... View more
05-06-2015
08:58 PM
|
0
|
0
|
1526
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|