[R-sig-Geo] rgdal

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 18 16:38:19 CEST 2010


On Fri, 18 Jun 2010, tom sgouros wrote:

>
> Roger:
>
> Thank you for the answers.  But I still don't understand why the default
> installation wouldn't work before I tried to specify the location
> explicitly?  /usr/local/lib doesn't seem non-standard to me, and it was
> the default from the PROJ 'make install'.  Why wouldn't the default
> rgdal installation work with the default PROJ installation?

I believe that your syntax in the install.packages() command was wrong, 
you had:

configure.args=c(PROJ='--with-proj-lib=/usr/local/lib')

which I don't think is what is needed, I think that the name PROJ= is 
redundant, but c(rgdal='--with-proj-lib=/usr/local/lib') would seem to 
correspond to the documentation, because this is a configure argument to 
rgdal. In the example, two R packages are being installed, each with a 
configure argument.

>
> Also, how would you suggest testing the PROJ installation?

make check in proj-4.7.0 for that release.

> Or GDAL, for that matter.

It is a separate download - look for gdalautotest for the major release 
family.

> Neither makefile seems to have a test target, and I'm coming to them as 
> dependencies of a different package that I want to use, so they are not 
> libraries with which I am familiar.  Where can I find a test program?

Usually it is sufficient to run ogrinfo on any vector file, and gdalinfo 
on any raster file (both for simple drivers). This shows that the 
dynamically loaded dependencies are satisfied. Running the gdalautotest is 
more for developers.

Hope this helps,

Roger

>
> Thank you,
>
> -tom
>
>
> Roger Bivand <Roger.Bivand at nhh.no> wrote:
>
>> On Thu, 17 Jun 2010, tom sgouros wrote:
>>
>> Your syntax for the configure.args= argument was wrong, and most
>> likely it would fail on GDAL next. If you want to install from source,
>> install PROJ.4 first, test it (you need the headers and the *shared*
>> library), then install and test GDAL. When they are in place,
>> determine the correct locations and use configure.args= without any
>> PROJ=.
>>
>> If this sounds hard, use the Kyngchaos route, which is well tried,
>> both for getting the external dependencies and installing rgdal from
>> source, or indeed for installing binary rgdal (William Kyngesburye is
>> kind enough to keep things pretty updated).
>>
>> The easiest route is to do:
>>
>> setRepositories(ind=1:2)
>> install.packages("rgdal")
>>
>> which looking at the list archives would have shown, for example
>> google on:
>>
>> R-sig-geo rgdal MAC
>>
>> or similar. The second repository in the list is in this case on OSX
>> at Oxford on CRAN extras, and the rgdal binary with bundled PROJ.4 and
>> GDAL dependencies is built by Brian Ripley:
>>
>> http://www.stats.ox.ac.uk/pub/RWin/bin/macosx/leopard/contrib/2.11/rgdal_0.6-27.tgz
>>
>> or similar for the R 2.10 and development 2.12 releases.
>>
>> Unless you need extra drivers, installing from CRAN extras version is
>> probably the easiest.
>>
>> Roger
>>
>>>
>>> Alex Mandel <tech_dev at wildintellect.com> wrote:
>>>
>>>> On 06/17/2010 05:40 PM, tom sgouros wrote:
>>>>>
>>>>> Hello all:
>>>>>
>>>>> I read this in the rgdal documentation:
>>>>>
>>>>>> The GDAL and PROJ.4 libraries are external to the package, and, when
>>>>>> installing the package from source, must be correctly installed first.
>>>>>
>>>>> Does "correctly" mean something different from the default?  I installed
>>>>> PROJ.4 on my Mac OS X (10.6) machine, using 'make all' and 'make
>>>>> install'.  I saw no errors, and I see libproj.a sitting happily in
>>>>> /usr/local/lib which seems pretty standard to me, but when I try to
>>>>> install rgdal, I get this:
>>>>>
>>>>>   ...
>>>>>   checking proj_api.h usability... yes
>>>>>   checking proj_api.h presence... yes
>>>>>   checking for proj_api.h... yes
>>>>>   checking for pj_init_plus in -lproj... no
>>>>>   Error: libproj.a not found.
>>>>>   If the PROJ.4 library is installed in a non-standard location,
>>>>>   use --configure-args='--with-proj-lib=/opt/local/lib' for example,
>>>>>   replacing /opt/local/* with appropriate values for your installation.
>>>>>   If PROJ.4 is not installed, install it.
>>>>>
>>>>> Before it was installed, the configure choked on the line about
>>>>> proj_api.h.
>>>>>
>>>>> It was already installed, but per those directions, I tried this:
>>>>>
>>>>>> install.packages(c("rgdal"), 
lib="/Library/Frameworks/R.framework/Resources/library", 
contriburl=contrib.url(getOption("repos"),'source'), 
type='source', 
dependencies=TRUE, 
configure.args=c(PROJ='--with-proj-lib=/usr/local/lib'))

>>>>>
>>>> Those instructions seem to indicate that it should be:
>>>> configure.args='--with-proj-lib=/usr/local/lib'
>>>> while the R code you put in may seem similar and theoretically provide
>>>> the same, try doing it exactly like the example.
>>>
>>> The example is from a command line invocation of ./configure.  How that
>>> relates to an install.packages() option wasn't obvious to me.  I was
>>> just copying the example in the install.packages() documentation.  But I
>>> tried it your way just now and it still doesn't work.  Same error.
>>> Besides, what's so non-standard about /usr/local/lib?
>>>
>>>>
>>>> The other option to consider is install Proj and GDAL from the Frameworks:
>>>> http://www.kyngchaos.com/software/frameworks
>>>>
>>>> I know people have gotten the frameworks to work.
>>>
>>> I'll try that, but I'm still mystified.
>>>
>>> Thank you,
>>>
>>> -tom
>>>
>>>
>>>>
>>>> Enjoy,
>>>> Alex
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at stat.math.ethz.ch
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>>
>>>
>>>
>>
>> --
>> 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
>>
>
>
>
>
>
>
>
>

-- 
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