Skip to content

Commit

Permalink
fix: move basemap reference layers to base layers array
Browse files Browse the repository at this point in the history
This will prevent them from overlapping the milepost features.
  • Loading branch information
JeffJacobson committed Jan 16, 2025
1 parent 868de3a commit 1fb3ec0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ function createClickPointSymbolLayer() {
},
});

console.debug("clickPointSymbol", clickPointSymbol.toJSON());

const clickPointCimSymbol = convertToCIMSymbol(clickPointSymbol);
console.debug("cimClickPointSymbol", clickPointCimSymbol.toJSON());

const clickPointSymbolLayer =
clickPointCimSymbol.data.symbol?.symbolLayers?.filter(isCimVectorMarker)[0];
Expand Down
5 changes: 0 additions & 5 deletions src/layers/MilepostLayer/symbol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,3 @@ export const endpointMilepostSymbol = new CIMSymbol({
symbol: endpointCimPointSymbol,
},
});

/* __PURE__ */ console.debug(
"endMilepostSymbol",
endpointMilepostSymbol.toJSON(),
);
6 changes: 5 additions & 1 deletion src/layers/parcels/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { parcelsLayer as waTechParcelsLayer } from "./watech";

/**
* Creates a group layer for parcels.
* @returns A promise that resolves to the created group layer.
* The group layer lets the user to choose between the WA Tech Parcels layer
* and its fallback, the Regrid Parcels layer.
* @returns A group layer containing the WA Tech and Regrid Parcels layers
*/
export function createParcelsGroupLayer(): GroupLayer {
const groupLayer = new GroupLayer({
Expand All @@ -14,6 +16,8 @@ export function createParcelsGroupLayer(): GroupLayer {
});
waTechParcelsLayer.visible = true;

// Setup up an error handler for the frequently-failing WA Tech Parcels layer.
// Once the error has been logged to the console, remove the error handler.
const waTechErrorHandler = waTechParcelsLayer.on(
"layerview-create-error",
(event) => {
Expand Down
15 changes: 15 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,21 @@ if (!testWebGL2Support()) {
}),
});

/**
* Removes all reference layers from the given basemap and adds them to its
* base layers.
* @param basemap The basemap whose reference layers should be moved.
*/
const moveReferenceLayersToBaseLayers = (basemap: Basemap) => {
const refLayers = basemap.referenceLayers.removeAll();
basemap.baseLayers.addMany(refLayers);
};

// Move each basemap's reference layers to its base layers once they are loaded.
for (const bm of [imageryHybridBasemap, grayBasemap]) {
bm.when(moveReferenceLayersToBaseLayers);
}

const map = new EsriMap({
basemap: grayBasemap,
layers: [
Expand Down
1 change: 0 additions & 1 deletion src/milepost-info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export async function getRouteList() {
]);
const url = new URL(`?${search.toString()}`, milepostsUrl);
const response = await fetch(url);
console.debug(response);
results = ((await response.json()) as FeatureSet).features.map(
(feature) => feature.attributes,
);
Expand Down

0 comments on commit 1fb3ec0

Please sign in to comment.