Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapbox Style with multiple sources not being rendered correctly #1927

Closed
cchandel opened this issue Oct 14, 2022 · 3 comments · Fixed by #2128
Closed

Mapbox Style with multiple sources not being rendered correctly #1927

cchandel opened this issue Oct 14, 2022 · 3 comments · Fixed by #2128
Assignees
Milestone

Comments

@cchandel
Copy link

Hi,
I'm trying to use a Mapbox vector style that is working fine for a 2D map using Openalyers + ol-maplibre-layer.
Using the same json file as style leads to only 1 layer being shown.

Your Environment

  • Version used: 2.38.2
  • Browser Name and version: chrome 106.0.5249.119
  • Operating System and version (desktop or mobile): Linux Desktop
  • Link to your project:

Context

The style json file has multiple sources as below :-

  "sources": {
    "physical": {
      "type": "vector",
      "tiles": [
        "http://localhost:8000/services/physical/tiles/{z}/{x}/{y}.pbf"
      ],
      "minZoom": 2,
      "maxZoom": 14
    },
    "land": {
      "type": "vector",
      "tiles": [
        "http://localhost:8000/services/land/tiles/{z}/{x}/{y}.pbf"
      ],
      "minZoom": 2,
      "maxZoom": 14
    }
  }
  "layers":[
    { 
      {
      "id": "marine",
      "type": "fill",
      "source": "physical",
      "source-layer": "marine",
     },
   },
   {
      "id": "land",
      "type": "fill",
      "source": "land",
      "source-layer": "land",
      "paint": {
        "fill-color": "#ccffff",
        "fill-antialias": true
      }
    },
 ]

Steps to Reproduce (for bugs)

  1. Use a mapbox style with multiple sources

Expected Behavior

All the layers referencing all the sources should be displayed.

Actual Behavior

Only the first layer referencing the first source is displayed

All the layers referencing all the sources should be displayed.

Possible Cause/Fix/Solution

@mgermerie mgermerie added this to the 2.xx.x milestone Oct 20, 2022
@mgermerie
Copy link
Contributor

Hi, and thanks for this feedback !

Indeed, iTowns VectorTileSource only considers the first source specified in Mapbox vector style. This is partly due to this piece of code.

The issue is that VectorTileSource has a single url property, therefore referencing a single source and not an array of sources for example. Implementing the support for Mapbox style with multiple sources would require some change on this, and also on fetching and parsing methods used for Mapbox data.

@PhilippeMarc-IGN and @LoicUTC, maybe we could add this feature to our next releases plannings ?

@a-dutremble
Copy link
Contributor

Hi ! I am currently working on this issue.

Can you send me an example of data that works ? If the data is private, you can send it to me by mail if you want at [email protected].

@ftoromanoff
Copy link
Contributor

@cchandel Hello, we just merged PR #2128 which should allow the use of multi source on VectorTileSource.
Can you test with your data on itowns@next ?

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

Successfully merging a pull request may close this issue.

4 participants