Skip to content

Commit

Permalink
fix: apply label config from spreadsheet
Browse files Browse the repository at this point in the history
Fixes #649
  • Loading branch information
stdavis committed Mar 9, 2024
1 parent 5d012ec commit 069565d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ In order for a dataset to be used as a query layer within the application, it mu

### Field Aliases

These are managed via the "Data" tab of the AGOL item. Any changes should immediately be reflected in the application. As a backup, the config spreadsheet supports defining aliases for fields with the following syntax: `FieldName (Field Alias)`. If an alias is defined in the config spreadsheet, it will take precedence over the AGOL alias.
These are managed via the "Data" tab of the AGOL item. Any changes should immediately be reflected in the application. The config spreadsheet also supports defining aliases for fields with the following syntax: `FieldName (Field Alias)`. If an alias is defined in the config spreadsheet, it will take precedence over the AGOL alias.

### Symbology

This is managed via the "Visualization" tab of the AGOL item. Any changes should immediately be reflected in the application. If there is no specific symbology defined, the app has some reasonable defaults that look better than the AGOL defaults.

### Map Labels

These are also managed via the "Visualization" tab of the AGOL item. Any changes should immediately be reflected in the application.
These are also managed via the "Visualization" tab of the AGOL item. Any changes should immediately be reflected in the application. The config spreadsheet also supports defining a map label field via the "Map Label Field" column. If a map label field is defined in the config spreadsheet, it will take precedence over the AGOL label field.

### Links (Identify Panel)

Expand Down
1 change: 1 addition & 0 deletions src/app-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ export default {
'https://services1.arcgis.com/99lidPhWCzftIe9K/arcgis/rest/services/UtahStreamsNHD/FeatureServer/0',
},
maxSearchCount: 30_000,
minLabelScale: 250_000,
};
19 changes: 19 additions & 0 deletions src/components/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,25 @@ export default function MapComponent() {
});
}

if (layer[fieldNames.queryLayers.mapLabelField]) {
featureLayer.labelingInfo = [
{
labelExpressionInfo: {
expression: `$feature.${layer[fieldNames.queryLayers.mapLabelField]}`,
},
symbol: {
type: 'text',
// @ts-ignore
color: 'black',
// @ts-ignore
haloColor: 'white',
haloSize: 1,
},
minScale: appConfig.minLabelScale,
},
];
}

const where = getWhere(
filter.attribute,
layer,
Expand Down
4 changes: 2 additions & 2 deletions src/remote_config_defaults.json

Large diffs are not rendered by default.

0 comments on commit 069565d

Please sign in to comment.