Giter VIP home page Giter VIP logo

Comments (5)

brendan-ward avatar brendan-ward commented on May 25, 2024 1

@sikmir why are you exporting from tippecanoe to a directory? That might be part of the problem here. You can export directly to mbtiles:

$tippecanoe -o test.mbtiles -zg --drop-densest-as-needed ./src/*.geojson

You will need to delete test.mbtiles or add the -f option (force: delete if exists and create mbtiles file)

Watch for any errors from tippecanoe, usually it is pretty good at alerting you if there was an error creating tiles.

In your above case, your issue is most likely the *.geojson expression - you need to reference a specific file rather than a wildcard.

If you have multiple geojson files you are trying to encode into mbtiles at once, you need to do it in a couple steps:

  1. create an mbtiles file for each geojson file, using the -l option to name the layer in the output
  2. use tile-join (part of tippecanoe) to merge the mbtiles files together into a single mbtiles file; each layer in this will have the layer name you specify in the first step.

Example (untested commands):

$ tippecanoe -o a.mbtiles -l "A" ./src/a.geojson
$ tippecanoe -o b.mbtiles -l "B" ./src/b.geojson
$ tile-join -o test.mbtiles a.mbtiles b.mbtiles

from mbtileserver.

sikmir avatar sikmir commented on May 25, 2024

Steps to reproduce

$ docker-compose up -d
$ cp ~/broken/test.mbtiles ./mbtiles/testdata/
$ docker exec -it mbtileserver sh -c "kill -HUP 1"
$ docker-compose logs mbtileserver
...
mbtileserver     | Reloading...
mbtileserver     | 
mbtileserver     | time="2019-11-04T08:05:06Z" level=info msg="Found 3 mbtiles files in ./tilesets"
mbtileserver     | time="2019-11-04T08:05:06Z" level=error msg="Unable to create service set: could not open mbtiles file \"tilesets/test.mbtiles\": sql: no rows in result set"
mbtileserver     | panic: runtime error: invalid memory address or nil pointer dereference
mbtileserver     | [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x891c1d]
mbtileserver     | 
mbtileserver     | goroutine 1 [running]:
mbtileserver     | github.com/consbio/mbtileserver/handlers.(*ServiceSet).Handler(0x0, 0xade120, 0x1, 0xc000337d18, 0x8)
mbtileserver     | 	/handlers/handlers.go:480 +0x45d
mbtileserver     | main.serve()
mbtileserver     | 	/main.go:244 +0x87c
mbtileserver     | main.glob..func1(0xf12740, 0xc000342660, 0x1, 0x2)
mbtileserver     | 	/main.go:43 +0x4c
mbtileserver     | github.com/spf13/cobra.(*Command).execute(0xf12740, 0xc000020190, 0x2, 0x2, 0xf12740, 0xc000020190)
mbtileserver     | 	/go/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2ae
mbtileserver     | github.com/spf13/cobra.(*Command).ExecuteC(0xf12740, 0x0, 0x0, 0xf4b4c0)
mbtileserver     | 	/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ec
mbtileserver     | github.com/spf13/cobra.(*Command).Execute(...)
mbtileserver     | 	/go/pkg/mod/github.com/spf13/[email protected]/command.go:800
mbtileserver     | main.main()
mbtileserver     | 	/main.go:145 +0x2e
mbtileserver     | EXITING (abnormal child exit: exit status 2)time="2019-11-04T08:05:13Z" level=info msg="Found 3 mbtiles files in ./tilesets"
mbtileserver     | time="2019-11-04T08:05:13Z" level=error msg="Unable to create service set: could not open mbtiles file \"tilesets/test.mbtiles\": sql: no rows in result set"
mbtileserver     | panic: runtime error: invalid memory address or nil pointer dereference
mbtileserver     | [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x891c1d]
...

The fix is pretty simple - just ignore the error bellow (that means ignoring broken .mbtiles):

err = s.AddDBOnPath(filename, id)
if err != nil {
return nil, err
}

@brendan-ward what do you think?

from mbtileserver.

brendan-ward avatar brendan-ward commented on May 25, 2024

Yes, I think skipping corrupt mbtiles files with a warning to the user would be reasonable.

Out of curiosity, what caused your mbtiles file to be corrupt in this case?

from mbtileserver.

sikmir avatar sikmir commented on May 25, 2024

Out of curiosity, what caused your mbtiles file to be corrupt in this case?

Well, I can make a PR.

Out of curiosity, what caused your mbtiles file to be corrupt in this case?

I don't know so far, I've just tried to use tippecanoe for the first time:

$ tippecanoe -e ./tiles -zg --drop-densest-as-needed ./src/*.geojson
$ mb-util ./tiles test.mbtiles

Maybe I'm doing something wrong or something wrong with my data.

from mbtileserver.

sikmir avatar sikmir commented on May 25, 2024

@brendan-ward Thank you for pointing out! I finally managed to get a proper result for my use case after tinkering around with tippecanoe a bit more. That's just a great tool!

from mbtileserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.