3

我需要一些关于我正在编写的 MATLAB 脚本的建议。

我从 Natural Earth 网站下载了一个包含所有国家的 shapefile:http: //www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/culture/ne_50m_admin_0_countries.zip

我首先阅读了 shapefile:

%% Load country borders shapefile
country_border_file =     'shapefiles\ne_50m_admin_0_countries\ne_50m_admin_0_countries.shp';
country_borders = shaperead(country_border_file,'UseGeoCoords',true);

然后使用 geoshow 函数绘制它:

ax = axesm('mercator');
geoshow(ax, [country_borders.Lat], [country_borders.Lon], 'Color', 'k');

一切都很好。现在,我想为德国和英国的土地区域涂上特定的颜色,以提高地图的可见性。我运行以下代码:

ax = axesm('mercator');
symspec = makesymbolspec('Polygon', ...
                     {'name', 'Germany', 'FaceColor', [0.15 0.5 0.15]}, ...
                     {'name', 'United Kingdom', 'FaceColor', [0.15 0.5 0.15]});
geoshow(ax,country_borders,'SymbolSpec', symspec)

我收到以下错误消息:

???使用 ==> 行时出错 发现无效属性。对象名称:行属性名称:'SymbolSpec'。

==> 24 小时地图线出错 = line(xdata(:), ydata(:), 'Color', [0 0 1], varargin{:});

22 小时 ==> geovec 中的错误 = fcn(x, y, varargin{:});

==> geovecshow 在 66 h = geovec(mstruct, lat, lon, ...

==> geoshow 在 273 小时出现错误 = showFcn(varargin{:});

一般来说,除了绘制线条之外,我无法做任何事情。Facecolor 和其他参数都不起作用,也不会给出类似的错误消息。

我的问题是:有没有办法解决这个问题(如果没有)是否有一个可免费获得的 shapefile(我已经测试了许多其他有类似问题的文件),它已经过测试可以与 MATLABv7 或更高版本一起使用(即特定国家/地区的颜色)绘画作品)?

提前谢谢大家,Ioannis

4

0 回答 0