maptools package rejects some polygon shapefiles?
Calling Arc users! Could somebody please make available some small example 3D points and arcs for me to try out on read.shape() (or a link to a public repository of type POINTZ, ARCZ, and POLYGONZ shapefiles). 3D polygons now work, thanks to an example file from Rick Reeves, but I have no way of creating 3D points or lines to check the function in action, and I don't want to release an untried function (inviting seg.faults). The idea is to support 3D points directly, but to drop the Z values for lines and polygon boundaries - the original example was anyway for the coastline of North America in latlong, so the Z value wasn't so important. Having discussed transect or track data at the Valencia "sp" meeting, we think that a transect should be a SpatialPoints object (which can take 3D points), not a line; this will need extra attention when plotting. Roger
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? 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