I’m new in using Python – Arcmap.
I have on my map a list of layers with the nearly same name (bound3 to bound50)
I want to calculate the MinimumBoundingGeometry_management. I found out how to do it for one single layer.
arcpy.MinimumBoundingGeometry_management("bound3","bound3ConvexHull","CONVEX_HULL","ALL")
Instead I’d like to create a loop like in matlab style:
for i=3:1:50
arcpy.MinimumBoundingGeometry_management(boundi,boundiConvexHull,...
"CONVEX_HULL","ALL")
end
can someone give me an hint !
thanks a lot
You just have to construct the strings
"boundi"and"boundiConvexHull"for each i.Instead of
3:50(in Matlab) you doxrange(3,51)in python. The reason you go up to51is thatxrange(n)generates the sequence0:(n-1)(python is 0-based whereas matlab is 1-based).I’ve made use of python’s string formatting:
"bound%i" % iis syntactic sugar for printf-type functions that you are familiar with in matlab.Handy links:
xrange