[R-sig-Geo] Converting shapefile from gridded to lat/ lng

Steve Pickering pickering at penguin.kobe-u.ac.jp
Mon Jan 20 09:48:58 CET 2014


Thank you both, this is perfect.  I wonder if there is a way using
Pascal's approach to then plot it as an unprojected map, rather than
with transverse Mercator.  Sorry, I'll stop bothering you after this
question!

 - Steve.
Steve Pickering
Assistant Professor
Graduate School of Law
Kobe University
2-1 Rokkodai-cho
Nada-ku, Kobe
657-8501 Japan
pickering at penguin.kobe-u.ac.jp
http://www.stevepickering.net


On 20 January 2014 17:32, Pascal Oettli <kridox at ymail.com> wrote:
> Hello,
>
> Thank you Barry. Always interesting to learn something.
>
> Regards,
> Pascal
>
>
> On 20 January 2014 17:25, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
>> On Mon, Jan 20, 2014 at 8:10 AM, Pascal Oettli <kridox at ymail.com> wrote:
>>
>>> crs.ll <- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"
>>> crs.tmerc <- "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717
>>> +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs"
>>>
>>> authoritiesMap.TMERC <- readShapePoly("LAD_Pop_EngWales2011",
>>> proj4string=CRS(crs.tmerc))
>>
>> proj4string(authorities.Map) = CRS(crs.tmerc) # surely?
>>
>>> authoritiesMap.LL <- spTransform(authoritiesMap.TMERC, CRS(crs.ll))
>>
>> If you use readOGR from package:rgdal *and* your shapefile comes with
>> the correct .prj file (in the same folder with the .shp and .dbf) then
>> the spatial polygons object will already have the correct CRS assigned
>> to it and you can skip half these steps. Something like:
>>
>> map = readOGR(".","LAD_Pop_EngWales2011")
>> mapLL = spTransform(map, CRS("+init=epsg:4326"))
>>
>>  - epsg code 4326 is the lat-long system as used by GPS. epsg code
>> 27700 is the UK national grid format which might be what you original
>> file is, or something else entirely! Anyway, if you've got a .prj
>> file, its a two-liner.
>
>
>
> --
> Pascal Oettli
> Project Scientist
> JAMSTEC
> Yokohama, Japan
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list