Timeline for (Arcpy) read values from a txt file and convert the data into a shapefile
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 28, 2016 at 19:32 | comment | added | geobug | Yep, empty quotes will do. Like this: 'newfc = arcpy.CreateFeatureclass_management(outpath, newfcName, "Point", "", "", "", 26910)' | |
Apr 28, 2016 at 19:29 | comment | added | ziggy | okay one last question, when creating the feature class i want to add the spatial reference without using a template fc. it keeps giving me an error because the spatial reference parameter in the tool is all the way at the end and I want to leave the template, m, z optional parameters blank. Any suggestions? | |
Apr 28, 2016 at 19:16 | comment | added | geobug | Ziggy, I updated the code above with an option for how to write the geometry as well. You can skip the array and just add the XY as a tuple because it's just point data. (If you start getting into lines and polygon though, you need to make an array of points to make up the vertices of the more complicated shape. See?) | |
Apr 28, 2016 at 19:14 | history | edited | geobug | CC BY-SA 3.0 |
edited to add option for writing geometry
|
Apr 28, 2016 at 19:12 | comment | added | Paul |
If you're reading from CSV in python, you'll find it much simpler in the long run if you use the builtin csv module. @ziggy, if you want to create/update point geometries themselves, you can use some form of the SHAPE@ tokens.
|
|
Apr 28, 2016 at 19:02 | comment | added | ziggy | if i wanted to add the xy geometries to a new feature class would I have to do that by adding those fields? i took a look at your geometry link but i am a bit confused on why the arcpy.Array is needed.. | |
Apr 28, 2016 at 17:20 | comment | added | geobug | Whoops. Just noticed there was an identation error in the code above under the "for line in inputF" section. I corrected it above. | |
Apr 28, 2016 at 17:19 | history | edited | geobug | CC BY-SA 3.0 |
added 8 characters in body
|
Apr 28, 2016 at 17:11 | comment | added | geobug | No problem, Andriel. Welcome to python. It's a fun language! Ziggy, sure, it think it should work with a csv. But if your data is comma separated, be sure you change the split to accomodate that. So something like this: xCoordinate, yCoordinate, zValue = line.split(",") | |
Apr 28, 2016 at 17:02 | comment | added | ziggy | nicely done. This can be applied to a csv as well correct? | |
Apr 28, 2016 at 16:59 | comment | added | Andriel | you really helped me out, thanks for you extensive Explanation =) | |
Apr 28, 2016 at 16:51 | history | answered | geobug | CC BY-SA 3.0 |