[R-sig-Geo] How do change projection from geographic coordinate to projected coordinate system in R?

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 24 11:15:37 CET 2009


On Mon, 23 Nov 2009, Zia Ahmed wrote:

> Hi all,
>
> I want project several  several raster(.tif)  and vector (.shp)  files in R 
> using rgdal driver. One set of  files are in  geographic coordinate system 
> (WGS84) other are in LCC-Bangladesh coordinate system.
>
> .I want to re-project them to EPSG:3104 (Gulshan 303/ BTM).  If some help me 
> this regard it will appreciated.

For the vector files, make sure that the Spatial*DataFrame objects read 
from the shapefiles have valid coordinate reference system descriptions. 
Then use spTransform() in rgdal to CRS("+init=epsg:3104"). Note that I see 
3106 not 3104 in EPSG. Further, EPSG does not define a datum, so more work 
will be required to establish the actual input and output CRS values.

See http://www.asprs.org/resources/GRIDS/ for March 2008, which includes 
values for a three-parameter +towgs84= transformation for Gulshan (watch 
the signs!). From Cliff Mugnier's description, it looks as though your LCC 
below is "+init=epsg=24375", # Kalianpur 1937 / India zone IIb, which does 
not include a +towgs84= conversion - more searching will be needed. There 
is a +towgs84= for Kalianpur 1975, but the ellipsoid is different from 
yours. I see TOWGS84[214.0, 804.0, 268.0, 0.0, 0.0, 0.0, 0.0] in 
http://apps.who.int/tools/geoserver/srsHelp.do, but you need someone with 
knowledge rather than Google!

Typically, you need to find a ground control point on your vector map, 
transform it to "+proj=longlat +datum=WGS84", and use writeOGR() with the 
"KML" driver to view in Google Earth. Because you can zoom in, you should 
be able to see when the coordinate reference system is adequate. See also 
http://spatialreference.org/.

You cannot project raster data, you have to warp it to a regular grid in 
the target coordinate reference system. This involves interpolation, so 
see for example projectRaster() in the raster package on R-Forge for 
ideas.

>
> Thanks
>
> Zia
>
> Below I mentioned parameter of LCC-Bangladesh coordinate system:
> Projection: Lambert_Conformal_Conic
> False_Easting: 2743186.000000
> False_Northing: 914395.000000
> Central_Meridian: 90.000000
> Standard_Parallel_1: 23.176944
> Standard_Parallel_2: 28.822770
> Latitude_Of_Origin: 26.000000
> Linear Unit: Meter (1.000000)
>
> Geographic Coordinate System: GCS_Everest_Bangladesh
> Angular Unit: Degree (0.017453292519943299)
> Prime Meridian: Greenwich (0.000000000000000000)
> Datum: D_Everest_Bangladesh
> Spheroid: Everest_Adjustment_1937
> Semimajor Axis: 6377276.344999999700000000
> Semiminor Axis: 6356075.413140240100000000
> Inverse Flattening: 300.801699999999980000
>
>
>
>

-- 
Roger Bivand
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-sig-Geo mailing list