shapeinfo
Information about shapefile
Description
returns a structure, info
= shapeinfo(filename
)info
, whose fields contain information about
the contents of a shapefile.
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 folder and the unit of length or angle is not specified. 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.
Examples
Get CRS Information from Shapefile
Get projected or geographic CRS information from a shapefile by using the shapeinfo
function.
First, return information about a shapefile as a structure. For this example, specify a shapefile that uses projected coordinates. Then, get information about the coordinate reference system by querying the CoordinateReferenceSystem
field of the structure.
S = shapeinfo('boston_placenames.shp');
S.CoordinateReferenceSystem
ans = projcrs with properties: Name: "NAD83 / Massachusetts Mainland" GeographicCRS: [1x1 geocrs] ProjectionMethod: "Lambert Conic Conformal (2SP)" LengthUnit: "meter" ProjectionParameters: [1x1 map.crs.ProjectionParameters]
Note that the value of the CoordinateReferenceSystem
field is a projcrs
object because the shapefile uses projected coordinates.
Input Arguments
filename
— File name
string scalar | character vector
File name of the shapefile, specified as a string scalar or character
vector. filename
can be the base name or the full name of
any one of the component files.
Output Arguments
info
— Information about shapefile contents
structure
Information about shapefile contents, returned as a structure contains the following fields.
|
Char array containing the names of the files that were read |
|
Character vector containing the shape type |
|
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 |
|
Structure array of size
1-by-
|
|
The number of spatial features in the shapefile |
| Coordinate reference system (CRS), returned as a
|
Version History
Introduced before R2006a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)