Repository navigation
Close the remaining API gaps - #118
Merged
Merged
Conversation
TilelistBuilder - tileCount counts unique tiles instead of additions, so it agrees with tilelist (which de-duplicates). Vector rendering - renderSVG/renderPDF/renderPostScript take optional width/height so the page size is explicit instead of depending on the map's previous size. The map size is restored afterwards. ImageFormat - typeString is public, so the documented mapnik type mapping is observable (and testable without @testable import). Render prologue - New withRenderState(_:resize:zoomIfUnset:body:) captures the validate/resize/buffer/zoom/restore sequence. render() uses it, so the paths can no longer drift apart the way they did for scale, height and skipFullyTransparent. C shim - The cairo temp file honours TMPDIR via std::filesystem::temp_directory_path instead of hard-coding /tmp. - Removed the unused write_buffer_to_file helper and the unused AGG include. Packaging - Package.resolved is no longer committed: for a library it only pins the repo's own builds and hides incompatibilities with newer gis-tools releases. Tests - tileCount uniqueness, vector page size (and that the map size is restored), default vector size, and every ImageFormat type string. Fixes #15 Fixes #22 Fixes #23 Fixes #54 Fixes #88 Fixes #90 Fixes #96
Rebased onto main after #117 landed. Conflicts were resolved by keeping main's newer render pipeline (withRenderState, the cairo resize helper) and re-applying this PR's additions on top. TilelistBuilder - tileCount counts unique tiles instead of additions, so it agrees with tilelist (which de-duplicates). Vector rendering - renderSVG/renderPDF/renderPostScript take optional width/height so the page size is explicit instead of depending on the map's previous size. The map size is restored afterwards. ImageFormat - typeString is public, so the documented mapnik type mapping is observable (and testable without @testable import). C shim - The cairo temp file honours TMPDIR via std::filesystem::temp_directory_path instead of hard-coding /tmp. - Removed the unused AGG include. Packaging - Package.resolved is no longer committed: for a library it only pins the repo's own builds and hides incompatibilities with newer gis-tools releases. Tests - tileCount uniqueness, vector page size (and that the map size is restored), default vector size, and every ImageFormat type string.
The docs job builds with --warnings-as-errors, which requires every parameter of a documented function to be described.
trasch
added a commit
that referenced
this pull request
Nov 2, 2026
Rebased onto main after #118 landed. Conflicts were resolved by combining both sides: main's newer code (dropped-feature counting, non-square metatile dimensions) plus this PR's hardening on top. Thread safety - mapnik_datasource_destroy takes the lifecycle mutex like mapnik_datasource_create, so a datasource cannot be torn down while another thread is loading a stylesheet. - MapnikDatasource.init passes the pointer arrays directly instead of reinterpreting their storage through UnsafeRawPointer + assumingMemoryBound (undefined behaviour, and it force-unwrapped baseAddress). - Documented that MapnikDatasource is safe for one concurrent query at a time, and that Mapnik.deinit may block on the lifecycle lock. Feature queries - Boolean detection compares against Foundation's shared boolean instances instead of sniffing NSNumber.objCType[0] == 'c', which is an implementation detail and also matches small integers on some versions. Verified: {"flag": true, "small": 1} decodes as Bool and Int. Docs - renderTile warns that a non-Web-Mercator map interprets the tile box in its own SRS (an epsg:4326 map renders empty) instead of claiming it is "valid". - ImageFormat.svg documents that it is not usable with the raster entry points. - inspect's fieldFilter documents that it is a membership filter and does not control output order. - The counting-datasource header matches the implementation: the layer keeps a shared_ptr, so the handle may be destroyed early. - MetatileOptions.validated() validates at construction for callers that want the error early, without making the default argument throwing. Tests - Concurrent datasource create/inspect/query/destroy, and that a map stays usable after its counting datasource handle is destroyed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The last batch of API gaps: a counter that disagreed with its own output, vector renders whose page size depended on earlier calls, and internal-only accessors.
TilelistBuilder
tileCountcounted additions whiletilelistde-duplicated. It now counts unique tiles, so the two agree.Vector rendering
renderSVG/renderPDF/renderPostScriptrendered at whatever size the map happened to have, so the page size depended on the previous call:They now take optional
width/height, and the map size is restored afterwards:ImageFormat
typeStringis public, so the documented mapnik-type mapping ("webp:quality=80", …) is observable and testable without@testable import.Render prologue
render(),renderTile,renderMetatileandrenderPNG256each re-implemented validate → resize → apply buffer → zoom → restore. That duplication is exactly howscale,heightandskipFullyTransparentcame to be honoured by some paths and ignored by others. A newwithRenderState(_:resize:zoomIfUnset:body:)captures the sequence, andrender()uses it.C shim
TMPDIRviastd::filesystem::temp_directory_pathinstead of hard-coding/tmp, which is not writable in every sandbox.write_buffer_to_filehelper and the unused AGG include.Packaging
Package.resolvedis no longer committed. For a library it only pins the repo's own builds while hiding incompatibilities with newer gis-tools releases.Testing
New tests for
tileCountuniqueness, vector page size (including that the map size is restored), the default vector size, and everyImageFormat.typeString.swiftformat --lintis clean.Breaking changes
TilelistBuilder.tileCountnow counts unique tiles.renderSVG/renderPDF/renderPostScriptgainedwidth:/height:parameters (defaulted, so existing calls compile).Closes #15
Closes #22
Closes #23
Closes #54
Closes #88
Closes #90
Closes #96