Clear Filters
Clear Filters

Geoshow colormapping error with makesymbolspec

3 views (last 30 days)
Mini Me
Mini Me on 9 Feb 2021
Edited: Mini Me on 10 Feb 2021
Hello,
I have a polygon that I built. I want to use colormap to color scale it based on a value on the map. My data consists of Latitude, Longitude and PFD. My goal is to build the polygon with my lat and lon. Then colormap ith with the PFD values. My pfd values range from -160 to -151. I want to color the variation of the pfd inside the polygon. I also want to use a color bar with ticks. So far I am getting an error that I dont quite comprehend and frankly not sure how I can by pass it.
This is my code so far:
filepath = 'C:\path'
Poly_data = xlsread(filepath);
Poly_lat = Poly_data(:,1);
Poly_lon = Poly_data(:,2);
Pfd_value = Poly_data(:,3);
myfig = figure;
hold on
load coastlines
axesm('MapProjection','mercator','MapLatLimit',[-75 75],'MapLonLimit',[-180, 180])
axis off;
gridm on;
framem on;
mlabel('equator')
plabel(0);
plabel('fontweight','bold')
plotm(coastlat,coastlon)
figtitle=['Location: ','Coordination Zone'];
set(myfig,'name',figtitle);
colormap(autumn(512))
Symbols = makesymbolspec('Polygon', ...
{'Pfd',[min(Pfd_value) max(Pfd_value)],'FaceColor',colormap});
k = boundary (Poly_lat, Poly_lon);
finalplot = geoshape(Poly_lat(k),Poly_lon(k));
geoshow(finalplot,'SymbolSpec',Symbols)
colorbar
caxis([min(Pfd_value) max(Pfd_value)])
set (get(colorbar,'YLable'),'String','PFD')
I keep getting this error below. Please help
Error using attributes2properties>checkGeometryStringMatch (line 170)
Geometry value Line is inconsistent with SymbolSpec geometry Polygon.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!