Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESRI's shapefile to Matlab

I am looking for a function to read/write points, lines and polygons from ESRI's shapefile format (as used in Arcview) for use in Matlab

like image 925
Elpezmuerto Avatar asked Oct 06 '10 13:10

Elpezmuerto


People also ask

How do I read a shapefile in Matlab?

Read the shapefile by using the shaperead function. Indicate that the shapefile uses latitude and longitude coordinates using the 'UseGeoCoords' name-value pair. Note that the shaperead function returns a geographic data structure with latitude and longitude fields (a geostruct ).

What shapefile format?

A shapefile is an Esri vector data storage format for storing the location, shape, and attributes of geographic features. It is stored as a set of related files and contains one feature class.

How do I read a geodatabase in Matlab?

If the file is in your current folder or in a folder on the MATLAB® path, then specify the name of the file, such as "myFile. shp" . If the file is not in the current folder or in a folder on the MATLAB path, then specify the full or relative path name, such as "C:\myfolder\myFile. gpx" or "dataDir\myFile.


2 Answers

From the Matlab mapping toolbox, use the shaperead function

For example download the NOAA Interstate Highway shape file here, extract and then read data into Matlab using the function, S = shaperead('in101503.shp');

like image 150
Elpezmuerto Avatar answered Sep 30 '22 07:09

Elpezmuerto


If you do not have the Matlab mapping toobox, the very useful m_map package now has an m_shaperead() function which does a good job of reading shapefiles.

X = m_shaperead('filename'); % for filename.(dbf,shp,...)
like image 42
Alex Avatar answered Sep 30 '22 07:09

Alex