[R-sig-Geo] a projection question

Roger Bivand Roger.Bivand at nhh.no
Mon Dec 23 14:26:24 CET 2013


On Sat, 21 Dec 2013, Hodgess, Erin wrote:

> Hello everyone:
>
> I'm setting up a function in which the user enters the projection (as 
> part of other stuff).
>
> What is the best way to determine if the entered projection is correct, 
> please? (so I can send back an error message right away).
>

Getting back to the real question, after a detour through checking the 
syntactic validity of strings submitted to PROJ.4, you may need to think 
of the semantic correctness of an apparently syntactically correct string. 
Even with CRS objects read from files on import (with for example readGDAL 
or readOGR), it happens that the metadata, including the projection are 
wrong or incomplete (they often miss the +datum= and +towgs84= tags). If 
the user enters a projection as a string directly, guidance may be needed 
to show how to check for semantic correctness.

A practical way to do this for vector objects is to define the projection 
given the user's best knowledge, spTransform() (perhaps a part) to 
"+proj=longlat +datum=WGS84", and export to KML with writeOGR. When the 
KML file is loaded into GE, one can see whether the projection string 
appears adequate, or whether more research (for example using 
http://www.asprs.org/Grids-Datums.html) is needed - maybe getting back to 
the data providers for authority if the discrepancy is large.

This is harder to do for grids, unless known ground control points are 
available, to be treated like vector data.

Hope this helps,

Roger

> Thanks,
> Erin
>
>
> 	[[alternative HTML version deleted]]

Please post plain text!

>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
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