|
POST
|
I need help with the error message while trying to register my SDE database with ArcGIS Server Data Store. Any suggestions please? this screen shot is from ArcCatalog this screenshot is from ArcGIS Server
... View more
07-11-2014
01:38 AM
|
0
|
2
|
4010
|
|
POST
|
instead of "!NAME!" + " " + "!NAME_EXTEN!", try "%s %s" % (!NAME!, !NAME_EXTEN!) or "!NAME! + ' ' + !NAME_EXTEN!" Thanks worked like magic.....
... View more
05-06-2014
04:26 AM
|
0
|
0
|
573
|
|
POST
|
I want to add a space between two concatenated field values that would appear like this "Kunle Street", I've tried the code below but its not giving me the expected result any suggestions? Thank you arcpy.CalculateField_management("Street", "STREET_NAME", "!NAME!" + " " + "!NAME_EXTEN!", "PYTHON_9.3", "")
... View more
05-06-2014
12:01 AM
|
0
|
3
|
1053
|
|
POST
|
How Can I Calculate the Length and Width of a Polygon Using ArcPy any suggestion(s). Thanks
... View more
05-04-2014
04:02 PM
|
0
|
6
|
9081
|
|
POST
|
I've tried a couple of times and the attached screen shot was the error message I got
... View more
03-25-2014
12:50 AM
|
0
|
0
|
1805
|
|
POST
|
Thanks for all the Nuggets of information, my next question is how can I download the setuptools/distribute? I think it is a very important prerequisite for the pyBarcode-0.7 installation? Thanks for your thoughts
... View more
03-22-2014
10:55 AM
|
0
|
0
|
1805
|
|
POST
|
I have downloaded the pyBarcode-0.7.tar.gz file but I am having issues installing the file, I can't even get my head around unpacking the file? Any thoughts? + do you think the code under the pyBarcode-0.7.tar.gz would work amidst the arcpy script below: import arcpy
import pythonaddins
import os
import datetime
import time
arcpy.env.overwriteOutput = True
class FCTSitePlanBatchToolClass(object):
"""Implementation for FCTSitePlanBatchTool_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
arcpy.SelectLayerByAttribute_management("GISMainFabric_Parcels", "CLEAR_SELECTION")
arcpy.MakeFeatureLayer_management("GISMainFabric_Parcels", "STemp", '"Plot_Status" = \'ALLOCATED\'AND "SitePlan_Status" = \'NOT GENERATED\'')
fc = "STemp"
field = "OBJECTID"
field1 = "Plot_No"
field2 = "Block_No"
field3 = "Name_Allottee"
field4 = "SitePlan_Status"
field5 = "LGA"
field6 = "District"
field7 = "StatedLen"
field8 = "Cadzone"
#field9 = "TDP_Status"
rows = arcpy.SearchCursor(fc)
#row = rows.next()
#while row:
for row in rows:
val = row.OBJECTID
val1 = row.Plot_No
val2 = row.Block_No
val3 = row.Name_Allottee
val4 = row.SitePlan_Status
val5 = row.LGA
val6 = row.District
val7 = row.StatedLen
val8 = row.Cadzone
#val9 = row.TDP_Status
whereClause = '"OBJECTID"' + " = '" + str(val) + "'"
whereClause2 = '"Block_No"' + " = '" + str(val2) + "'"
whereClause3 = '"District"' + " = '" + str(val6) + "'"
whereClause4 = '"Cadzone"' + " = '" + str(val8) + "'"
whereClause5 = '"Plot_No"' + " = '" + str(val1) + "'"
outName = str(val5) + "_LGA" + "(" + str(val6) + "_Area" + ")"
outName1 = "Plot_" + str(val1) + "(" "Block_" + str(val2) + ")"
outName2 = str(val3) + " Block_" + str(val2) + "_Plot_" + str(val1) + "_" + str(val6) + "_Area_of_" + str(val5) + "_LGA" + ".pdf"
arcpy.SelectLayerByAttribute_management("STemp", "NEW_SELECTION", whereClause)
arcpy.Buffer_analysis ("STemp", "ClipFeature", "7 meters", "FULL", "ROUND", "LIST")
... View more
03-20-2014
01:09 PM
|
0
|
0
|
1805
|
|
POST
|
Is it Possible to Generate Barcodes in ArcGIS Layout using Python scripts, any thoughts? Thanks
... View more
03-20-2014
11:36 AM
|
0
|
9
|
1930
|
|
POST
|
It worked like MAGIC!!! You are the man, Thanks......
... View more
02-14-2014
07:56 AM
|
0
|
0
|
486
|
|
POST
|
I need help with an error message i get while running my script from an ArcGIS python addin I developed. The script loops through only the 1st row and then stops abruptly and gives the error message further below, see my code below; mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd)[0] arcpy.SelectLayerByAttribute_management("GISMainFabric_Parcels", "CLEAR_SELECTION") arcpy.MakeFeatureLayer_management("GISMainFabric_Parcels", "Temp", '"Plot_Status" = \'LOCATED\'AND "TPlan_Status" = \'NOT GENERATED\'AND "SPlan_Status" = \'SITEPLANGENERATED\'') fc = "Temp" field = "OBJECTID" field1 = "Pan_No" field2 = "Block_No" field3 = "Name" field4 = "SitePlan_Status" field5 = "LGA" field6 = "District" field7 = "StatedLen" field8 = "Cadzone" field9 = "TPlan_Status" rows = arcpy.SearchCursor(fc) row = rows.next() while row: val = row.getValue(field) val1 = row.getValue(field1) val2 = row.getValue(field2) val3 = row.getValue(field3) val4 = row.getValue(field4) val5 = row.getValue(field5) val6 = row.getValue(field6) val7 = row.getValue(field7) val8 = row.getValue(field8) val9 = row.getValue(field9) whereClause = '"OBJECTID"' + " = '" + str(val) + "'" whereClause2 = '"Block_No"' + " = '" + str(val2) + "'" whereClause3 = '"District"' + " = '" + str(val6) + "'" whereClause4 = '"Cadzone"' + " = '" + str(val8) + "'" whereClause5 = '"Plan_No"' + " = '" + str(val1) + "'" outName = str(val5) + "_LGA" + "(" + str(val6) + "_Area" + ")" outName1 = "Plot_" + str(val1) + "(" "Block_" + str(val2) + ")" outName2 = str(val3) + " Block_" + str(val2) + "_Plot_" + str(val1) + "_" + str(val6) + "_Area_of_" + str(val5) + "_LGA" + ".pdf" arcpy.SelectLayerByAttribute_management("Temp", "NEW_SELECTION", whereClause) arcpy.Buffer_analysis ("Temp", "ClipFeature2", "7 meters", "FULL", "ROUND", "LIST") mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr=arcpy.mapping.ListLayers(mxd, "ClipFeature2", df)[0] df.extent = lyr.getExtent(True) arcpy.RefreshActiveView() df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] for df in arcpy.mapping.ListDataFrames(mxd): df.rotation = 0 if val7 <= 80: df.scale = 250 lyr = arcpy.mapping.ListLayers(mxd, "LineTableLayoutzz")[0] tableText = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "TableText")[0] numRows = int(arcpy.GetCount_management(lyr).getOutput(0)) rowHeight = 0.2 #fieldNames = ["Sequence", "ParcelPlot", "FromBeacon", "ToBeaconNo", "Length", "Bear"] fieldNames = ["BEACON_No","DIST_______BEARING"] numColumns = len(fieldNames) colWidth = 3.0 #Build graphic table lines based on upper left coordinate #set the proper size of the original, parent line, then clone it and position appropriately #upperX = 2.5 #upperY = 7.0 if df.scale <= 250 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 250 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 500 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 500 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 750 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 750 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 1000 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 1000 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 1500 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 1500 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 2000 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 2000 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 2500 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 2500 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 5000 and numRows <= 10: upperX = 5.0 upperY = 7.0 elif df.scale <= 5000 and numRows > 10: upperX = 5.0 upperY = 8.0 elif df.scale <= 10000 and numRows <= 10: upperX = 5.0 upperY = 7.0 else: if df.scale <= 10000 and numRows > 10: upperX = 5.0 upperY = 8.0 #Place text column names tableText.elementPositionX = upperX + 0.05 #slight offset tableText.elementPositionY = upperY tableText.text = fieldNames[0] accumWidth = colWidth for field in range(1, numColumns): newFieldTxt = tableText.clone("_clone") newFieldTxt.text = fieldNames[field] newFieldTxt.elementPositionX = newFieldTxt.elementPositionX + accumWidth accumWidth = accumWidth + colWidth #Create text elements based on values from the table table = arcpy.SearchCursor(lyr.dataSource) y = upperY - rowHeight for row in table: x = upperX + 0.05 #slight offset try: for field in fieldNames: newCellTxt = tableText.clone("_clone") newCellTxt.text = row.getValue(field) newCellTxt.elementPositionX = x newCellTxt.elementPositionY = y accumWidth = accumWidth + colWidth x = x + colWidth y = y - rowHeight except: print"Invalid value assignment" arcpy.CreateFolder_management("C:\\ABU\\",outName) arcpy.CreateFolder_management("C:\\ABU\\"+ outName,outName1) arcpy.mapping.ExportToPDF(mxd,r"C:\ABU\\" + outName + "\\" + outName1 + "\\" + "Granted To" + outName2) strvals = "TDP GENERATED" #strvalz = " " now = datetime.datetime.now() strNow = now.strftime("%d %b %Y %H:%M:%S") name = os.environ.get('USERNAME') Today = str(datetime.date.today()) arcpy.SelectLayerByLocation_management("GISMainFabric_Parcels", "HAVE_THEIR_CENTER_IN", "GISMainFabric_Parcels_Printz", "", "NEW_SELECTION") arcpy.CalculateField_management("GISMainFabric_Parcels","TDP_Status",'"' + strvals + '"') arcpy.CalculateField_management("GISMainFabric_Parcels","Time_Generated",'"' + strNow + '"') arcpy.CalculateField_management("GISMainFabric_Parcels","Generated_By",'"' + name + '"') arcpy.CalculateField_management("GISMainFabric_Parcels","Date_Generated","'" + Today + "'","PYTHON") arcpy.SelectLayerByAttribute_management("GISMainFabric_Parcels", "CLEAR_SELECTION") arcpy.SelectLayerByAttribute_management("Temp", "CLEAR_SELECTION") mxd = arcpy.mapping.MapDocument("Current") df3 = arcpy.mapping.ListDataFrames(mxd, "DF3")[0] for elm in arcpy.mapping.ListLayoutElements(mxd, wildcard="*_clone*"): elm.delete() row = rows.next() and this is the error message further below; Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\ESRI\Desktop10.1\AssemblyCache\{48ABDA3D-7C57-2D3F-90A6-302D00F4E541}\FCTTDPPlanBatchTool_addin.py", line 32, in onClick val = row.getValue(field) File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\arcobjects.py", line 1011, in getValue return convertArcObjectToPythonObject(self._arc_object.GetValue(*gp_fixargs(args))) RuntimeError: ERROR 999999: Error executing function. Please what do you think its wrong but I'm suspecting the region that contains the graphic element? Thanks in advance
... View more
02-14-2014
03:01 AM
|
0
|
2
|
978
|
|
POST
|
Strange, if I run the (slightly changed) code it does run for me (in 10.2) import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
dfs = arcpy.mapping.ListDataFrames(mxd)
for df in dfs:
for lyr in arcpy.mapping.ListLayers(mxd,"*",df):
if lyr.isFeatureLayer:
arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
for tbl in arcpy.mapping.ListTableViews(mxd,"*",df):
arcpy.SelectLayerByAttribute_management(tbl,"CLEAR_SELECTION")
What type of layers do you have in your TOC? Kind regards, Xander Yeah, your code works but it takes the same time with what I have to go through each of the layers one after the other? I want something as fast as the " to Unselect the currently selected Features in all layers" in ArcMap
... View more
10-18-2013
11:52 AM
|
0
|
0
|
4593
|
|
POST
|
I have a script that unselects all the selected features in my Map view but it loops through each layer in the dataframe and this takes a lot of time. I want to write a script that would be as fast as the Unselect the currently selected Features in all layers within ArcMap itself? This is my code below; mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
for lyr in arcpy.mapping.ListLayers(mxd):
... arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
...
Runtime error Traceback (most recent call last): File "<string>", line 2, in <module> File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 6461, in SelectLayerByAttribute raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Table View. ERROR 000840: The value is not a Raster Layer. ERROR 000840: The value is not a Mosaic Layer. Failed to execute (SelectLayerByAttribute). Any Suggestions? Thanks
... View more
10-15-2013
04:42 AM
|
1
|
14
|
13144
|
|
POST
|
I want to calculate the width of a polygon feature or get the distance between two line features. All I have for the first scenario is how to calculate the length, I want to be able to use arcpy to get the width of a polygon feature and pass the result into a what if statement. I want to use arcpy to get the distance between two line features and pass the result into a what if statement. Any suggestion(s)?
... View more
10-08-2013
06:55 AM
|
0
|
3
|
1261
|
|
POST
|
There might be fancier ways but this is the way I do it...
import time
t1 = time.time()
# do something here
t2 = time.time()
TimeTakenSecs = t2 - t1
print TimeTakenSecs
Cheers, Neil Thanks for the response
... View more
10-08-2013
06:42 AM
|
0
|
0
|
967
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-19-2015 08:49 AM | |
| 1 | 10-15-2013 04:42 AM | |
| 1 | 09-20-2016 03:45 AM | |
| 2 | 09-25-2016 03:50 PM | |
| 1 | 08-25-2012 09:15 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|