<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On Aug 17, 2013 4:21 PM, "sara martino" <<a
moz-do-not-send="true" rel="nofollow"
ymailto="mailto:saramartino@yahoo.com" target="_blank"
href="mailto:saramartino@yahoo.com">saramartino@yahoo.com</a>>
wrote:<br>
><br>
> Hi<br>
> i am new to using shapefiles in R. I just want to plot some
maps and I used to do it as:<br>
><br>
><br>
> shp=readShapeSpatial("file.shp")<br>
> plot(shp)<br>
><br>
> using maptools or<br>
><br>
><br>
> shp <-readOGR("path/to/shpfiles","IND_adm2")plot(shp)<br>
><br>
> using rgdal.<br>
><br>
> I have now upgraded to R 3.0.1 and since then everytime i try
to plot the shapefile i get the error:<br>
><br>
> Error in as.double(y) :<br>
> cannot coerce type 'S4' to vector of type 'double'<br>
><br>
> I get the same error also if i try to reproduce the example in
>?readShapeSpatial.<br>
><br>
> Can anyone tell me what is the problem?<br>
> thanks<br>
> sara
<div dir="ltr">Sara,</div>
<div dir="ltr">I ran into a similar problem when I upgraded, and in
my case the problem was that rgdal was compiled against an old
version of GDAL. CRAN specifies GDAL >= 1.6.3, but I would
recommend compiling rgdal against the most recent GDAL you can
install.</div>
<div dir="ltr">Output of Sys.info() and library(rgdal) would be
helpful.</div>
<div dir="ltr">Best,<br>
--Lee<br>
</div>
<br>
<div class="moz-cite-prefix">On 08/18/2013 04:49 AM, sara martino
wrote:<br>
</div>
<blockquote
cite="mid:1376815755.65672.YahooMailNeo@web140904.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:times
new roman, new york, times, serif;font-size:12pt">hi lee,<br>
thanks for the hint, i am not an expert with linux so i am
asking for some more help...<br>
I have tryed to get some more info using the commands that you
proposed and this is the output:<br>
<br>
<div><span>> Sys.info() <br>
sysname <br>
"Linux" <br>
release <br>
"3.2.0-51-generic-pae" <br>
version <br>
"#77-Ubuntu SMP Wed Jul 24 20:40:32 UTC 2013" <br>
nodename <br>
"martino" <br>
machine <br>
"i686" <br>
login <br>
"martino" <br>
user <br>
"martino" <br>
effective_user <br>
"martino" <br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><span>> library(rgdal)<br>
rgdal: version: 0.8-10, (SVN revision 478)<br>
Geospatial Data Abstraction Library extensions to R
successfully loaded<br>
Loaded GDAL runtime: GDAL 1.7.3, released 2010/11/10<br>
Path to GDAL shared files: /usr/share/gdal/1.7<br>
GDAL does not use iconv for recoding strings.<br>
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009,
[PJ_VERSION: 470]<br>
Path to PROJ.4 shared files: (autodetected)<br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><span>can you tell me how to
recompile GDAL? <br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><span>thanks a lot for help,
i really appreciate it!</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><span>bests</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color:
transparent; font-style: normal;"><span>sara<br>
</span></div>
<br>
</div>
</blockquote>
<br>
You're using GDAL 1.7.3, which happens to be the version in the
Ubuntu Precise repository, so I'm going to assume that's where you
installed it from. I would suggest you add the ubuntugis-unstable
repository and upgrade to GDAL 1.10.0. [Note, the following are
system commands, not R commands].<br>
<br>
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable<br>
sudo apt-get update<br>
sudo apt-get upgrade<br>
<br>
Note, if your system is not very up to date, you might not want to
upgrade *everything*. In that case you will have to search for all
the installed *gdal* packages and update them individually. Then
install the dev packages, which are necessary for rgdal to compile:
<br>
<br>
sudo apt-get install libgdal1-dev libproj-dev<br>
<br>
Then in R:<br>
<br>
install.packages("rgdal")<br>
<br>
Let me know how it goes.<br>
<br>
BTW, most people on this list prefer responses bottom-posted (i.e.,
*after* the message you are responding to, not before).<br>
<br>
Best,<br>
--Lee<br>
<br>
<pre class="moz-signature" cols="72">--
Lee Hachadoorian
Assistant Professor in Geography, Dartmouth College
<a class="moz-txt-link-freetext" href="http://freecity.commons.gc.cuny.edu">http://freecity.commons.gc.cuny.edu</a>
</pre>
</body>
</html>