I want to find out the coordinates (latitude and longitude) of Texas precincts. I download the shapefile from here.
I am using R to read the file and extract the coordinates:
dsn.tx <- "~/.../Texas.shp"
shp <- readOGR(dsn=dsn.tx, stringsAsFactor = F)
coords <- coordinates(shp)
But the resulting coordinates are in an unusual format:
X Y
1411246 864457.9
1266383 1231047.3
1213326 905663.0
1307353 1213580.7
1168558 814300.4
I am not sure why this happens. In other (not sure if related) posts some suggested it may be related to the proj4.
How do I transform the resultant coordiantes into "standard" longitude latitude coordinates?
Best Answer
With
sf
(more modern R spatial toolkit):With legacy tooling: