POST
|
I figured out how to make it work in a Python Toolbox... import arcpy import os class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "ACS_2013_5Year_Toolbox" self.alias = "" # List of tool classes associated with this toolbox self.tools = [ACSJoinTableTool] class ACSJoinTableTool(object): def __init__(self): """Define the tool (tool name is the name of the class).""" self.label = "Join ACS Table to Census Block Group Geometry" self.description = "Pick a table to temporarily join to the" + \ "Block Group GIS layer." self.canRunInBackground = False def getParameterInfo(self): """Define parameter definitions""" #Make parameter #0 a drop down list of the ACS text files and user can pick one filterList = [] fol = r"---Path of Folder Containing ACS Text Files Here----" for i in os.listdir(fol): if i.split(".")[-1].find("txt") != -1: x = i.split(".")[0] filterList.append(x) filterList.sort() param0 = arcpy.Parameter(displayName = "Pick Table:", name = "in_table", datatype="GPString", parameterType="Required", direction="Output") param0.filter.list = filterList #Make parameter #1 filter multi-value check list a of the table columns, the user can check multiple columns pickTableFieldsList=[] param1 = arcpy.Parameter(displayName = "Pick Join Fields:", name = "in_fields", datatype= "GPString", parameterType= "Required", direction= "Input", multiValue=True) param1.filter.type = "ValueList" param1.filter.list = pickTableFieldsList parameters = [param0,param1] return parameters def isLicensed(self): """Set whether tool is licensed to execute.""" return True def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" #When the 0th parameter gets a value the field headers (1st column in text file) are available to select if parameters[0].value: joinTable = os.path.join(r"---Folder Containing ACS Text Files Here", parameters[0].valueAsText + ".txt") pickedTable = open(joinTable,"r") pickedTableFieldsString = pickedTable.readline() pickedTableFieldsString = pickedTableFieldsString.replace("\n","") pickedTable.close() pickedTableFieldsList = pickedTableFieldsString.split(",") parameters[1].filter.list = pickedTableFieldsList return
... View more
12-18-2015
06:15 AM
|
2
|
0
|
2010
|
POST
|
I could easily set this task up in a script tool. Part of this is I am trying to learn how to write a Python Toolbox. I have not recognized by using the help how to do this correctly.
... View more
12-18-2015
04:46 AM
|
1
|
1
|
2010
|
POST
|
I am trying to create my first Python Toolbox. I have tons of ACS text file, comma field separated files. I want my users to easily be able to join the tables to the geometry file. My first parameter, the list of available text files is working. Then, when I add the next parameter for the users to pick which fields they want to join from the text file as a check list is not working. Not sure how to set this up the parameters properly? Any help is much appreciated? import arcpy import os class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "ACS_2013_5Year_Toolbox" self.alias = "" # List of tool classes associated with this toolbox self.tools = [ACSJoinTableTool] class ACSJoinTableTool(object): def __init__(self): """Define the tool (tool name is the name of the class).""" self.label = "Join ACS Table to Census Block Group Geometry" self.description = "Pick a table to temporarily join to the" + \ "Block Group GIS layer." self.canRunInBackground = False def getParameterInfo(self): """Define parameter definitions""" #Make parameter #0 a list of the ACS text files. filterList = [] fol = r"---file path of folder containing text files here---" for i in os.listdir(fol): if i.split(".")[-1].find("txt") != -1: x = i.split(".")[0] filterList.append(x) filterList.sort() param0 = arcpy.Parameter(displayName = "Pick Table:", name = "in_table", datatype="GPString", parameterType="Required", direction="Input") param0.filter.list = filterList #Make parameter #1 a list of the table columns joinTable = os.path.join(r"---file path of folder containing text files here---", param[0].valueAsText + ".txt") pickedTable = open(jointable,"r") pickedTableFields = pickedTable.readline() pickedTableFields = pickedTableFields.replace(",",";") param1 = arcpy.Parameter(displayName = "Pick Join Fields:", name = "in_fields", datatype="GPString", parameterType="Derived", direction="Input") param1.parameterDependencies = [param0.value] param1.filter.list = pickedTableFields parameters = [param0,param1] return parameters
... View more
12-17-2015
08:55 AM
|
0
|
8
|
4732
|
POST
|
Thanks, I can rule out the MXD being the cause of failure.
... View more
03-20-2015
05:54 AM
|
0
|
0
|
1109
|
POST
|
I don't want to delete it. It is just I had a map service fail and the MXD had been saved to a 10.2 document, when the server is 10.0. I was not sure if the failure was due to the MXD changing. Nothing had been published as 10.2.
... View more
03-18-2015
05:07 AM
|
0
|
1
|
1109
|
POST
|
Can the MXD the map service was created be deleted and still have the map service work?
... View more
03-16-2015
08:03 AM
|
0
|
5
|
4495
|
POST
|
Thanks, I tried making a TIN for my entire county- my computer will not process it. That seems like the way to go if I can figure out a way to get the TIN made.
... View more
03-14-2014
10:25 AM
|
0
|
0
|
919
|
POST
|
I have a 1m Countywide DEM and breaklines. The DEM was generated from LiDAR. I would like to make some contours. What is the best way to make contours from a DEM and incorporate breaklines on a Countywide scale?
... View more
03-11-2014
11:15 AM
|
0
|
2
|
2902
|
POST
|
After several days of trying and finally posting and then I just figured it out... arcpy.CalculateField_management(lyr, "TestHotlink","r!HOTLINK!.lower()", "PYTHON_9.3", "") I kept trying things like r(!HOTLINK!) which did not work.
... View more
03-05-2014
06:14 AM
|
0
|
0
|
1023
|
POST
|
I am getting funny symbols when I do a simple field calculate on a unicode field in a file geodatabase. I do this: arcpy.CalculateField_management(outFileThree, "HOTLINK", "!HOTLINK!.lower()", "PYTHON_9.3", "") and get funny little L or upside down Ls in the field where there were \ characters or \0s. How do I field calculate correctly field calculate and why is this happening?
... View more
03-05-2014
04:39 AM
|
0
|
2
|
1560
|
POST
|
We have the orignal LiDAR the DEM was created from, FEMA Region 3-MD-VA-WV, it is for free download from USGS. It looks like they have recently posted new slope maps too, I may try to use theirs. Can you explain to me why integer makes such as different as opposed to floating point DEM? Does this effect point location data in the DEM?
... View more
01-03-2014
03:51 AM
|
0
|
0
|
1777
|
POST
|
A portion of the DEM is attached. I used what the default was for the Z factor.
... View more
01-02-2014
08:03 AM
|
0
|
0
|
1777
|
POST
|
I have 1 meter DEMs. I went to make a slope map and it looks like a contour map, not a slope map, I used Sptail Analyst-Slope. Since it did not work out, I converted a DEM to Mass Points and made a Terrain and used Surface Slope, again it turned out like a contour map. Why would this happen? I need to know how to make a Slope map out of the DEMs I have. [ATTACH=CONFIG]30176[/ATTACH]
... View more
01-02-2014
03:38 AM
|
0
|
5
|
3666
|
POST
|
I have LiDAR and derived data in UTM18N meters, NAVD 1988 meters. I want to convert it to Maryland State Plane 1983 feet with NAVD 1988 feet. Is this not possible or am I doing something incorrectly? It seems I can get the x,y but not the z to change in a multipoint las derived file. I just need to get the .las files over to a dem in Maryland State Plane 1983 feet, NAVD 1988 feet file to derive other outputs.
... View more
12-23-2013
10:36 AM
|
0
|
0
|
1407
|
POST
|
Thank you, this helped me figure out how to remove the extra quotes from my layer files that had spaces. http://forums.arcgis.com/threads/94529-Layer-Invalid-Data-Source
... View more
10-11-2013
05:22 AM
|
0
|
0
|
3177
|
Title | Kudos | Posted |
---|---|---|
1 | 12-18-2015 04:46 AM | |
2 | 12-18-2015 06:15 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|