Skip to content

Conversation

@stefanocudini
Copy link
Member

@stefanocudini stefanocudini commented Dec 18, 2025

Fix issue #11749 introducing the FlatGeobuf format support as new layer loaded from remote resource.

Flatgeobuf library version supported is last 4.3.3

added a new .fgb files and metadata sample for CI tests here:
https://github.com/stefanocudini/MapStore2/tree/fix-11749-flatgeobuf/web/client/test-resources/flatgeobuf
and a new public map here: http://localhost:8081/#/viewer/62619

Description

  • new FlatGeobuf API catalog and connect in metadataexplorer
  • load dynamically flatgeobuf library dep
  • some unit tests flatgebouf api and catalog api
  • define FlatGeobuf OL Layer
  • define FlatGeobuf Cesium Layer (3D mode)
  • enable Mapinfo identify for flatgeobuf layers
  • update docs about FlatGeobu specs
  • use loader with strategy using default bbox OL
  • style editor enabled flatgeobuf layer type

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the new behavior?
Support loading FlatGeobuf (remote .fgb files) from catalog

flatgeobuf.mp4

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

  • In this PR the visual style editor is not working due to the lack of specific rules for this format
  • to optimize metadata retrieve we need to replace .deserialize() with new method .readMetadata() when available in flatgeobuf lib > v4.4.5
    just merged here:
    flatgeobuf/flatgeobuf@15f137c

@stefanocudini stefanocudini added this to the 2025.02.01 milestone Dec 18, 2025
@stefanocudini stefanocudini self-assigned this Dec 18, 2025
@stefanocudini stefanocudini added the New Feature used for new functionalities label Dec 18, 2025
@stefanocudini stefanocudini linked an issue Dec 18, 2025 that may be closed by this pull request
5 tasks
@stefanocudini stefanocudini changed the title load flatgeobuf catalog FlatGeobuf format support Dec 18, 2025
api catalog in metadataexplorer

load dynamic fgb module

unit tests flatgebouf api

FlatGeobuf OL Loader
FlatGeobuf Cesium Loader

upgrade flatgeobuf 4.3.3

enable Mapinfo identify flatgeobuf layers

update docs

fix strategy

style editor enabled flatgeobuf layer type

fix lints
@tdipisa tdipisa modified the milestones: 2025.02.01, 2026.01.00 Jan 5, 2026
@tdipisa tdipisa requested a review from allyoucanmap January 5, 2026 10:50
@stefanocudini stefanocudini force-pushed the fix-11749-flatgeobuf branch 2 times, most recently from db1b800 to 23b4b41 Compare January 7, 2026 11:35
@stefanocudini
Copy link
Member Author

@allyoucanmap last commit upgrade flatgeobuf to v4.4.0 and replacement with new optimized readMetadata() method

// copy and paste in catalog for testing: https://flatgeobuf.org/test/data/countries.fgb
//
export const getCapabilities = (url) => {
return getFlatGeobufGeneric().then(async flatgeobuf => { // load lib dynamically
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, we avoid using async await in mapstore project. So, I would suggest converting it to promise chaining.
cc: @allyoucanmap

const parts = serviceUrl.split(/\./g);
// remove query params
const ext = (parts[parts.length - 1] || '').split(/\?/g)[0];
return ext === FGB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to only use:

return ext === FGB

};

export const preprocess = commonPreprocess;
// export const validate = (service) => Observable.of(service);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented? I would suggest to remove it if not necessary.


const createLayer = (options, map) => {

// console.log('createLayer FlatGeobuf Cesium', options, map);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to remove the console.log. Check for other console.logs too.


const geojson = new GeoJSON().writeFeatures(featuresVect);

// console.log('getFeatures', geojson, featuresVect);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to remove the console.logs.

@subashtiwari1010
Copy link
Contributor

@stefanocudini Here are some bugs:

  • The flatGeoBuff does not render after you reload
    • Create a new map
    • Add a flatGeoBuff layer
    • Save the map with the layer
    • Reload the map
    • The flatGeoBuff is not rendered (sometimes it takes too long to render, more than 1-2 minutes)
    • Check the video for details:
test-flatGeoBuff-1.mp4
  • In the description, it is mentioned In this PR the visual style editor is not working due to the lack of specific rules for this format
    The flatGeoBuff does not render when you go to the style editor even though no changes have been made.
    • Click the flatGeoBuff layer
    • Click Selected layer settings
    • Go to the Style tab
    • The flatGeoBuff immediately disappears even though no changes have been made (maybe we need to hide the Style tab for FlatGeoBuff layers)
    • Check the video for details
test_flatgeobuff_2.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Feature used for new functionalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for FlatGeobuf by MapStore

4 participants