Commit Graph
55 Commits
Author SHA1 Message Date
Erica Fischer f1df09f147 Generate fewer duplicate label points at high zoom levels (#42) 2022-12-02 11:02:33 -08:00
Erica Fischer 8eec2be462 Improve quality of coalescing-as-needed; add options to limit feature count (#25)
* Add an option to limit geometry vertex count

* Update docs and changelog

* Track desired feature count and geometry size in strategies

* Remove dead code for a long-forgotten inaccessible option

* Fix the option name in changelog

* Refine coalesce-smallest to only coalesce onto other small features

* Clean polygons before coalescing-as-needed

* Don't accumulate tiny polygon holes as negative dust

* Add the option not to limit the feature count at maxzoom

* Add options to limit feature count more abruptly in each tile

* Revert "Add the option not to limit the feature count at maxzoom"

This reverts commit ace173ab7a.

* Revert "Fix the option name in changelog"

This reverts commit 38dbce8405.

* Revert "Add an option to limit geometry vertex count"

This reverts commit d379fdf06b.

* Remove test for reverted option

* Remove more leftovers from geometry size limiting

* Update changelog
2022-11-17 13:09:10 -08:00
Erica Fischer 7733cced43 Add an option to drop more points in dense areas than in sparse areas (#35)
* Add an option to drop the densest features by rate, not a fraction

* Restrict dot dropping just to dots, as it should be

* 50% mix of sparse and uniform point preservation

* Update version, changelog, test, and documentation

* 60% sparse, 40% dense

* Didn't update the test after the last change

* Make the drop-denser rate configurable without recompiling
2022-11-16 10:55:07 -08:00
Erica Fischer 5b03b18f31 Generate label points after simplification, not before. (#27)
* Generate labels points after simplification, not before.

Previously there were some cases where dropping the smallest
polygons would never reduce the number of labels.

* Also wait until after polygon cleaning to make labels

* Remove the extra newlines after the TILES ONLY COMPLETE message
2022-10-21 13:59:36 -07:00
Erica Fischer b763625862 Add an option to generate label points in place of polygons (#20)
* Add an option to generate label points in place of polygons

* Change all these places where I said "extent" but really meant "area"

* Revert "Change all these places where I said "extent" but really meant "area""

This reverts commit 403828d2f7.

* Add --order-smallest-first and --order-largest-first options

* Use Turf's center-of-mass algorithm for polygon label points

* If the label point isn't within the polygon, find one that is

* Don't choose a label point that is too close to a border

* Try a little harder to find an optimal label point

* Checkerboard which tiles labels are generated in, to reduce adjacency

* Use a label point for the general representative point for polygons

(Skipping the iteration to find one that is as far as possible from
the borders)

This makes the labels look better in many cases (like France at z1)
but unfortunately ripples into changing the sequence of polygons in
many tests, so the diff is big.

* Revert "Use a label point for the general representative point for polygons"

This reverts commit 2261adf05e.

* Checkpoint work on spiral labels

* Clip label spirals to the feature bounds

* Fix label test

* Be careful not to place spiral labels too close to borders either

* For spiral anchors, only check tile scale, not feature size

* Update test

* Only try to find a central label point for the largest ring

* In tiny polygon dust, keep the attributes of the largest feature
2022-10-13 14:21:36 -07:00
Erica FischerandRoman Karavia 182093bdc7 Improve precision of polygon area calculations (#19)
* Improve precision of get_area by using long double

* Trying to get consistent polygon area results between ARM and x86

* Calculate polygon area closer to the origin for better precision

* Update changelog

* Also exercise tiny polygon dust in the ring area test

They previously behaved differently here between x86 and ARM

* On M1 Macs, long double is just double anyway, so don't use it

* Be more careful about overflow: scale the polygon ring down into range

* Fix the bug I just introduced in the scaled area calculation

* Use only the sign from the scaled-down area calculation

Co-authored-by: Roman Karavia <47303530+romankaravia@users.noreply.github.com>
2022-10-04 10:04:34 -07:00
Erica Fischer 4ef430b913 Add an option for the Visvalingam simplification algorithm (#16)
* First attempt at porting Paul Mach's Visvalingam implementation

* Make indent

* Mostly working

* Approximate equivalence from Douglas-Peucker to Visvalingam levels

* Don't simplify away tile boundary crossing points

* Add a command-line option and test for Visvalingam simplification

* Update changelog

* Cleanup in response to review feedback

* Include <stdio.h> to fix compiler warnings
2022-09-30 12:00:07 -07:00
Erica Fischer af1a7ed7ae Once features can't possibly fit in a tile, stop trying (#9)
* Stop adding features to a tile if it can't possibly work

* Add --integer and --fraction options to tippecanoe-decode

* Carry the strategies field from tileset metadata through tile-join

* Update changelog

* Assign different codes to different kinds of error exits
2022-09-23 20:01:13 -04:00
Erica Fischer a447dfc089 Extra coordinate precision; feature ordering; compression improvements
* Add an option to retain extra coordinate precision at maxzoom

* Make sure not to shift away the extra detail from coordinates

* Add an option to convert double-precision attributes to single

* Sort attribute values in tiles to make them compress a little better

* Slightly improve polygon simplification

By choosing a point that would be retained after simplification
to be the start/end point that always gets retained

* I regret making all of these tests involve polygons

* Add an option to specify the size of tiny polygons

* Fix accidental requiring of argument for --single-precision

* Guard against duplicate points when generating "sizes" for them

* Restore the intended behavior that tiny polygons don't get simplified

* Make the extra detail settable rather than always maximizing it

* Revert "Improve maxzoom guessing for tightly-clustered point data sources (#4)"

This reverts commit fec5e8354c.

* Add an option to prevent choosing a base zoom higher than the maxzoom

* Keep the drop rate high enough when the basezoom gets constrained

* Revert "Revert "Improve maxzoom guessing for tightly-clustered point data sources (#4)""

This reverts commit db6bc27d9e.

* Add --order-by and --order-descending options

* Accept multiple --order-by and --order-descending-by sort keys
2022-09-06 13:08:11 -07:00
Erica Fischer 6978a0e102 Reindent with clang-format (#3) 2022-07-28 11:19:30 -07:00
Monty Taylor efa40d20ab Clean a few warnings emited by GCC v8
An instance of catching an exception by value:

  https://blog.knatten.org/2010/04/02/always-catch-exceptions-by-reference/

In jsontool, there's a warning about writing 8 bytes into a 7
byte buffer, potentially truncating or losing the nul-terminator.

There are a couple of instances of an unused bool variable, not
really a big deal.
2020-05-17 09:43:24 -05:00
Eric Fischer 42ee195bc3 Add an option to keep intersection nodes from being simplified away 2019-05-13 17:39:07 -07:00
Eric Fischer 6376c283ba Add Hilbert Curve feature sequencing as an option 2018-12-12 10:51:00 -08:00
Eric Fischer cf28e6b88b Make it an error, not a warning, to have missing coordinates for a point 2018-11-26 14:50:45 -08:00
Eric Fischer 5229990523 Fix gridding of small squares; use less memory for small features 2018-11-21 15:34:43 -08:00
Eric Fischer 5dfbc4a281 Add --clip-bounding-box option to clip input geometry 2018-10-22 16:49:33 -07:00
Eric Fischer 48486b5d7b Add --use-source-polygon-winding and --reverse-source-polygon-winding 2018-06-01 12:59:28 -07:00
Eric Fischer 59dd095607 Make file positions and lengths thread-safe 2018-05-07 14:42:49 -07:00
Eric Fischer d89d46da65 Remove unused parameters 2017-11-07 10:55:34 -08:00
Eric Fischer 9cbbc4c68d Merge branch 'master' into plugins-merge 2017-03-02 10:45:25 -08:00
Eric Fischer 1b68dcdc22 Fix division by 0 by using more general and robust polygon-checking code 2017-02-17 13:25:56 -08:00
Eric Fischer 62e1018c87 Fix area of placeholders for degenerate multipolygons 2017-02-06 14:14:34 -08:00
Eric Fischer 31f254ac99 Upgrade to Wagyu 0.3.0; downgrade C++ requirement to C++ 11 2017-01-26 13:28:17 -08:00
Eric Fischer aa75f4a4c4 Merge branch 'master' into plugins 2017-01-12 16:03:55 -08:00
Eric Fischer 72086b7e92 Upgrade Wagyu to cfc895 and use its Sutherland-Hodgman implementation 2017-01-11 15:43:07 -08:00
Eric Fischer 2fdec7d2e4 Try using Wagyu's quick_clip 2017-01-06 16:24:09 -08:00
Eric Fischer 854dc2bca5 Merge branch 'master' into plugins 2016-12-20 14:15:06 -08:00
Eric Fischer 4fc671f1d1 Merge branch 'master' into plugins 2016-12-14 11:29:58 -08:00
Eric Fischer b3c116b989 Merge branch 'master' into wagyu-clean 2016-12-14 11:12:07 -08:00
Eric Fischer d7d5bed781 Remove duplicate vertices before calling wagyu 2016-12-13 16:55:33 -08:00
Eric Fischer af3d48e5b3 Fix integer overflow identified by -fsanitize=integer 2016-12-13 16:19:38 -08:00
Eric Fischer 0e5b513637 Start getting features (just geometry so far) back from the prefilter 2016-12-09 15:35:57 -08:00
Eric Fischer 5194a39c16 Factor out clipping to tile boundaries; test random attributes & layers 2016-12-09 10:47:03 -08:00
Eric Fischer 569825324a Factor out feature deserialization 2016-12-08 17:11:37 -08:00
Eric Fischer a4f5406cfb Switch polygon topology correction from Clipper to Wagyu 2016-12-07 14:29:09 -08:00
Eric Fischer f6d5d1803b Round coordinates in low-zoom grid instead of truncating
To avoid rounding error if features are already tile-grid-aligned
2016-11-29 15:18:44 -08:00
Eric Fischer 0db8d9ed8b Option to snap low zooms to a stairstep grid 2016-11-28 15:45:38 -08:00
Eric Fischer 9ea29601ab Don't let line simplification reduce a polygon ring to below 3 points 2016-11-14 11:22:21 -08:00
Eric Fischer faa5720e3b Remove dead code 2016-11-01 16:31:45 -07:00
Eric Fischer 8296190487 Remove leftovers from early versions of --detect-shared-borders 2016-10-26 15:47:26 -07:00
Eric Fischer 93d3c40593 Remove dead code 2016-10-26 15:43:46 -07:00
Eric Fischer f7daa05515 Add a critical point where the set of rings using a polygon edge changes 2016-10-05 17:16:18 -07:00
Eric Fischer 0d1931319c Use simpler calculation to intersect polygon edges with tile edges.
Add the polygon that produced a bad tile with the previous version
as a test.
2016-08-24 15:32:48 -07:00
Eric Fischer 8b339abd40 Use the same serialization in both places, and add sanity checks 2016-08-08 17:08:36 -07:00
Eric Fischer 9908db5e56 Add an option to vary the level of line and polygon simplification 2016-07-12 16:51:56 -07:00
Eric Fischer 850a36b2f6 Update clang-format options for clang-format 3.9.0 2016-06-16 12:33:38 -07:00
Eric Fischer c0edefa721 Pack structures tighter to use a little less memory 2016-05-11 14:23:39 -07:00
Eric Fischer 4f01b13fe1 Let zoom level 0 have just as much extent and buffer as any other zoom 2016-05-09 16:01:10 -07:00
Eric Fischer 0f1d2e4220 Fix additional g++ warnings 2016-05-03 16:39:26 -07:00
Eric Fischer f1b3f6d231 Fix warnings about shadowed variables 2016-05-03 15:48:42 -07:00