forked from bugsuse/m_map_utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm_mapshow.m
35 lines (28 loc) · 1021 Bytes
/
m_mapshow.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function m_mapshow(shapefile)
% M_MAPSHOW display shapefile using the current projection
% m_mapshow(shapefile)
%
% Yang Li ([email protected]) 1/May 2020
%
% This software is provided "as is" without warranty of any kind. But
% it's mine, so you can't sell it.
% 1/May 2020 first version
global MAP_PROJECTION MAP_COORDS
if isempty(MAP_PROJECTION)
disp('No Map Projection initialized - call M_PROJ first!');
return;
end
if nargin==0
disp(' Usage');
disp(' m_mapshow(shapefile)');
else
shape = shaperead(shapefile);
lon = [shape.X]; lat = [shape.Y];
if strcmp(MAP_COORDS.name.name,MAP_PROJECTION.coordsystem.name.name) && ... % using same coord system as projection
MAP_COORDS.name.mdate==MAP_PROJECTION.coordsystem.name.mdate
% Sneaky way of making default clipping on (sneaky 'cause only the 4th
% input parameter is checked for the clipping property)
[lon, lat] = m_ll2xy(lon, lat);
mapshow(lon, lat, 'color', 'k', 'linewidth', 1.2);
end
end