T = geotable2table(GT)
converts the geospatial table GT to a table. The function replaces the
objects in the Shape variable of GT with well-known
text (WKT) string representations of geometry. The geospatial table and the table have the
same dimensions.
T = geotable2table(GT,varnames)
replaces the Shape variable with variables that have names specified by
varnames.
Convert a geospatial table to a table, then write the data to an Excel® spreadsheet file.
Import a shapefile containing the coordinates of world cities as a geospatial table.
GT = readgeotable("worldcities.shp");
Find the coordinate reference system type. The coordinate reference system type helps you determine appropriate variable names for the table.
GT.Shape.CoordinateSystemType
ans =
"geographic"
Convert the geospatial table to a table. Replace the Shape variable with two variables containing coordinates by specifying the second argument as a two-element vector. The coordinate system is geographic, so use the variable names "Latitude" and "Longitude".
Import a shapefile containing a road network in Boston, MA, as a geospatial table. The Shape variable of the geospatial table contains maplineshape objects.
Convert the geospatial table to a table. The geotable2table function replaces the objects in the Shape variable with WKT string representations of geometry.
Table variable names used to replace the Shape variable of the
geospatial table, specified as a string scalar or two-element string vector.
To replace the shape objects in the Shape variable with WKT
string representations of geometry, specify varnames as a
string scalar, such as "WKTStrings". Unlike shape objects, WKT
string representations of geometry do not contain information about the coordinate
reference system.
To replace the Shape variable with two table variables
containing latitude and longitude coordinates or x- and
y-coordinates, specify varnames as a
two-element string vector, such as ["Latitude"
"Longitude"].
The geotable2table function does not project or unproject
coordinates. For more information about projecting or unprojecting coordinates, see
projfwd or projinv.
Output table, returned as a table or timetable
object.
When you specify varnames as a string scalar, the output
table contains WKT string representations of geometry.
When you specify varnames as a two-element string vector,
the output table contains latitude-longitude or x-
y coordinates. If a table row represents an individual point,
then the coordinates are returned as numeric scalars. Otherwise, the coordinates are
returned as cell arrays of numeric vectors.
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.