[R] how to image.plot a XY grid file into a lat-lon map
Roger.Bivand at nhh.no
Thu Apr 5 14:31:40 CEST 2007
On Thu, 5 Apr 2007, Vladimir Eremeev wrote:
> If your country or state borders are polygons or polylines, you could
> convert them to desired projection using the function project from the
> package rgdal.
> Latitude-longitude grid also could be added by generating desired
> polylines in lat-lon and converting them to the desired projection using
Yes, the route would be to plot the image in its native projection, and
project the vector data (shorelines, countries) to the same projection.
Similar topics have been discussed on the R-sig-geo list, including the
reading of netcdf files (which are a bit picky) with functions in the
rgdal package which import the coordinate reference system directly.
Please follow this up on R-sig-geo if you need more help.
> Linda Smith wrote:
> > I have a netcdf gridded file with LCC projection. I can easily use
> > image.plot to visualize it. However, as the axises are in X,Y, not Lat and
> > Lon, I could not add state or country maps onto it (or lat lon
> > information).
> > I do have a grid2d file that describes the lat and lon for each (X,Y)
> > grid,
> > but the lat and lon are not regularly spaced, so I could not use
> > image.plot.
> > Does anyone know how to plot this type of gridded data so that country or
> > state borders can be easily added? Thanks a lot!
> What do you mean by "grid2d file that describes the lat and lon for each
> (X,Y) grid"?
> If this are two rasters of the same size having corresponding latitude and
> longitude values in each raster cell, then you could use contourLines to get
> lat-lon grid. However, you, probably, will want to smooth it.
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-help