![]() ![]() If not arcpy.Exists(outfc): # Create the output feature class if needed.Īrcpy.CreateFeatureclass_management(os.path.dirname(outfc), os.path.basename(outfc), "POINT", None, None, None, spatialref)Ĭsv.register_dialect("xls", delimiter=",", lineterminator="\n") # Register the dialect for native CSV syntax in Microsoft Excel. Spatialref = arcpy.SpatialReference(4326) # Create the spatial reference object as WGS84. Outfc = r"C:\Users\MyName\Desktop\My Docs\Sample Data\SampleGDB.gdb\SampleFC" # Change this to the path of your output FC. Incsv = r"C:\Users\MyName\Desktop\My Docs\Sample Data\SampleCSV.csv" # Change this to the path of your CSV file. Make sure 'Lat' and 'Lon' fields are the 1st and 2nd column in the CSV respectively. You can tweak the coordinate system in the code to something other than WGS84, tweak the field types, etc. ![]() ![]() The script assumes the Latitude field is the 1st column and Longitude field is the 2nd column. Reading a CSV and populating a feature class with its values can be easy. Here's an example of technique I mentioned in the my comment to your question. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |