Subject: RE: [R-sig-Geo] maptools package rejects some polygon shapefiles?

Roger Bivand Roger.Bivand at nhh.no
Thu May 12 19:44:40 CEST 2005


On Thu, 12 May 2005, Nicholas Lewin-Koh wrote:

> Hi, No I actually meant to have a slot, or place for the 3rd dimension.
> and for plotting methods treat it like an attribute. I was trying to
> think of situations where 3d lines or polygons would be useful,
> admittedly I am a little stumpped, but I am sure there must be something
> other than pretty flythroughs :) Maybe a polygon view of a surface where
> thew polygon heights are interpolated from binned data to the vertices
> of the polygon?

I can see why visualising points is worth the trouble, and by extension 
voxels. Maybe even for polylines, such as showing the gradient of a 
stream by plotting z against the (x,y) distances. But plotting the varying 
z of a polygon boundary (this is a 2.5D object, I think, not CAD/CAM, 
non-self-intersecting?)? 

Maybe go by steps and see how easy it is to return the line and polygon z
values in the matrix of coordinates, and strip them by default? Something
like that? The z values in the original posting were spurious, ArcGIS just
output them, the data were decimal degree lat-long of a coastline.

Shall I put the maptools package code on sourceforge?

Roger

> 
> Nicholas
> 
> On Thu, 12 May 2005 18:09:45 +0200 (CEST), "Roger Bivand"
> <Roger.Bivand at nhh.no> said:
> > On Thu, 12 May 2005, Nicholas Lewin-Koh wrote:
> > 
> > > Hi,
> > > Wouldn't it make more sense to handle 3d file as 3d?
> > > In outher words store 3d poionts as 3d points. For dealing 
> > > with this in R, we could write methods that would display the 
> > > 3rd dimension as an attribute. I don't think it would be hard to change
> > > the
> > > underlying C code to reade shape 3d files. I think the challange would
> > > be in the
> > > R data structure and methods.
> > 
> > For points, 3D will be OK, one Z value per point, hence an attribute. But 
> > with lines and polygons, is anyone likely to need all three dimensions? 
> > The attributes are attached to each shape, which implies that a per
> > vertex 
> > attribute would be a different kind of thing, wouldn't it? Which research 
> > situations might need 3D for anything other than points? It can probably 
> > be done, but the sp package lines and rings are 2D, and they would be the 
> > containers I would look at first (unless persuaded otherwise).
> > 
> > Roger
> > 
> > > 
> > > Nicholas
> > > 
> > > Date: Thu, 12 May 2005 10:58:31 +0200 (CEST)
> > > From: Roger Bivand <Roger.Bivand at nhh.no>
> > > Subject: RE: [R-sig-Geo] maptools package rejects some polygon
> > >         shapefiles?
> > > To: Rick Reeves <reeves at nceas.ucsb.edu>
> > > Cc: r-sig-geo at stat.math.ethz.ch
> > > Message-ID: <Pine.LNX.4.44.0505121055521.11044-100000 at reclus.nhh.no>
> > > Content-Type: TEXT/PLAIN; charset=US-ASCII
> > > 
> > > On Wed, 11 May 2005, Rick Reeves wrote:
> > > 
> > > >
> > > > Roger:
> > > >
> > > > Thanks for the quick response. Here is the file,
> > > > and I will follow your suggestions.....
> > > > The ArcCatalog metadata section claims that this
> > > > is a Simple Polygon file, Topology FALSE,
> > > > feature count 558, spatial index = TRUE,
> > > > Linear Referencing = TRUE, geographic coord system
> > > 
> > > 
> > > Rick:
> > > 
> > > (I'm replying to the list too to ask for comments)
> > > 
> > > The file is recognised by ogrinfo as:
> > > 
> > > $ ogrinfo NorthAmericaBest.shp
> > > INFO: Open of `NorthAmericaBest.shp'
> > > using driver `ESRI Shapefile' successful.
> > > 1: NorthAmericaBest (3D Polygon)
> > > 
> > > It should not be too difficult to change read.shape to read 3D points as
> > > 3D, and 3D lines and polygons as 2D. I guess that stripping the Z values
> > > is not a problem for anybody (excepting points I think)?
> > > 
> > > Thanks for your help - with a sample file to study, making this work
> > > will
> > > be much easier. Does anyone have 3D lines and 3D points files?
> > > 
> > > Best wishes,
> > > 
> > > Roger
> > > 
> > > 
> > > >
> > > > Regards,
> > > > Rick R
> > > >
> > > >
> > > > Scientific Programmer / Quantitative Analyst
> > > > National Center for Ecological Analysis and Synthesis
> > > > University of California, Santa Barbara
> > > > 805 892 2534
> > > > reeves at nceas.ucsb.edu
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Roger Bivand [mailto:Roger.Bivand at nhh.no]
> > > > Sent: Wednesday, May 11, 2005 12:08 PM
> > > > To: Rick Reeves
> > > > Cc: r-sig-geo at stat.math.ethz.ch
> > > > Subject: RE: [R-sig-Geo] maptools package rejects some polygon
> > > > shapefiles?
> > > >
> > > >
> > > > On Wed, 11 May 2005, Rick Reeves wrote:
> > > >
> > > > > News flash: the read.shapefile() method in the shapefiles package
> > > > reads
> > > > > the file.
> > > >
> > > > It would be useful to see what getinfo.shape(filen) says, and to have a
> > > > sight of the file. The error message suggests that it is neither type 3
> > > > (PolyLine) nor type 5 (Polygon), so ArcGIS 9 must be using other codes
> > > > (perhaps for PolyLineM, PolyLineeM, or their polygon equivalents). If
> > > > you
> > > > could make the file available, it may be possible to try to handle files
> > > >
> > > > like this (benefitting others, since you have a working solution).
> > > >
> > > > Roger
> > > >
> > > > >
> > > > > btw, this is a shapefile based on the VMAP0 / DCW dataset.
> > > > >
> > > > > RR
> > > > >
> > > > > Scientific Programmer / Quantitative Analyst
> > > > > National Center for Ecological Analysis and Synthesis
> > > > > University of California, Santa Barbara
> > > > > 805 892 2534
> > > > > reeves at nceas.ucsb.edu
> > > > >
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: r-sig-geo-bounces at stat.math.ethz.ch
> > > > > [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Rick Reeves
> > > > > Sent: Wednesday, May 11, 2005 9:46 AM
> > > > > To: r-sig-geo at stat.math.ethz.ch
> > > > > Subject: [R-sig-Geo] maptools package rejects some polygon shapefiles?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Greetings:
> > > > >
> > > > > Using maptools in the Win XP environment, trying to
> > > > > display an ESRI Shapefile (created with ArcMAP GIS ver 9)
> > > > > outline map of North America. read.shape throws error:
> > > > > Error in read.shape: Not a valid shape type.
> > > > >
> > > > > read.sahpe does read (and plot displays) a point shapefile
> > > > > created on the same platform.
> > > > >
> > > > > Any hints on determining the problem with 'not valid' shapefiles
> > > > > in R?
> > > > >
> > > > > Thanks,
> > > > > Rick R
> > > > >
> > > > >
> > > > > Scientific Programmer / Quantitative Analyst
> > > > > National Center for Ecological Analysis and Synthesis
> > > > > University of California, Santa Barbara
> > > > > 805 892 2534
> > > > > reeves at nceas.ucsb.edu
> > > > >
> > > > > _______________________________________________
> > > > > R-sig-Geo mailing list
> > > > > R-sig-Geo at stat.math.ethz.ch
> > > > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> > > > >
> > > > > _______________________________________________
> > > > > 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