Hello Linda, Friday, April 6, 2007, 2:47:43 AM, you wrote:
LS> On 4/5/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: VE>> If your country or state borders are polygons or polylines, you could convert VE>> them to desired projection using VE>> the function project from the package rgdal. VE>> Latitude-longitude grid also could be added by generating desired polylines VE>> in lat-lon and converting them to the desired projection using project. LS> Linda Smith wrote: LS>>> I have a netcdf gridded file with LCC projection. I can easily use LS>>> image.plot to visualize it. However, as the axises are in X,Y, not Lat and LS>>> Lon, I could not add state or country maps onto it (or lat lon LS>>> information). LS>>> I do have a grid2d file that describes the lat and lon for each (X,Y) LS>>> grid, LS>>> but the lat and lon are not regularly spaced, so I could not use LS>>> image.plot. LS>>> LS>>> Does anyone know how to plot this type of gridded data so that country or LS>>> state borders can be easily added? Thanks a lot! LS>>> VE>> What do you mean by "grid2d file that describes the lat and lon for each VE>> (X,Y) grid"? VE>> If this are two rasters of the same size having corresponding latitude and VE>> longitude values in each raster cell, then you could use contourLines to get VE>> lat-lon grid. However, you, probably, will want to smooth it. LS> Yes, they are. I could add lat and lon info that way, but LS> still I could not use map() function to overlay state borders onto LS> my image plot because this image is not in lat and lon LS> coordinates. I presume you are using the function map() from the maps package. ?map says that it returns a list with x, y, range, and names components. You could do something like following, for example (UNTESTED). state.borders.ll<-map("state",plot=FALSE) state.borders<-project(cbind(state.borders.ll$x,state.borders.ll$y),proj="+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100") lines(state.borders) -- Best regards, Vladimir mailto:[EMAIL PROTECTED] --SevinMail-- ______________________________________________ R-help@stat.math.ethz.ch 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.