Skip to content
Prev 43 / 12125 Next

[R-pkg-devel] how to call PROJ.4 C code in a package?

Roger,

I plan to make the next version of oce use rgdal::project() to do its work. The idea of using an external PROJ.4 is fine in my own work, but oce has a lot of users who are unaccustomed to building and installing external libraries. Also, many work at institutes that do not permit this kind of system modification. So, for oce I had to make a choice of including the C sources or using another package.

At first I felt the proj4 R package to be a natural candidate. However, it produces an error when any point in a lon-lat vector is ?offscale?, instead of inserting NA for the projected value. Indexing over a world coastline is too slow for practical work.

Over the weekend I set up a test version of oce to use rgdal::project(), and it?s early days but things seem to be working well.

I need to study the ?sp? package in more detail.  Maybe I?ll find the solution to a problem ?oce? has when lines in a coastal polygon ?cross over? the edge of the earth. This produces spurious domain-crossing lines when e.g. lon_0 is set to put the Pacific at the centre (a common choice of oceanographers).

Thanks VERY much for your detailed and helpful answer.  And thanks for your work on ?rgdal? and ?sp?, two very fine packages.

? Dan.

PS. glad to see more software going to github.

Dan Kelley
Oceanography Department
Dalhousie University
Halifax, NS, Canada