Construct vector layer symbolization specification
symbolspec = makesymbolspec(geometry,rule1,rule2,...ruleN)
symbolspec = makesymbolspec(geometry,rule1,rule2,...ruleN)
constructs
a symbol specification structure (symbolspec
) for
symbolizing a (vector) shape layer in the Map Viewer or when using mapshow
. geometry
is
one of 'Point'
, 'Line'
, 'PolyLine'
, 'Polygon'
,
or 'Patch'
. Rules, defined in detail below, specify
the graphics properties for each feature of the layer. A rule can
be a default rule that is applied to all features in the layer or
it may limit the symbolization to only those features that have a
particular value for a specified attribute. Features that do not match
any rules are displayed using the default graphics properties.
To create a rule that applies to all features, a default rule, use the following syntax:
{'Default',Property1,Value1,Property2,Value2,... PropertyN,ValueN}
To create a rule that applies only to features that have a particular value or range of values for a specified attribute, use the following syntax:
{AttributeName,AttributeValue, Property1,Value1,Property2,Value2,...,PropertyN,ValueN}
AttributeValue
and ValueN
can
each be a two-element vector, [low high]
, specifying
a range. If AttributeValue
is a range, ValueN
might
or might not be a range.
The following is a list of allowable values for PropertyN
.
Points or Multipoints: 'Marker'
, 'Color'
, 'MarkerEdgeColor'
,
'MarkerFaceColor'
, 'MarkerSize'
,
and 'Visible'
Lines or Polylines: 'Color'
, 'LineStyle'
,
'LineWidth'
, and 'Visible'
Polygons: 'FaceColor'
, 'FaceAlpha'
, 'LineStyle'
, 'LineWidth'
, 'EdgeColor'
, 'EdgeAlpha'
,
and 'Visible'
The following examples import a shapefile containing road data and symbolize it in several ways using symbol specifications.
roads = shaperead('concord_roads.shp'); blueRoads = makesymbolspec('Line',{'Default','Color',[0 0 1]}); mapshow(roads,'SymbolSpec',blueRoads);
roads = shaperead('concord_roads.shp'); roadColors = ... makesymbolspec('Line',{'CLASS',2,'Color','r'},... {'CLASS',3,'Color','g'},... {'CLASS',6,'Color','b'},... {'Default','Color','k'}); mapshow(roads,'SymbolSpec',roadColors);
roads = shaperead('concord_roads.shp'); lineStyle = makesymbolspec('Line',... {'CLASS',[1 3], 'LineStyle',':'},... {'CLASS',[4 6],'LineStyle','-.'}); mapshow(roads,'SymbolSpec',lineStyle);
roads = shaperead('concord_roads.shp'); colorRange = makesymbolspec('Line',... {'CLASS',[1 6],'Color',summer(10)}); mapshow(roads,'SymbolSpec',colorRange);