How to convert text files with long-lat corner positions into shape-files

3 views (last 30 days)
I need to know how to transfer our areal data from matlab numerical matrix into shape files, using our MatLab Mapping toolbox. The problem looks as this:
We have map data contained in a matlab matrix, where each row contains information about the position and properties of a square of land area. More specifically, each row contains two longitude columns (x_min and x_max) and two latitude columns (y_min, y_max), where the values in these columns have the unit "degree". Hence, these four values describe the corner-positions of the square of land area. Moreover, these position values are generated for a specific projection (UTM33 in our case) and reference ellipsoid (wgs84). The rest of the columns in the row contains quantitative and qualitative property values for the square.
Which functions/code lines from the mapping toolbox can I use to construct a shape-file from the matlab matrix? (using as inputs the matlab matrix, the geoid model, and the projection. The shape file produced this way must be able to open in other GIS software (e.g. ESRI)
  2 Comments
Chandra Kurniawan
Chandra Kurniawan on 6 Dec 2011
You can use command 'shapewrite' to write geospatial data into .shp file.
Then to read data from txt file, you can use command 'textscan'.
Would you show me how do you format your text file?
Espen Donali
Espen Donali on 8 Dec 2011
Hello, and thanks for your respons..I have one comment and one question to you :)
My comment:
my original problem definitions was somewhat missleading, I have now changed it. I wrote: "..from text file into shape-file ..", the correct description will be: "... from a matlab numerical matrix into a shape-file.. ". Se my edited problem definition above.
my question:
I know that "shapewrite" is the correct tool to use, but unsure how to use it on my matrix. What I do know, is that the data in the matrix must be converted into a struct array, but I have no clue what struct fields it must contain to and what to call the fields that will contain data from the long and lat columns in the matlab matrix. do you have an idea?

Sign in to comment.

Answers (1)

Ghada
Ghada on 30 Mar 2014
Hi, I had the same problem but I found this link and It helped me to create the geostruct to save my vector data as a shapefile.
Hope that help.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!