I'm trying to display labels for a polygon feature layer in my react leaflet map. I'm able to get the layer to come in and display correctly, but none of the labels are coming in. The field musym is displaying correctly when I call it from a popup but everything is blank with this labeling method. Just wondering if there is anything wrong with my code or if the L.canvas() renderer is messing up the labels?
const labelClass = {
// autocasts as new LabelClass()
symbol: {
type: 'text', // autocasts as new TextSymbol()
color: 'green',
haloColor: 'black',
font: {
// autocast as new Font()
family: 'playfair-display',
size: 12,
weight: 'bold',
},
},
labelPlacement: 'always-horizontal',
labelExpressionInfo: {
expression: '$feature.musym',
},
};
// Create the FeatureLayer with authentication using your API key and apply the label class
const SoilsLayer = new FeatureLayer({
apiKey: apiKey,
minZoom: 12, // Minimum zoom level of 12
renderer: L.canvas({ pane: 'middle' }),
labelingInfo: [labelClass],
lablelsVisible: true,
style: {
color: 'yellow', // Grey border
weight: 1, // Border width
fillColor: 'none', // No fill
fillOpacity: 0,
},
}).addTo(map);