How to find the Lat/Lon of the ends of a geolineshape?
10 views (last 30 days)
Show older comments
When I read the shape data of a table obtained using readgeotable function using T.Shape, it returns:
ans =
geolineshape with properties:
NumParts: 1
Geometry: "line"
CoordinateSystemType: "geographic"
GeographicCRS: [1×1 geocrs]
How can I find the Latitude and Longitude data?
3 Comments
KSSV
on 2 Jun 2022
This is a new function, introduced in 2021b. It seems the functions has layers to specify. If you specify the layers, you may get coordinates.
T = readgeotable("sample_tracks.gpx",Layer="track_points");
Answers (1)
Siraj
on 7 Sep 2023
Edited: Siraj
on 7 Sep 2023
Hi! It is my understanding that you want to access the latitude and longitude of a shape stored in the "geolineshape" object.
You read the geographical data from the file "CELPA_371_2019-12-31_M10_20200903-1416.gdb" using the "readgeotable" function. This function will create a geospatial table that includes the "geolineshape" objects in its first column.
However, it's important to note that in your case the "geolineshape" object represents a line geometry, and the latitude and longitude properties do not exist for non-point geometries.
Therefore, a possible workaround to access the coordinate data of the line is to convert the geospatial table to a regular table using the "geotable2table" function.
Refer to the code below for better understanding.
T = readgeotable(filenameBDGD);
T = geotable2table(GT,["Latitude","Longitude"]);
This will create Latitude and Longitude table columns.
You can refer to the following link for detailed information about the "geotable2table" function:
Please note that without access to the specific data file mentioned, I am unable to personally verify the correctness of the solution. However, I hope that the information and the "geotable2table" function will be helpful.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!