Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/geolibre-desktop/src/components/layout/DesktopShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
reattachSun,
reattachRouteAnimation,
reattachFlightSimulator,
restoreArcGISViewportLayers,
restoreRasterLayers,
restoreThreeDTilesLayers,
restoreVectorLayers,
Expand Down Expand Up @@ -1150,6 +1151,9 @@
restoreRasterLayers(appAPI);
restorePlanetaryComputerLayers(appAPI);
restoreVectorLayers(appAPI);
// Re-bind saved ArcGIS feature layers to the viewport. Without this a
// reopened project's layer stays frozen on the extent it was saved with.
restoreArcGISViewportLayers(appAPI);
// Re-stream saved LiDAR (COPC) point clouds. A `lidar-url` layer restores
// into the store as inert metadata; the point cloud is loaded by the LiDAR
// control, not the store, so without this the layer shows in the panel but
Expand Down Expand Up @@ -1703,7 +1707,7 @@
disposed = true;
unlisten?.();
};
}, [

Check warning on line 1710 in apps/geolibre-desktop/src/components/layout/DesktopShell.tsx

View workflow job for this annotation

GitHub Actions / Build and test

React Hook useEffect has a missing dependency: 't'. Either include it or remove the dependency array
clearDropMessageLater,
finishDrop,
addDroppedRasters,
Expand Down Expand Up @@ -1851,7 +1855,7 @@
clearDropMessageLater();
}
},
[

Check warning on line 1858 in apps/geolibre-desktop/src/components/layout/DesktopShell.tsx

View workflow job for this annotation

GitHub Actions / Build and test

React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array
clearDropMessageLater,
finishDrop,
addDroppedRasters,
Expand Down
25 changes: 22 additions & 3 deletions apps/geolibre-desktop/src/lib/layer-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,11 @@ function isWfsLayer(layer: GeoLibreLayer): boolean {
* that case derives the endpoint from the stored URL, which is the same
* `/query` path with the unbounded parameters that get replaced anyway.
*
* A layer that is loading by viewport is the exception: it only ever holds the
* current extent, so replaying the unbounded download here would swap the whole
* service in behind the user's back until the next `moveend` — the very cost
* viewport loading avoids. Those refresh by re-running the bounded query.
*
* @param layer - The ArcGIS feature layer to reload.
* @returns The reloaded features and their count.
*/
Expand All @@ -568,15 +573,29 @@ async function refreshArcGISLayer(layer: GeoLibreLayer): Promise<GeoJsonRefreshR
maxFeatures?: unknown;
pageSize?: unknown;
};
// Imported here rather than at module scope so this module stays light for
// the callers that only read refresh metadata.
const { refreshArcGISFeatureLayer, reloadArcGISViewportLayer } =
await import("@geolibre/plugins");
if (layer.metadata.viewportLoading === true) {
const viewport = reloadArcGISViewportLayer(layer.id);
// No live loader yet: a just-reopened project is still resolving the
// service metadata its loader needs, or that resolve failed. Falling
// through to the unbounded replay below would download the entire service
// — the cost this layer is loaded by viewport to avoid — so say so instead.
if (!viewport) {
throw new Error("This layer is still binding to the map viewport. Try again in a moment.");
}
const bounded = await viewport;
return { geojson: bounded, featureCount: bounded.features.length };
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
giswqs marked this conversation as resolved.

const stored = typeof source.arcgisQueryUrl === "string" ? source.arcgisQueryUrl.trim() : "";
// Fall back to the layer's own URL, stripped of its query string: it is the
// `/query` endpoint the paged fetch wants, just with the parameters attached.
const queryUrl = stored || (layerHttpUrl(layer) ?? "").split("?")[0];
if (!queryUrl) throw new Error("This layer does not have a refreshable GeoJSON URL.");

// Imported here rather than at module scope so this module stays light for
// the callers that only read refresh metadata.
const { refreshArcGISFeatureLayer } = await import("@geolibre/plugins");
const data = await refreshArcGISFeatureLayer({
maxFeatures: typeof source.maxFeatures === "number" ? source.maxFeatures : undefined,
pageSize: typeof source.pageSize === "number" ? source.pageSize : undefined,
Expand Down
2 changes: 2 additions & 0 deletions packages/plugins/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export {
ARCGIS_MAP_SERVICE_SOURCE_KIND,
parseArcGISLayerType,
refreshArcGISFeatureLayer,
reloadArcGISViewportLayer,
restoreArcGISViewportLayers,
type ArcGISLayerOptions,
type ArcGISLayerType,
type ArcGISSourceType,
Expand Down
Loading
Loading