I found various examples but nothing like what I'm looking for. I seem to be able to do it if I format it in a specific way but it doesn't let me add NAME and LOCID.
My ultimate goal is to create a point shapefile from this list:
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Use pandas lib if keys are in same order and you have same keys in all lines to generate a valid csv
import pandas as pd df = pd.read_csv("data.csv", sep=",|:", header=None, skipinitialspace=True) # set separators , and : and remove initial space df2 =df.ix[:,1::2] df2.columns = list(df.ix[0,0::2]) df2.to_csv("data_new.csv", encoding="utf-8")
you can ignore last line and also complete this to generate XY Event layer with arcpy.
Both involve converting your text file to a .CSV format as show below.
1) Load this in ArcMap and Add XY Data > Export as Shapefile
2) You can load this in R and write shapefile using maptools.
library(maptools) library(sp) trial <- read.csv("C:\\Users\\rameshv\\Desktop\\trial.csv", header=T) coordinates(trial) <- ~LONG+LAT writeSpatialShape(trial, "C:\\Users\\rameshv\\Desktop\\trial")