-
Notifications
You must be signed in to change notification settings - Fork 50
partial reimplementation of MvtWriter to support feature writing and outputting layers #264
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
Conversation
layer writing to MvtWriter
|
@urschrei the checks fail on something unrelated to the PR. when I run |
|
It's kind of annoying when new clippy lints break builds, but I guess it's a forcing function to improve (usually they're improvements anyway 😆) the codebase. If you want to speed things along, you can fix the clippy lints in a separate PR. |
|
I made #265 to fix latest clippy |
|
Could someone review this PR when possible, so that we can move forward? Appreciate the help. |
geozero/src/mvt/mvt_writer.rs
Outdated
| tags_builder: TagsBuilder, | ||
| } | ||
|
|
||
| impl Default for MvtWriter { |
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 it make sense to implement Default here? The arguments to new (extent: u32, left: f64, bottom: f64, right: f64, top: f64) don't to me seem to have a natural default.
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 default call creates an "unscaled" MvtWriter, where the geometry is assumed to be in tile coordinates and accepted as is. The new call has arguments to scale geometries. Maybe we could rename this or clarify that the Default is an unscaled writer.
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 still think this would be clearer to not be implemented as Default. Default should be painfully obvious what it does, and I don't think this meets that bar.
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.
Just adding new_unscaled as a new constructor isn't enough in my opinion because the Default impl is still public
|
Current questions
Thank you for your time and your reviews. |
frewsxcv
left a comment
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 have any other blocking comments here, but it'd be great to get sign off from @michaelkirk and @kylebarron as well
I think there should at least be an option to do so. It's probably the most straightforward way of encoding Binary properties, right?
I think it would be clearer if it were a separate constructor with an associated docstring. To me,
I think having a runnable and doctested example would be ideal here. It can be small |
comments clarifying MvtWriter
|
I just added base64 encoding for ColumnValue and MvtWriter docstrings. Feel free to take a look. I'll add the runnable, doctested example when I find the time. Thanks |
|
I've added the doc-tested example as well. Ready for (hopefully!) final review. |
nyurik
left a comment
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.
why are we removing integration tests here? Are they fundamentally wrong now? Also, made a few minor comments. Thank you for working on this!
|
I added the integration tests back in. Should be good to go. |
|
There seems to be only one blocker for this PR (link to comment):
What can I do to remove this blocker? |
geozero/src/mvt/mvt_writer.rs
Outdated
| /// The resulting writer expects all geometries to be provided in tile coordinate space, | ||
| /// matching the specified `extent`. | ||
| pub fn new_unscaled(extent: u32) -> MvtWriter { | ||
| assert_ne!(extent, 0); |
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 think we should panic here. Either we should allow this function to return a Result, or we should make the parameter NonZeroU32
My opinion there would be that we should remove the |
|
I removed the default impl and changed constructors so that they return Results. I also updated the changelog with the breaking changes. |
|
looks good, thanks! |
CHANGES.mdorCHANGELOG.mdThis is an implementation of feature writing for MVTs, as discussed in #263. This PR builds upon @nyurik's previous WIP reimplementation #181. It passes all of the
mvt_writertests. I am not sure if I understood the API exactly correctly but this seems to be a pretty good starting point, as individual feature/geom can be converted to a MVT feature with theToMvttrait as well asMvtWritercan process multiple feature and output them to a layer.Here is an example of feature writing and layer output with MvtWriter (from GeoJSON to MVT tiles PR, maplibre/martin#2098)
Let me know how we can move forward with this PR.