POST
|
Since it worked in earlier versions of Pro, this sounds like a new undocumented feature (aka bug) at 2.9. In the old days of ArcInfo as well as ArcGIS the unwritten rule was never update to a new version that ends in dot zero. I relearned this lesson at 2.8.0 and rolled back to 2.7.4. Once 2.8.2 came out I updated to that. If this was happening to me, I'd roll back to the last version your script worked.
... View more
11-22-2021
10:57 AM
|
1
|
3
|
1640
|
POST
|
Did you recently upgrade to Pro 2.9 form an earlier version of Pro or is this a fresh install? Did this work in Pro 2.8.x and earlier?
... View more
11-22-2021
08:30 AM
|
1
|
1
|
1667
|
POST
|
See if this works for you. Not tested; no guarantees... import arcpy
expression = f'{!COMPANY!} {!LOCATION!} {!TYPE!} {!SIZE!}'
arcpy.CalculateField_management("UT_CROSSING","DISCREPTION", expression, PYTHON3)
... View more
11-19-2021
10:30 AM
|
0
|
0
|
1519
|
POST
|
How wide-spread geographically are you points? You could georeference the images if you can figure out ground truth monuments. Do this images have some sort of xy notation?
... View more
11-17-2021
07:24 AM
|
0
|
0
|
1423
|
POST
|
Perhaps you could elaborate on your situation. I have to ask, is the data you are trying to export available for export?
... View more
11-12-2021
12:31 PM
|
0
|
1
|
490
|
POST
|
I've never used the split() function as shown above. Typically the split function is used with just a delimiter like this: x = '123,456'
newX = x.split(',')
# which returns a list of ['123', 456'] All that said, I would simplify things and start with replacing the spaces in your text file with a comma, and call the new file coords.csv. You'll need to add a line on the top naming the fields. Then use XY table to Point
... View more
11-12-2021
10:48 AM
|
0
|
1
|
1348
|
POST
|
def Reclass(!ARA!):
if !ARA! is <= 1000:
return 25
elif !ARA! >= 1000:
return 50
elif !ARA! >= 2000:
return 100
elif !ARA! >= 5000:
return 150 We can't tell if you've properly indented your def() as well as your if/elif so here ^ is what it should look. That said I think your error is passing !ARA!. Instead of passing that directly, try this approach: def Reclass(inValue):
if inValue is <= 1000:
return 25
elif inValue >= 1000:
return 50
elif inValue >= 2000:
return 100
elif inValue >= 5000:
return 150 In your field calculator, enter : reclass(!ARA!) in the upper window. Is !ARA! numeric? If not that will be an issue as well. Your logic is a little bit flawed as well: if !ARA! == 1,000 what value do you really want?
... View more
11-12-2021
08:35 AM
|
2
|
1
|
666
|
POST
|
Feature datasets are not designed as a file managment tool. They are desigined to contain feature classes that have specal related functionality like topology or a network dataset. If you want to organize your data, I suggest creating a serires of file geodatabases as logical containers.
... View more
11-11-2021
05:00 PM
|
0
|
0
|
741
|
POST
|
Are you getting any errors? Are there any other files in d:/roads_shp? Here is some python I whipped up that works for me. There may be other approaches using walk() and or glob() ; I don't like to over complicate things: import arcpy,os
shapeDir = r'C:\Temp\my_shapes'
arcpy.env.workspace = shapeDir
targetGDB = r'C:\Temp\TargetGeodatase.gdb'
shapeFileList=[]
for file in os.listdir(shapeDir):
if file.endswith(".shp"):
shapeFileList.append(file)
for shapeFile in shapeFileList:
newName = shapeFile.split('.')[0]
arcpy.conversion.FeatureClassToFeatureClass(shapeFile,targetGDB,newName) Pretty straight forward; get a list of shapefiles and step through it. Use the 'root' name of the shapefile for your geodatabase feature class and let it rip.
... View more
11-11-2021
09:31 AM
|
1
|
1
|
2073
|
POST
|
I've taken the liberty to format your code so it's readable. While I don't have any experience with the Multiprocessing.Pool() module, there are a couple things you should probably consider in your code. There are several functions that are repeated every time the loop(s) are iterated, and I wonder if this is what is causing you some problems. Perhaps you could include the errors. For example, you only need to checkout Network Analyst once; you are checking it out everytime you go through the loop. You should be getting a fatal error everytime you encounter Line 34; makeFeatureLayer because that feature layer is created on the first pass through the loop(s) and already exists in subsequent trips through loops. What is going on in lines 24 & 25: I don't understand your use of index [x] and [y] in the respective list. My suggestion is to clean up your code such that you are not repeating yourself every time you go through it and see what happens. #Import system modules
import arcpy
from arcpy import env
# define list values
list1 = [ 'x', 'y', 'z']
list2 = [ 'a', 'b', 'c']
for x in range(len(list1)):
for y in range(len(list2)):
try:
#Check out the Network Analyst extension license
arcpy.CheckOutExtension("Network")
#Set environment settings
env.overwriteOutput = True
#Set local variables
inNetworkDataset = "D:/RoadNetwork.gdb/RoadNetwork_ND"
#verify layer name
outNALayerName = list1[x]
chunk = list2[y]
#set variables
impedanceAttribute = "Distance"
inFacilities = "D:/facilities/" + chunk + ".shp"
polygonBarriers = "D:/barriers/" + outNALayerName + ".shp"
outLayerFile = "D:/outputs/" + outNALayerName + "_" + chunk + ".lyr"
#Make a barrier feature layer
barriersLayer = arcpy.management.MakeFeatureLayer(polygonBarriers,"PolygonBarriers").getOutput(0)
#Create a new service area layer.
outNALayer = arcpy.na.MakeServiceAreaLayer(inNetworkDataset, outNALayerName,
impedanceAttribute, "TRAVEL_FROM", "60", "DETAILED_POLYS", "NO_MERGE", "DISKS",
hierarchy = "NO_HIERARCHY", poly_trim_value = "100", restriction_attribute_name = ["OneWay"])
outNALayer = outNALayer.getOutput(0)
subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
facilitiesLayerName = subLayerNames["Facilities"]
polygonbarriersLayerName = subLayerNames["PolygonBarriers"]
#Create field mappings for loading barriers
fieldMappings = arcpy.na.NAClassFieldMappings(outNALayer,polygonbarriersLayerName)
fieldMappings["BarrierType"].defaultValue = 0
#Load the facilities and barriers
arcpy.na.AddLocations(outNALayer, facilitiesLayerName, inFacilities, "", "")
arcpy.na.AddLocations(outNALayer, polygonbarriersLayerName, polygonBarriers, fieldMappings)
#Solve and save the service area layer
arcpy.na.Solve(outNALayer)
arcpy.management.SaveToLayerFile(outNALayer,outLayerFile,"ABSOLUTE")
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
now = datetime.now()
print now.strftime("%d%m%Y-%H%M%S")
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
... View more
11-10-2021
09:11 AM
|
2
|
0
|
7167
|
POST
|
Glad you were able to create a solution for yourself; definition queries IMHO are an often overlooked feature that really adds functionality. Adding the same data several times and having a different queries assigned is a great way to go.
... View more
11-09-2021
09:04 AM
|
1
|
0
|
713
|
POST
|
I found this older (2018) post of mine; it looks that functionality was removed at ArcGIS 10.5
... View more
11-09-2021
08:44 AM
|
0
|
0
|
609
|
POST
|
The short answer is no. In the beginning, it was common if not recommended practice to create a locator as a database object, but a few years back that functionality was dropped. I think the reasoning was based on the idea of publishing geocoding services, although that's just a guess on my part.
... View more
11-09-2021
08:35 AM
|
1
|
0
|
611
|
Title | Kudos | Posted |
---|---|---|
1 | 09-02-2016 12:42 PM | |
1 | 09-03-2016 06:16 AM | |
1 | 02-04-2021 09:01 AM | |
1 | 05-27-2021 07:14 AM | |
1 | 07-30-2015 08:17 AM |
Online Status |
Offline
|
Date Last Visited |
10-13-2022
10:51 PM
|