| Mapping Toolbox™ | ![]() |
info = shapeinfo(filename)
info = shapeinfo(filename) returns a structure, info, whose fields contain information about the contents of a shapefile.
The shapefile format was defined by the Environmental Systems Research Institute (ESRI) to store nontopological vector geometry and attribute information for spatial features. A shapefile consists of a main file, an index file, and an xBASE table. All three files have the same base name and are distinguished by the extensions .SHP, .SHX, and .DBF, respectively (e.g., given the base name 'roads' the shapefile filenames would be 'roads.SHP', 'roads.SHX', and 'roads.DBF').
filename can be the base name or the full name of any one of the component files. shapeinfo reads all three files as long as they exist in the same directory and have valid file extensions. If the main file (with extension .SHP) is missing, shapeinfo returns an error. If either of the other files is missing, shapeinfo returns a warning.
The info structure contains the following fields:
Filename | Char array containing the names of the files that were read |
ShapeType | String containing the shape type |
BoundingBox | Numerical array of size 2-by-N that specifies the minimum (row 1) and maximum (row 2) values for each dimension of the spatial data in the shapefile |
Attributes | Structure array of size 1-by-numAttributes that describes the attributes of the data |
NumFeatures | The number of spatial features in the shapefile |
The Attributes structure contains these fields:
Name — String containing the attribute name as given in the xBASE table
Type — String specifying the MATLAB® class of the attribute data returned by shaperead. The following attribute (xBASE) types are supported: Numeric, Floating, Character, and Date.
Note shapeinfo cannot tell you what coordinate system data in a shapefile use. Coordinates can be either planar (x, y) or geographic (lat, lon) and have a variety of units. Because shapefiles do not document coordinate systems, shapeinfo cannot tell you what map projection coordinate data may be in or what the projection's parameters are. You need to obtain this information from your shapefile vendor. This information can be critical to the proper display of shapefile vector data, because by default shaperead will generate mapstructs that describe map coordinates (projected x,y pairs) unless you specify that the shapefile contains geographic coordinates using the optional 'UseGeoCoords',true parameter/value pair. |
![]() | shaderel | shaperead | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |