Hi all,
Today I've started using Python for the very first time and therefor I am not very adept. I've bought a book and I am using ArcGIS Help and the forum extensively, so I've solved many of the problems I was dealing with. But what should be the simplest of all I cannot solve. I am used to SPSS and use syntax a lot, and I'm no fool when it comes to data handling. I'm not new to ArcGIS either. Just the combination of ArcGIS/Python is new to me.
I want to do the following things:
1) Add data, namely add a .csv file to the opened Arcmap file
2) Create XY-events from the .csv file
3) Data: save as Shapefile
4) Add some characteristics to the Shapefile
5) Save again
I've succeeded in automating step 4 using Python. With steps 1, 2, 3 and 5 I have the following issues. If you would be willing to help me with one of more of these problems that would be amazing. Ps. I know all of the things I want to do are possible through menus but I am explicitly looking for Python code as so to automate the process.
1) I simply cannot find any code that will allow me to open a .csv file into an open ArcMap. My book nor the help pages are illuminating to me, perhaps because I don't use the correct search terms?
2) I can't create XY events from a .cvs file. I can be done from a shapefile, but sadly, at this point in the process I have no shapefile, I have only .csv file with the variables for latitude and longitude. When I work manually (through the menus), the order of execution is always: import the .csv file, create XY-events using the latitude and longitude variables, and save XY-events as a shapefile. That's why I'm confused why I can't create XY-events from the .csv file.
3) What is the code to save my XY-events as a shapefile?
5) And what's the code to save a shapefile again?
Thank you so very much,
Miriam (from the Netherlands)
Today I've started using Python for the very first time and therefor I am not very adept. I've bought a book and I am using ArcGIS Help and the forum extensively, so I've solved many of the problems I was dealing with. But what should be the simplest of all I cannot solve. I am used to SPSS and use syntax a lot, and I'm no fool when it comes to data handling. I'm not new to ArcGIS either. Just the combination of ArcGIS/Python is new to me.
I want to do the following things:
1) Add data, namely add a .csv file to the opened Arcmap file
2) Create XY-events from the .csv file
3) Data: save as Shapefile
4) Add some characteristics to the Shapefile
5) Save again
I've succeeded in automating step 4 using Python. With steps 1, 2, 3 and 5 I have the following issues. If you would be willing to help me with one of more of these problems that would be amazing. Ps. I know all of the things I want to do are possible through menus but I am explicitly looking for Python code as so to automate the process.
1) I simply cannot find any code that will allow me to open a .csv file into an open ArcMap. My book nor the help pages are illuminating to me, perhaps because I don't use the correct search terms?
2) I can't create XY events from a .cvs file. I can be done from a shapefile, but sadly, at this point in the process I have no shapefile, I have only .csv file with the variables for latitude and longitude. When I work manually (through the menus), the order of execution is always: import the .csv file, create XY-events using the latitude and longitude variables, and save XY-events as a shapefile. That's why I'm confused why I can't create XY-events from the .csv file.
3) What is the code to save my XY-events as a shapefile?
5) And what's the code to save a shapefile again?
Thank you so very much,
Miriam (from the Netherlands)