Gunho Kim
Gunho Kim

Reputation: 21

Unimplemented type 4 error when using pbf locally in openlayers

After downloading pbf from openstreetMap and keeping it locally, I want to load (in public) vector pbf and create a map that is generated offline.

So I currently worked in the following order

  1. i downloaded the vector tile package from openstreetMap, it has pbf files organized in z/x,y directory.

enter image description here

download link : https://download.geofabrik.de/asia/south-korea.html

  1. I imported the downloaded pbf using openlayers. Since I'm currently working on local, I also tried loading it from localhost:3000 and relative paths like ./open/. (When I imported a rasterized map as a png using an XYZ source, it worked fine.)
  const test1 = new VectorLayer({
      source: new VectorSource({
        format: new MVT(),
        url: './open/{z}/{x}/{y}.pbf',
      }),
    });


 map = new Map({
      target: root,
      view: new View({
        center: fromLonLat([OL_DEFAULT_CENTER.lng, OL_DEFAULT_CENTER.lat]),
        zoom: OL_DEFAULT_ZOOM,
        // maxZoom: OL_MAX_ZOOM,
      }),
      // layers: this.#getLayer(),
      layers: [test1],
      controls: defaults({ zoom: false, attribution: false, rotate: false }),
    });

return map
  1. an error occurs. I don't even have a clue what could be causing it.

    Unimplemented type: 4
    at Pbf.skip (http://localhost:3000/static/js/bundle.js:78734:239) at Pbf.readFields (http://localhost:3000/static/js/bundle.js:78579:39) at MVT.readFeatures (http://localhost:3000/static/js/bundle.js:280269:27) at xhr.onload (http://localhost:3000/static/js/bundle.js:279565:16)

Help me, please I am in desperate need of help.


We've made many attempts to solve this problem.

I've tried converting using MButil, and I've also tried using the

Is there a way to generate a .mbtiles file from .osm.pbf file

I've also tried the sequence on the page above.

But they all failed.

Upvotes: 2

Views: 536

Answers (0)

Related Questions