Dealing with thematic maps, how to read a shapefile and giving him an additional data array
4 views (last 30 days)
Show older comments
Alessandro
on 25 Aug 2014
Commented: Rolando Gonzales Martinez
on 12 Feb 2021
Hello to everybody, i'm trying to learn how to build rapidly a thematic map of several parameters that i have to represent but, following the guidelines (<http://www.mathworks.it/it/help/map/thematic-maps-1.html>) i could not get totally the point. This is the matter: i have to represent with a thematic map the variation of the Production Price of the Wheat across the world in 2011. First of all i have loaded a shapefile of the world (that is TM_WORLD_BORDERS-0.3.shp). It has all the informations to create a map of the world and to recognize the boundaries of the nations.
world=shaperead('TM_WORLD_BORDERS-0.3.shp')
By reading the suggestions in the tutorial it has been easy to make a thematic map according to one of the parameters that is already inside the shapefile (the shp has already inside NAME AREA POP2005 REGION SUBREGION LON LAT) by using
maxdensity = max([world.POP2005]);
fall = flipud(autumn(numel(world)));
densityColors = makesymbolspec('Polygon', {'POP2005',[0 maxdensity], 'FaceColor', fall});
geoshow(world, 'DisplayType', 'polygon','SymbolSpec', densityColors)
title ({'density population of nations in 2005'})
but i did not understand how to arrange a thematic map according to a column array coming from outside the shapefile . for example, the production price that i have just downloaded from FAOSTAT website.
thanks a lot
0 Comments
Accepted Answer
Kelly Kearney
on 25 Aug 2014
If you're comfortable with the geoshow/symbolspec combo, the easiest way to do this would be to add your additional data as new fields to the structure:
pth = '~/Documents/Research/Data/TM_WORLD_BORDERS-0.3/'; % change as appropriate
world = shaperead(fullfile(pth, 'TM_WORLD_BORDERS-0.3.shp'), 'usegeocoords', true);
mystat = num2cell(1:246);
ss = makesymbolspec('Polygon', {'mystat', [1 246], 'facecolor', jet(64)});
[world.mystat] = deal(mystat{:});
geoshow(world, 'DisplayType', 'polygon','SymbolSpec', ss);
6 Comments
Rolando Gonzales Martinez
on 12 Feb 2021
I was looking for this answer for hours. Thanks from 2021, Kelly!
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!