|
POST
|
The file is a in filegeodata base, I exported out to a shape to test. I restarted my pc and low and behold it worked.
... View more
08-23-2021
02:41 PM
|
0
|
0
|
1512
|
|
POST
|
Sorry about that, I had different variations trying to figure out what the problem is. Even when adding arcpy.MakeFeatureLayer_management it still deletes all the features. TaxPar = r"C:\Temp\TaxParcels1.shp"
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(TaxPar, "Par")
query = "DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"
arcpy.SelectLayerByAttribute_management("Par", "NEW_SELECTION", query)
result = arcpy.GetCount_management("Par").getOutput(0)
print ('{} has {} records'.format("Par", result[0]))
if int(arcpy.GetCount_management("Par").getOutput(0)) > 0:
arcpy.DeleteFeatures_management("Par")
... View more
08-23-2021
12:39 PM
|
0
|
0
|
1515
|
|
POST
|
I have the following stand alone script but it deletes all the features in the feature class instead what I have in the query. It also only prints out that there is 9 records that meet the query criteria witch is not correct there are more than 9 records. Seems pretty straight forward but I am Not sure what I am doing wrong. I also tried using updatecursor but I get the same results, it deletes are the features in the feature class. TaxPar = r"C:\Temp\TaxParcels1.shp"
# Process: Make Feature Layer
query = "DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"
arcpy.SelectLayerByAttribute_management(TaxPar, "NEW_SELECTION", query)
result = arcpy.GetCount_management(TaxPar).getOutput(0)
print ('{} has {} records'.format(TaxPar, result[0]))
if int(arcpy.GetCount_management(TaxPar).getOutput(0)) > 0:
arcpy.DeleteFeatures_management(TaxPar) sql = "DXF_TEXT LIKE 'Q%' or DXF_TEXT = '' or DXF_TEXT IS NULL"
with arcpy.da.UpdateCursor(TaxPar, 'DXF_TEXT',sql) as cursor:
for row in cursor:
cursor.deleteRow()
else:
pass
... View more
08-20-2021
08:55 AM
|
0
|
6
|
1562
|
|
POST
|
I tested the following and it worked for me. import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\MxdDataSourceTest.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\Temp\BPs.gdb",r"C:\Temp\BPs_1.gdb")
mxd.saveACopy(r"C:\Temp\MxdDataSourceTest2.mxd")
print 'done'
... View more
08-11-2021
01:47 PM
|
0
|
3
|
2172
|
|
POST
|
You need to save it after. mxd.save() mxd.saveACopy(r"C:\Users\SMALIS\Documents\ArcGIS\pythonSwitchSourceNEW.mxd")
... View more
08-11-2021
11:13 AM
|
1
|
1
|
2186
|
|
POST
|
import arcpy
from arcpy import env
env.workspace = "c:/data/columbia"
# Create a value table that will hold the input feature classes for Merge
vTab = arcpy.ValueTable()
# Step through each dataset in the list
for fd in arcpy.ListDatasets("*", "CAD"):
layername = fd + "_Layer"
# Select only the Polyine features on the drawing layer b-railroad
arcpy.MakeFeatureLayer_management(fd + "/Polyline", layername, "\"Layer\" = 'B-RAILROAD'")
vTab.addRow(layername)
# Merge the CAD features into one feature class
arcpy.Merge_management(vTab, "c:/data/columbia/Columbia.gdb/Railroads")
... View more
07-29-2021
03:10 PM
|
0
|
0
|
1321
|
|
POST
|
It would probably help to see what your current codes looks like.
... View more
07-29-2021
01:28 PM
|
0
|
0
|
1327
|
|
POST
|
How would I pass the certain fields and query ( "IS NOT NULL") to use arcpy.CalculatorField?
... View more
06-28-2021
09:02 AM
|
0
|
1
|
5413
|
|
POST
|
I trying to figure out a better/simpler way of clear multiple fields(meaning making the attributes in fields " ") at once but not all, just specific fields. I can do it with field calculator but that means i would have about 70 field calculators in the scrip. How else can this be done, examples?
... View more
06-25-2021
03:05 PM
|
0
|
8
|
5535
|
|
POST
|
I need to format this Arcade code to include if statement but not sure how. The num field can be either 9 or 10 digits so I need to be able to include a statement if it's 9 digits do this or if it's 10 digits do this. How can I do this? var Num;
Num = $feature.Num;
// if 10 digit run this
//var txt = Left(Num, Count(Num)-6)
//var txt1 = Right(Num, Count(Num)-4)
//OR
// if 9 digit run this
var txt2 = Left(Num, Count(Num)-5)
var txt3 = Right(Num, Count(Num)-4)
var url = "https://rec-search.Yoyo/find/search.asp?dfYear="+ text(txt2) + "&dfDocumentStart=" + text(txt3);return url;
... View more
06-16-2021
01:57 PM
|
0
|
2
|
1320
|
|
POST
|
Maybe something like this to get you started... fc = "fc"
fc1 = "fc1"
fcH_ID = []
fc1H_ID = []
with arcpy.da.SearchCursor(fc, ["House_ID"]) as cursor:
for row in cursor:
fcH_ID.append(row[0])
del row, cursor
with arcpy.da.SearchCursor(fc1, ["House_ID"]) as cursor:
for row in cursor:
if not row[0] in fcH_ID:
fc1H_ID.append(row[0])
del row, cursor
for ID in fc1H_ID:
arcpy.SelectLayerByAttribute_management(fc1, "ADD_TO_SELECTION", "House_ID = " + str(ID) # and House_ID = "Red"
... View more
06-07-2021
03:43 PM
|
0
|
0
|
866
|
|
POST
|
Sweet, thank you. SQL1 = "AppSubmitted >= DATE '{}'".format(from_date.strftime('%Y-%m-%d')) #'%Y-%m-%d %H:%M:%S'
SQL2 = "PNum LIKE 'RZ%' OR PNum LIKE 'OR%' OR PNum LIKE 'CR%'"
sql_expression = "({}) and ({})".format(SQL1, SQL2)
arcpy.TableToTable_conversion(table1, workspace,'tableTEST', sql_expression)
... View more
05-27-2021
10:02 AM
|
0
|
0
|
1078
|
|
POST
|
I currently have two sql's queries in a script, is there a way to combine SQL1 & SQL2 so I am not doing two separate queries? table1 = r"C:\Temp\Table"
from_date = DT.date.today() - DT.timedelta(days=730)
SQL1 = "AppSubmitted >= DATE '{}'".format(from_date.strftime('%Y-%m-%d')) #'%Y-%m-%d %H:%M:%S'
SQL2 = "PNum LIKE 'RZ%' OR PNum LIKE 'OR%' OR PNum LIKE 'CR%'"
arcpy.MakeTableView_management(table1, 'tableview', SQL) #Include SQL2
... View more
05-27-2021
09:28 AM
|
0
|
2
|
1083
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-27-2022 11:37 AM | |
| 1 | 10-31-2023 10:16 AM | |
| 1 | 02-16-2023 01:50 PM | |
| 1 | 08-11-2021 11:13 AM | |
| 1 | 01-06-2021 10:45 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-10-2024
10:42 AM
|