Wednesday, February 24, 2016

States Line disappearing in map: Solved

In matlab you can extract the states lat/lon information and plot them so that the problem of states lines disappearing can be solved.
here is an example where you can extract the state lat/lon data from the axis limit boundary and make lats/lons variables. These can be plotted with geoshow.

figure(1)
latlim = [35 45];
lonlim = [-115 -100];
    ax = worldmap(latlim, lonlim);

  states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
   geoshow(ax, states, 'FaceColor', [1 1 1], 'LineWidth', 3);
   lats = [];
lons = [];
for aa = 1:length(states)
lats = horzcat(lats, states(aa).Lat);
lons = horzcat(lons, states(aa).Lon);
end
geoshow(lats,lons,'DisplayType','Line', 'Color', [0 1 0])
% latlim=[floor(min(min(SatLat))),ceil(max(max(SatLat)))];
% lonlim=[floor(min(min(SatLon))),ceil(max(max(SatLon)))];
surfacem(SatLat, SatLon, double(c66in5));
hold on
plotm( y,x ) % polygon

plotm(37 , -105 , 1, 'yo')
set(gcf,'Color','white')

No comments: