How to add plot points in my map?

24 views (last 30 days)
Hi all I am trying learn how to do a map with the air stations located on Pima county. I have the county already my question is how can I add the latitude and longitude of each station on my code? For example one of them is 32.52701484484009 -111.07177734375
Thanks in advance for your help
data = shaperead('tl_2019_us_county.shp','UseGeoCoords',true,'Selector',{@(name)strcmpi('pima',name),'NAME'});
geoshow(data);

Accepted Answer

Adam Danz
Adam Danz on 15 Dec 2019
Edited: Adam Danz on 15 Dec 2019
"...how can I add the latitude and longitude of each station on my code"
Since you are using the shaperead argument pair {'UseGeoCoords',true},
data = shaperead('tl_2019_us_county.shp','UseGeoCoords',true, . . .);
data will be a structure array including fields lon and lat. To add additional latitude and longitude coordinates,
S(end+1).Lon = 32.52701484484009; % adds an additional structure to array
S(end).Lat = -111.07177734375; % adds the lat value to the new structure
% Add any other values to the new structure...
If the goal is to add those coordinates to the map, you can do that without altering the shaperead data.
geoshow(data);
hold on
plot(-111.07177734375, 32.52701484484009,'bo')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!