[R-sig-Geo] Converting State Plane Coordinates
Alexandre Villers
villers.alexandre at gmail.com
Tue Aug 24 17:06:27 CEST 2010
Hello,
Have a look at spTransform (in rgdal package) and the EPSG code of the
desired projection (this is to me the easiest way not to mess with
digits and various copy errors that can be made while writing the
projection properties) at www.spatialreference.org
then, you just have to do something like this
library(rgdal)
data<-read.table ("mydata.txt", h=T, sep=",") #your original dataset
coordinates(data)<-~ X + Y # where X and Y stand for the name of your
lat/lon columns
proj4string(data)<-CRS("+init=epsg:4326") #if your coordinates are in WGS84
data.proj<-spTransfrom(data,
CRS("+init=epsg:the.correct.epsg.number.of.your.projection")
HTH
Alex
Le 24/08/2010 16:51, Jonathan Marc Bearak a écrit :
> Hi,
>
> I'm new to GIS and have been trying to convert latitude and longitude to/from state plane coordinates.
>
> I've tried using the project() program from the proj4 library to convert lat/lng to FIPS 3104 (New York State Long Island).
>
> No matter how I go about this, however, the coordinates come out wrong. E.g.,
> "+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +units=ft +no_defs +datum=NAD83",
> "+proj=lcc +a=6378137 +es=.0066943800229 +lon_0=-74 +lat_1=41d2 +lat_2=40d40 +lat_0=40d10 +x_0=300000 +y_0=0 +units=ft +no_defs +datum=NAD83",
>
> E.g., if I try the inverse, to convert 1062791, 209606.6 to lat/lng, project() prints: 43.04762 -76.89626. The correct coordinates, however, are: 40.7416495 -073.7165681.
>
> I've been reading the mailing lists and searching Google and R project PDFs and manual pages without any luck for an embarrassingly long number of hours without any luck.
>
> Thanks for any help.
>
> Best,
> Jonathan
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list