OrdnanceSurvey / OS-Open-Zoomstack-Stylesheets

Cartographic Stylesheets for OS Open Zoomstack
Other
46 stars 44 forks source link

"Unimplemented type: 3" error when trying to use in maplibre-js #9

Closed BezBIS closed 1 year ago

BezBIS commented 2 years ago

I'm trying to use the OS_VTS_3857_Open_Outdoor.json in maplibre-js, but get an Object { message: "Unimplemented type: 3", stack: "" } error in te console. The map itself loads correctly, but it prevents any layers on the map from rendering.

My map initialisation code is:

const customStyleJson = '/static/other/OS_VTS_3857_Open_Outdoor.json';

// Initialize the map object.
this.map = new maplibregl.Map({
    container: 'map',
    minZoom: 0,
    maxZoom: 18,
    style: customStyleJson,
    maxBounds: [
        [-10.76418, 49.528423],
        [1.9134116, 61.331151]
    ],
    transformRequest: url => {
        if (! /[?&]key=/.test(url)) url += '?key=' + this.osKey
        return {
            url: url + '&srs=3857'
        }
    }
});

Taken from the example on the OS API site.

tmnnrs commented 2 years ago

Hi @BezBIS. Just wanted to confirm which vector tileset you are hoping to display: OS Open Zoomstack or the OS Vector Tile API (as the referenced stylesheet relates to the latter - see https://github.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets).

Having implemented a MapLibre GL JS (v2.4.0) map instance myself (and having pan/zoomed around) - I can't seem to replicate the issue.

That said, the error you are seeing does seem slightly strange in this instance... as it generally fires when it sees something it doesn't expect when decoding tiles from protocol buffers.

Can you send us a sample of a particular tile that doesn't work? It would also be useful to know which browser you are using; along with your operating system (Windows/Mac).

BezBIS commented 2 years ago

Thank you for the quick response. Woops! I was hoping to use the Vector Tile API, I'll move the bug report over to there. I am not actually seing any tiles that don't work, they all seem to render correctly, just the error pops up in the console and it blocks any layers from rendering.

Browser / os is Firefox on Windows.

tmnnrs commented 2 years ago

Would you be able to share your full code and/or error log for us to take a look at?

Still slightly confused about the error for the OS Vector Tile API (see https://github.com/mapbox/tippecanoe/issues/582#issuecomment-394126100), i.e. if you had been self-hosting the OS Open Zoomstack MBTiles we could perhaps understand it.

Are you also able to clarify your sentence "I am not actually seeing any tiles that don't work, they all seem to render correctly, just the error pops up in the console and it blocks any layers from rendering" to help us determine exactly where the 'rendering' is going wrong?

BezBIS commented 1 year ago

Hello there, sorry about the delay in responding to this. This is very unhelpful, but I can't share my code as I've switched over to using a different source (bing) for the os tiles. I can try to knock something together next week to look at.

The rendering issue I was experiencing was when trying to place points on the map from a GeoJson source. Other sources of vector tiles work correctly, but when trying to use VectorTile API none of the points loaded from the geojson file would render. The vector tiles render correctly, but nothing else.

Essentially, when using the VectorTiles API I get a blank map with no points or polygons. This does not happen with indentical code, but another vector tile source.

OInce again, sorry this is so unhelpful. I'll try and whip up a minimal exmaple next week to reproduce the error.

BezBIS commented 1 year ago

I've put together a minimal exmaple and the error is no longer occuring. It must have been some weird edge-case in my code - there was a lot of other js being loaded onto that page, and I wouldn't be suprised if webpack accidentally removed something it shouldn't have.

I'll close this for now, and reopen if I ever stumble across the same bug again.

Thanks again for all the help.