"JSON metadata file is not valid" when serving mbtiles with tileserver.php
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.1k
- Forks
- 430
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to serve mbtiles generated with tippecanoe using tileserver-php. The server crashes with a JavaScript alert:
"JSON metadata file is not valid."
I traced it down to the /tilserver/index.json request which returns a JSON file that JavaScript thinks is not proper JSON.
The problem occurs in the generator_options, which looks like this for me:
"generator_options": "tippecanoe --force -o output.mbtiles '--maximum-zoom=16' --drop-densest-as-needed -rg input.geojson",
Removing the single quotes around --maximum-zoom=16 generator_options fixes the issue.
This seems like a duplicate of #459, but there the problem was the json field.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the /tilserver/index.json response with an MBTiles file generated by tippecanoe using the shown generator_options. Inspect how generator_options is serialized into the JSON metadata and verify that the resulting response parses as valid JSON without unwanted single quotes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100