Access locations in maplineshape

9 次查看(过去 30 天)
Andrew Stevens
Andrew Stevens 2023-5-31
评论: Robert Daly 2024-8-14,1:32
Hi,
I am trying to access the locations in a maplineshape object. They are in there because I am able to plot the locations using the geoplot function. For example, if I have the following geotable:
T = readgeotable("concord_roads.shp");
geoplot(T.Shape(1))
How do I access the locations in the maplineshape object, T.Shape(1)? I don't see anything in the documentation or an obvious method associated with the object.
Thanks!

回答(1 个)

Andrew Stevens
Andrew Stevens 2023-5-31
I am going to answer my own question here. I found I can get the coordinates buried in the maplineshape (or any other geospatial table object, I think) in the following way:
T = readgeotable("concord_roads.shp");
T2=geotable2table(T,["X","Y"]);
x=T2.X;
y=T2.Y;
There is probably a better way to do this, but it works. The documentation for geotable2table doesn't say anything about getting coordinates out of a geospatial table object so I was just trying stuff.
  1 个评论
Robert Daly
Robert Daly 2024-8-14,1:32
Thanks, this was driving me nuts.
Previously I used readgeotable to read a GPX file, that let you access the Lat and Long so I was expecting something similar with a shape file (in projected coordinates), not so.

请先登录,再进行评论。

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by