Code covered by the BSD License  

Highlights from
KML-Matlab-Shapefile conversion

5.0

5.0 | 1 rating Rate this file 41 Downloads (last 30 days) File Size: 5.21 KB File ID: #25104

KML-Matlab-Shapefile conversion

by Michael Toomey

 

21 Aug 2009 (Updated 01 Jun 2010)

Matlab script to import KML files into Matlab as well as conversion to Shapefile.

| Watch this File

File Information
Description

Matlab script to read KML files into a mapstruct structure array and offers the option of writing to a Shapefile. KML files must be of a uniform type: Point, LineString, LinearRing or
Polygon. The output contains 5-6 fields, 'Geometry', 'X', 'Y', 'altitude', 'Id' and 'name'. The final field is created and populated only if there is exactly one <name> tag for each feature - these are the names that are used in Google Earth for labeling. This mapstruct array can be easily displayed in Matlab using the 'mapshow' or 'geoshow' command. This output format allows exporting to a Shapefile using the Matlab command, 'shapewrite', which is initiated by entering an output filename into the function. This conversion requires Matlab version 2008a or a more recent version.

Required Products Mapping Toolbox
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
07 Sep 2010 Eliza

Really great code, thanks!

31 Mar 2011 ssisscu Garcia

Dear Michael,

I have downloaded your code, but I do not know how to use it (I am quite new in matlab...).I write:

kml_shapefile('myKML.kml','mySHP.shp')
 
and it does not work, I get:
??? Error: File: kml_shapefile.m Line: 1 Column: 11
Unexpected MATLAB expression.

Could you help me on this?

Thanks!

FRAN

Please login to add a comment or rating.
Updates
01 Jun 2010

June 1, 2010 : Small change to the help information/description to correct a typo. The code itself is exactly the same.

Tag Activity for this File
Tag Applied By Date/Time
data import Michael Toomey 24 Aug 2009 13:09:15
data export Michael Toomey 24 Aug 2009 13:09:15
earth science Michael Toomey 24 Aug 2009 13:09:15
earth science Gil Tidhar 28 Sep 2010 23:59:18
earth science Cesar Vega 03 Oct 2010 11:51:17

Contact us at files@mathworks.com