-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: convert mbtiles to a styled map package file #35
Conversation
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.
LGTM other than a few nitpicks.
const style = await smp.getStyle('') | ||
const sourceMetadata = Object.values(style.sources)[0] | ||
assert.equal(sourceMetadata.type, 'raster') | ||
for (const { x, y, z, data } of mbtiles) { |
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 worth verifying that mbtiles
is nonempty?
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.
done in 6b75988
test/from-mbtiles.js
Outdated
* @param {Record<string, string | number>} variables - An object where the keys correspond to variable names and values correspond to the replacement values. | ||
* @returns {string} The string with the variables replaced by their corresponding values. | ||
*/ | ||
export function replaceVariables(template, variables) { |
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.
Does this need to be exported?
export function replaceVariables(template, variables) { | |
function replaceVariables(template, variables) { |
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.
done in 6b75988
const returnValue = outputPath | ||
? pipelinePromise(writer.outputStream, fs.createWriteStream(outputPath)) | ||
: writer.outputStream |
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.
I don't feel strongly about this, but it feels a little cleaner to have this always take an output stream rather than a path. The command could do this transformation.
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.
Agreed, however I don't think worth the effort at this stage (would also require updating tests and having a way to test the CLI)
Helpful for when only mbtiles are available as a data source.