Dear Dylan,

Thank you for your reply.
I think you are suggesting the following:

library(sp)
df <- data.frame(lat=as.numeric(xlat), lon=as.numeric(xlon),
z=as.numeric(hgt))
coordinates(df) <- ~lon+lat         # SpatialPointsDataFrame
proj4string(df) <- CRS("+proj=longlat +a=637000")
*library(rgdal)
df.lcc <- spTransform(df, crs.lcc)
*spplot(df.lcc, scales=list(draw=TRUE))

This way, the map is rectangular but the axis on the map are the metric
coordinates, not lat/lon.




On Fri, Aug 29, 2008 at 3:52 PM, Dylan Beaudette
<dylan.beaudette@gmail.com>wrote:

> On Friday 29 August 2008, Rosa Trancoso wrote:
> > Hello,
> >
> > I have the same problem as Costas Douvis, reported in
> > https://stat.ethz.ch/pipermail/r-sig-geo/2008-June/003713.html
> >
> > I have a matrix of values, a matrix of latitudes and a matrix of
> > longitudes. The map is "rectangular" in the Lambert projection. So I did
> > the following:
> >
> > library(sp)
> > df <- data.frame(lat=as.numeric(xlat), lon=as.numeric(xlon),
> > z=as.numeric(hgt))
> > coordinates(df) <- ~lon+lat         # SpatialPointsDataFrame
> > proj4string(df) <- CRS("+proj=lcc +a=637000 +lat_1=30 +lat_2=60 +lat_0=40
> > +lon_0=-7.5")
> > spplot(df, scales=list(draw=TRUE))
> >
> > But the map is no projected (it should be a rectangle),
> >
> > As I want to have lat/lon on the axis of the map, and automatically
> produce
> > lots of maps, converting everything to lcc is not straightforward.
> >
> > I am missing something? Any other packages?
> >
>
> I don't often perform spatial transforms in R, but it looks like there is a
> fundamental flaw in your code, and it should look something like this:
>
> 1. setup SpatialPointsDataFrame
> 2. assign the CRS as 'proj=lonlat datum=...'
> 3. invoke the projection method, with the target projection = "+proj=lcc
> +a=637000 +lat_1=30 +lat_2=60 +lat_0=40 +lon_0=-7.5"
>
> 4. the result should be in the target projection.
>
> Cheers,
>
> Dylan
>
>
> --
> Dylan Beaudette
> Soil Resource Laboratory
> http://casoilresource.lawr.ucdavis.edu/
> University of California at Davis
> 530.754.7341
>



-- 
--
Eleanor Roosevelt  - "The future belongs to those who believe in the beauty
of their dreams."

	[[alternative HTML version deleted]]


