[R] problem with project command in rgdal
Michael Sumner
mdsumner at gmail.com
Tue Oct 18 10:43:30 CEST 2011
Hello, this question is more suitable for the R-Sig-Geo mailing list,
so you could consider posting there in future. Read the information
for that list here:
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Comments below.
On Tue, Oct 18, 2011 at 3:11 PM, kalee <kathryn.lee1 at students.mq.edu.au> wrote:
> Hi
>
> I'm trying to analyse some data and need to set the geographic coordinate
> system before I can do the analysis. I've been trying to use the project
> command in rgdal but keep getting an error message saying:
>
>
> Error in project(locationsMatrix, PROJECTION.OUT) :
> latitude or longitude exceeded limits
>
The message is pretty explicit so, I would check the coordinates
themselves, try range(locationsMatrix[,1]) and
range(locationsMatrix[,2]) and see that they are sensible for
longitude and latitude respectively - project() expects a 2 column
matrix with lon, lat in that order.
> ( PROJECTION.OUT <- "+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132
> +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
>
> I know that I'm using the right proj4 format (got it from the espy file in
> the Proj4 data directory) and I know that the datum is correct as I often
> use it in GIS (GDA94; Australia Albers).
>
You must mean the "epsg" file - it stands for "European Petroleum
Survey Group" http://www.epsg.org/.
> Before using the project command I have a series of commands to make my raw
> input (a csv file) into a matrix with only the two columns of co-ordinates.
> There doesn't seem to be any problem in the matrix either.
> I'm really confused as to what the problem could be. I've used this command
> successfully for other datasets.
>
Please share the code in full, since it might hide obvious problems
that others could see. Providing a summary of the locationsMatrix
columns, for at least their range (min/max) will probably suffice.
They may simply not be in the range you expect, or they may be in the
wrong order for longitude / latitude as mentioned above.
Please also tell use your version of R and at least the version of
rgdal, sessionInfo() gives a good summary.
Cheers, Mike.
> Thanks in advance of any help/suggestions
>
> --
> View this message in context: http://r.789695.n4.nabble.com/problem-with-project-command-in-rgdal-tp3914203p3914203.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com
More information about the R-help
mailing list