Effacer les filtres
Effacer les filtres

problem with Geoplot reading table from NUTS shp file

5 vues (au cours des 30 derniers jours)
AlexG
AlexG le 8 Jan 2023
Commenté : AlexG le 16 Jan 2023
Hi,
trying to create a EU Choropleth map from NUTS.shp file.
It should display different colors in each region proportional to climatic data (stored in HDD_geoT.HDD )
Problem seems when geoplot is reading the shapes from HDD_geoT.Shape
my code:
EU_geoT = readgeotable('NUTS_RG_03M_2021_3035.shp');
% building HDD map on EU_geoT from common fields NUTS_ID and Region
HDD_geoT = outerjoin(EU_geoT, HDD_1721,"LeftKey","NUTS_ID","RightKey","Region");
HDD_geoT = rmmissing(HDD_geoT);
figure
%geoplot (with error!!)
geoplot(HDD_geoT, ColorVariable="HDD");
getting error (same on R2022b online):
geoplot(HDD_geoT, ColorVariable="HDD");
Error using map.graphics.chart.primitive.Polygon
Value must be numeric.
Error in map.graphics.internal.geotableplot (line 49)
h = objectConstructor('Parent', parent, 'SourceTable', tbl, 'ShapeVariable', 'Shape', pvpairs{:});
Error in geoplot (line 68)
obj = map.graphics.internal.geotableplot(gx, args);
Please help!
Alex
***************
here the substructure of the polygon shapes
HDD_geoT.Shape(1)
ans =
mappolyshape with properties:
NumRegions: 1
NumHoles: 0
Geometry: "polygon"
CoordinateSystemType: "planar"
ProjectedCRS: [1×1 projcrs]
HDD_geoT.Shape(1,1).ProjectedCRS
ans =
projcrs with properties:
Name: "ETRS89-extended / LAEA Europe"
GeographicCRS: [1×1 geocrs]
ProjectionMethod: "Lambert Azimuthal Equal Area"
LengthUnit: "meter"
ProjectionParameters: [1×1 map.crs.ProjectionParameters]

Réponse acceptée

Yuvraj Singh
Yuvraj Singh le 11 Jan 2023
Hi Alex,
I understand you are trying to use “ColorVariable” in “geoplot” to display different colours in each region proportional to climatic data but encounter an error.
ColorVariable” expects its input to be a numeric type. But I notice that the data Type of column “HDD” is 1x1 cell double, it is not numeric.
I hope this helps you.
-Yuvraj
  1 commentaire
AlexG
AlexG le 16 Jan 2023
Thank you, I solved the problem by using cell2mat().

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Geographic Plots dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by