Giter Club home page Giter Club logo

Comments (9)

woodpeck avatar woodpeck commented on September 26, 2024

A typical mbtiles creation call would look like this (all on one line):

meta2tile  --mbtiles 
   --meta name='Paris' 
   --meta type=raster 
   --meta format=png 
   --meta version=1.0 
   --meta bounds='2.0,48.5,2.8,49.1' 
   --meta description='OpenStreetMap tiles for Paris, France' 
   /var/lib/mod_tile/default
   /media/test/tissd/mbtiles/wz12.mbtiles

The --meta thingies do not influence meta2tile's behaviour, but some mbtiles consumers will insist on this information being present. Changing anything in the source code should not be necessary (you'd usually do a -DWITH_MBTILES on the compiler comamnd line).

from meta2tile.

woodpeck avatar woodpeck commented on September 26, 2024

Apparently some applications use a flipped Y axis with mbtiles files. Mapbox's mb-util package will by default create the same style of mbtiles file as meta2tile, but supports a --scheme command line option that lets you request a "tms" scheme which has a flipped axis (see https://github.com/mapbox/mbutil). A pull request to add such a command line option to meta2tile would be viewed favourably. If you're looking for quick hack, modify

sqlite3_bind_int(t->sqlite_tile_insert, 2, ty);
and add a logic like https://github.com/mapbox/mbutil/blob/2fc4161f9be890a65d07f5e7b2ed0c8a0a123ed6/mbutil/util.py#L16-L17.

from meta2tile.

bongobongo avatar bongobongo commented on September 26, 2024

When I use meta2tile to make lots of stand alone tiles from the meta tiles, like this:
./meta2tile /var/lib/mod_tile/default /media/test/tissd/mbtiles/

all those subdirs and tiles are corrext (z,x,y).
.../mbtiles/12 (zoom)
.../mbtiles/12 / 0 to .../mbtiles/12/4095
and each file below those dirs consist of tiles numbered from 158 to 2847
which correspond with the coordinates given to render_list when creating the meta tiles.

If it is a flipped Y axis problem when creating mbtile files, why is not same problem happening when creating lots of single tiles from the meta tiles - using meta2tile (works flawlessly)?
The meta tiles have been created using render_list after a "standard" import from planet pbf - where the recipy was found here:
https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-20-04-osm

I will look closer into the tiles in the generated mbtiles file - to see if the tiles have been flipped, and report back.

from meta2tile.

woodpeck avatar woodpeck commented on September 26, 2024

I cannot explain what you describe. The code determines the Y coordinate in

int ty = y + (meta % METATILE);
and then uses that coordinate when writing a file
sprintf(path, "%s/%d/%d/%d.%s", t->pathname, z, tx, ty, (file_is_jpeg || tojpeg) ? "jpg" : "png");
as well as when writing a mbtiles database
sqlite3_bind_int(t->sqlite_tile_insert, 2, ty);
- I do not see any code to flip the Y axis. Are you sure that the code you have compiled is the current version from this repository? If all else fails, generate individual tiles and use the mbutil program to make an mbtiles file from them.

from meta2tile.

bongobongo avatar bongobongo commented on September 26, 2024

Hi again. Looked more closely into the generated mbtile file that was generated by the meta2tile file where I changed two lines.
Looks like you are correct about the y axis flipping.
tile_column = 2164
tile_row = 2886, but should have been 1209
control (all this is zoom level 12):
4095 - 1209 = 2886.

When I downloaded the files that I used from this repository, I just went here:
https://github.com/geofabrik/meta2tile

then I clicked on the file meta2tile.c,
then clicked on the RAW button, and then right-clicked and saved the file.
Then repeated the same with the header files.
Probably not a normal way to do it, but should that not be okay to do?
I did the downloads yesterday.

UPDATE: Just checked both the original meta2tile.c and the one I changed - both have the code intact regarding the ty variable.
I'll try the mbutil program, like you suggested.

Thanks a lot for the quick replies.

from meta2tile.

bongobongo avatar bongobongo commented on September 26, 2024

Okay, thouth I should give it a try by using
git clone https://github.com/geofabrik/meta2tile.git

then when I run make I got fatal error: zip.h: No such file or directory
So I removed -DWITH_ZIP and -lzip (not needed by me anyway).

then make again and it gets compiled.
Then I do this:
./meta2tile --mbtiles /var/lib/mod_tile/default /media/test/tissd/mbtiles/planet-z12.db

and the mbtile is generated.
BUT - I get the exact same problem as earlier - with the flipped y axis in the mbutil file.
So now I will try using mbutil to make a mbtile file from the many single.

from meta2tile.

bongobongo avatar bongobongo commented on September 26, 2024

Using mbutil (with --scheme=tms ) on the stand alone tiles generated by meta2tile fixed the flipped y issue. Thanks a lot for that quick fix suggestion. Next now will be to create a pull request so hopefully we can get the tms option in meta2tile. I will enter that request tomorrow.

from meta2tile.

bongobongo avatar bongobongo commented on September 26, 2024

Apparently some applications use a flipped Y axis with mbtiles files. Mapbox's mb-util package will by default create the same style of mbtiles file as meta2tile, but supports a --scheme command line option that lets you request a "tms" scheme which has a flipped axis (see https://github.com/mapbox/mbutil). A pull request to add such a command line option to meta2tile would be viewed favourably. If you're looking for quick hack, modify

sqlite3_bind_int(t->sqlite_tile_insert, 2, ty);

and add a logic like https://github.com/mapbox/mbutil/blob/2fc4161f9be890a65d07f5e7b2ed0c8a0a123ed6/mbutil/util.py#L16-L17.

When I go to "Pull requests" I see this message:
"If you know how to fix an issue, consider opening a pull request for it."
Well, I do not know how to fix the issue in question (in meta2tile), and when I click the button "New pull request" I do not get to a place where I can enter a pull request. So I cannot create the pull request you mentioned.
So, perhaps you could create the pull request and add a command line option to meta2tile: --scheme, and if set to tms will make flipped y axis.

from meta2tile.

woodpeck avatar woodpeck commented on September 26, 2024

The "pull request" is for if you have solved the issue. If you cannot solve the issue and just want someone else to solve it, then things are ok as they are, we'll just leave this issue open until someone has the time to fix it.

from meta2tile.

Related Issues (6)

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.