Really appreciate you taking the time to make these videos. They are helping me so much!
Glad to hear! If you have other topics you'd like to learn, let me know and I can try to make a video.
thank you very much teacher for these classes, I'm radiant for learning
Thank you, this example made me understand it very easily after struggling so hard with readings.
how to join 2 table (sql) in searchcursor(). Please help me
I have a problem with script running. arcpy.da.SearchCursor cannot open ne_10m_populated_places.shp feature class. Do you know what is problem? Thanks.
Hey, I have the same problem. Was there any way you could handle it? Sorry to disturb after a year.
import arcpy
arcpy.env.overwriteOutput = True
points = r'F:\GIS Python\Data
e_10m_populated_places.shp'
countries = r'F:\GIS Python\Data
e_10m_admin_0_countries.shp'
outpath = r'F:\GIS Python\Output'
fields = ['NAME', 'POP_MAX', 'TIMEZONE']
arcpy.MakeFeatureLayer_management(points, 'points_layer')
with arcpy.da.SearchCursor('points_layer', fields) as cursor:
for i in cursor:
print i[0]
print i[1]
print i[2] + '
'
Just converted to layer and it worked !
I don't know why, but i had to create a temporary layer "arcpy.MakeFeatureLayer_management" to make it work.
Also, the "print x[2]+'
' doesn't work (i get a message like 'cannot have int and str'), i had to print '
' below
The second question .. How can I create a tool using Python and then call it in the ArcGIS program in order for it to work with any layer that I add to the project?
Easiest way is to create a toolbox. I demonstrate how to do that later in the series. Since this video came out, there is a also a slightly newer way called a "Python Toolbox". pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/creating-a-new-python-toolbox.htm I (briefly) demonstrate how to to this in my ArcGIS Pro SDK development series - ua-cam.com/video/rrtK42bt40w/v-deo.html&ab_channel=franchyze923
Hello.. I am a new follower of you from Iraq, I had started today by following a page on UA-cam, and in the first lesson of the series
ArcMap Scripting with Python and Arcpy
But I was not able to download the shapefile for the exercise, how can I download it to apply the lesson
Hi, thanks for watching! I put the data on Google Drive, see if you can download from there - drive.google.com/drive/folders/1lLtk6m45PMiE9xuTBJQL1bpN_WMs19kW?usp=sharing
i keep getting this error
Traceback (most recent call last):
File "C:\Users\Kelvin\Documents\ArcPractice\Scripts\testfeatures2.py", line 18, in
arcpy.FeatureClassToFeatureClass_conversion('p_layer', outpath, 'cities_in_()'.format(x))
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\conversion.py", line 1891, in FeatureClassToFeatureClass
raise e
ExecuteError: ERROR 000354: The name contains invalid characters
Failed to execute (FeatureClassToFeatureClass).
why do i keep getting this error and how do i fix it
Hey sir Hope you're doing well
i have a query when i run this code on Python IDLE
it gives me Runtime error:
RuntimeError: cannot open 'D:\ArcPy\Data
e_10m_populated_places.shp'
Kindly suggest me the solution
i'll be very thankful
Hmm someone else was having this issue too. Is the shape file open in Arcmap when you’re trying to run the script? For some reason it can’t access the shapefile.
Have you been able to use this shapefile before ?
@@Franchyze923 yes i was able to use
and
in video number 5
i face another problem
@@Franchyze923
Sir i request you to contact me through email
i wanna learn these
my email is: afzalrizv7@gmail.com
@@Franchyze923 -please sir share solution here too... as i am also facing the same problem
@@wishnuma9856 did @Saad Khan suggestion of making a temporary layer work for you? It's possible things have changed with the libraries since I made this video. What version of arcmap are you using?
How come I NEED to set an arcpy.env.workspace for my points layer to be opened? You don't have this in your code, but when I leave it out, it gives me the error that the file cant be opened.
Hmm.. not exactly sure. Are you pointing to the absolute path of your layerss?What does your code look like?
@@Franchyze923 import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'D:\Documents\Arcpy\ARPX\Tutorial\Shapes'
wng = r'D:\Documents\Archis\wng.shp'
gemeente = r'C:\Users\XXXXX\OneDrive\Documents\Arcpy\Bestuurlijke grenzen\Gemeentegrenzen.shp'
output = r'D:\Documents\Arcpy\ARPX\Tutorial\Shapes'
arcpy.MakeFeatureLayer_management(wng, 'wng_layer')
with arcpy.da.SearchCursor(gemeente, ['FID','Gemeentena']) as gem_cursor:
for x in gem_cursor:
print x
arcpy.MakeFeatureLayer_management(gemeente, 'gemeente_layer', """ "FID" = {} """. format(x[0]))
arcpy.SelectLayerByLocation_management('wng_layer', 'WITHIN', 'gemeente_layer')
formatted_output_name = x[1].replace("'", "_").replace("-", "_").replace(",", "_").replace("(", "_").replace(")", "_")
arcpy.FeatureClassToFeatureClass_conversion('wng_layer', output, 'wng_in_{}'.format(formatted_output_name))
print 'Succesfully converted {}'.format(formatted_output_name)
print 'Finished'
please help im getting this error:
Traceback (most recent call last):
File "C:\Users\Kelvin\Documents\ArcPractice\Scripts\testfeat3.py", line 7, in
with arcpy.da.SearchCursor(points, ['NAME','POP_MAX','TIMEZONE']) as cities_cursor:
RuntimeError: cannot open 'C:\Users\Kelvin\Documents\ArcPractice\Data
e_10m_populated_places.shp'
It’s having trouble accessing that shape file. Does it exist in the specified location ? Maybe try putting an “r” in front of the points path
@@Franchyze923 yes i can ive been using the same files for the previous videos without any issue
Hi, First of all thanks for such a comprehensive and easy to understanding video series about the arcpy. I am facing some problem about the combination of DA and Mapping modules. Can you share your email id please. Thank You.
import arcpy
arcpy.env.overwriteOutput = True
points = r"C:\Users\Lenovo\Desktop\Collage\Python\arcpy\Data
e_10m_populated_places.shp"
countries = r"C:\Users\Lenovo\Desktop\Collage\Python\arcpy\Data
e_10m_admin_0_countries.shp"
outpath = r"C:\Users\Lenovo\Desktop\Collage\Python\arcpy\Outputs"
fields = ["NAME", "POP_MAX", "TIMEZONE"]
arcpy.MakeFeatureLayer_management(points, "points_layer")
with arcpy.da.SearchCursor(points, fields) as cursor:
for k in cursor:
print k[0]
print k[1]
print k[2] + "
"
Idk why, but if anyone got runtime error like me, just create (arcpy.MakeFeatureLayer_management(points, "points_layer")
it should work. And man thank you for your tutorials these are really helpfull.
I love these videos. You lay everything out in a very simple and easy to understand format, and for a beginner such as myself, I cannot thank you enough.
You're welcome! Thanks for watching
@@Franchyze923 I followed the instructions laid out in the video, and I was met with the "AttributeError: __enter__" error. Do you have any advice on how to handle this error? I'm new to python coding, so this may be a dumb question.
oops, I forgot to include '.da'
I just made some new videos on Arcpy with ArcGIS Pro! Check them out
ua-cam.com/play/PLO6KswO64zVt8YCuKIOdCsJvlUivXETGu.html