

Roger,

It seems likely from what you say that it is the particular shape file I am working with that is causing the problems. This potentially could make sense. I downloaded separate ward boundary files for England and Wales from the Edina.ac.uk mapping service. I then merged these in ArcView and exported it as a shapefile. Perhaps it is this merged shapefile that is the problem.

To check this I will attempt to follow your original instructions with an original, unmerged shapefile from Edina.ac.uk and see if this works. If so, I think this will confirm your diagnosis.

I am more than happy to post the file to you on a CD-Rom but cannot really post it online as I had to sign a licence agreement to download it originally, and think that this would be a breach of its terms. I will dispatch it to you immediately to the address in your email signature.

I will also try the other tests you outlined in your previous post and will get back to you with the results.

Thanks again for your help,
Graham




-----Original Message-----
From: Roger Bivand [mailto:Roger.Bivand@nhh.no]
Sent: Wed 8/9/2006 7:34 PM
To: Cookson, Graham D
Cc: r-sig-geo@stat.math.ethz.ch
Subject: Re: [R-sig-Geo] Map2Poly: Error message
 
On Wed, 9 Aug 2006, Graham Cookson wrote:

> 
> 
> Dear Roger (...and the list)
> 
> Thank you Roger for that useful insight. I have tried your suggestion and,
> once again, encountered some error messages. I've played around with it a
> little bit, but I'm getting nowhere.
> 
> Perhaps you will have come across this problem before.
> 
> I tried your routine so I typed:
> 
> library(foreign)
> library(maptools)
> library(spdep)
> map<-readShapePoly("englandandwales.shp")
> 
> But I got the following error:
> 
> Error in if (rD < 0) hole <- TRUE : missing value where TRUE/FALSE needed
> 
> Following the various examples in the help file I then tried
> 
> map<-readShapePoly("englandandwales.shp", IDvar="LABEL")
> 
> But now get the following error:
> 
> Error in from [j]: to [j]: NA/NaN argument
> 
> Error in coordinates(coords): unable to find the argument 'obj' in selecting
> a method for function 'coordinates'
> 
> 
> I've got this feeling I'm just doing something really silly but can't work
> it out. Any help welcome. It may help to know that all I want to do is
> produce a proximity matrix of contiguous boundary neighbours from the
> Shapefile for now.
> 
> 
> Again, I'm using R2.2.0 on an Apple iBook G4. The shapefile is a merged file
> of England and Wales ward boundaries downloaded from Edina.ac.uk and was
> merged in ArcView. It contains some 8,500 polygons and is 250MB.

Graham,

There is almost certainly something wrong with the shapefile, and the only 
way to debug this is either for you to do it, or for you to make the file 
available for the maptools package maintainer (me) to do it. It's too 
large to email, you may not want to post it on an open website, so maybe 
copy it to a CDROM and send it by post?

We know that firms like Geolytics sell shapefiles breaking the ESRI
specification, and I would not be surprised if this is also the case.

In my original reply 

https://stat.ethz.ch/pipermail/r-sig-geo/2006-August/001214.html

I suggested that you should include sessionInfo() and traceback()  
information. Since you have not done this, we don't know which version of
maptools you are using, not what the call context of the error messages 
actually was. Since you are on OSX, you could install the rgdal
package from source (if you can do that, involving installing GDAL and 
PROJ.4 too, try readOGR() in that package). 

What we need to dig out is first which shape is throwing the error, and
then what value is present that leads to the error. This will involve
using debug() on the private functions I named before and trying to read
your data (or similar data with the same error).

Can other software read the file? 

Roger

> 
> Thank you,
> Graham
> 
> 
> 

-- 
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@nhh.no



	[[alternative HTML version deleted]]


