3

I downloaded a mbtiles file from this location: https://openmaptiles.com/downloads/europe/netherlands/

I can serve this file in PHP with this library : https://github.com/klokantech/tileserver-php

This returns a compressed PBF, which Mapbox GL JS can use, but I'm not able in PHP to decode this data to get information out of it.

Has anybody ever extracted data from PBF using PHP ?

1
  • I can only give you a suggestion: there's a JavaScript library available for reading and writing this format. Have a look here: github.com/mapbox/pbf
    – Dobedani
    Commented Apr 2, 2020 at 16:28

1 Answer 1

1

I know that this thread is a little bit old right now, but I will answer this anyway in case someone bumps into this issue.

You can use package named osm-pbf, for reading PBF files using PHP. As far as I know, it is currently the only option if you want to use PHP.

Link to package: https://github.com/franksierra/osm-pbf

Installation is fairly easy, you can just use composer.

The library itself is pretty slow, it takes around 8 minutes to read 300MB PBF file, but for smaller files it works like a charm.

1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Commented Jan 12, 2022 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.