-
-
Notifications
You must be signed in to change notification settings - Fork 66
add ability to convert a directory of tile files with XYZ structure #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fix for hard coded png
|
extension := strings.ToLower(filepath.Ext(info.Name()))[1:] | ||
|
||
// skip files with unsupported extensions | ||
if _, ok := fileTypes[extension]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should support .jpeg
extensions too?
if tileFormat == "" { | ||
tileFormat = extension | ||
} else if tileFormat != extension { | ||
return fmt.Errorf("mixed tile formats in directory: %s - enoountered both %s and %s", path, tileFormat, extension) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encountered
return fmt.Errorf("invalid tile row: %s", y) | ||
} | ||
|
||
_minLat, _minLon, _maxLat, _maxLon := TileToLatLonBounds(int(zInt), int(xInt), int(yInt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tile coordinates are not enough to determine the intended geographic bounds for a tileset - tile pyramids that contain the z=0 tile will have a bounds of the entire web mercator extent. We need to read user-supplied bounds from a metadata.json
or allow passing it on the command line.
header.MinLonE7 = minLon | ||
header.MaxLonE7 = maxLon | ||
|
||
header.CenterLatE7 = (minLat + maxLat) / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be read from the center
of a metadata.json
and use this midpoint as a fallback
Thanks for tackling this feature. Overall I think we need to depend on necessary metadata existing in a protomaps/PMTiles#338 (comment) I know Tippecanoe outputs a A integration test for creating an archive from a directory would be nice too |
This provides the ability to generate a PMTiles archive from a directory of tiles directly, wihtout having to first create a PMTiles archive.
See protomaps/PMTiles#519