add ability to convert a directory of tile files with XYZ structure#233
add ability to convert a directory of tile files with XYZ structure#233jamesscottbrown wants to merge 1 commit intoprotomaps:mainfrom
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.
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) |
| 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.
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.
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