Commit Graph
29 Commits
Author SHA1 Message Date
Erica Fischer 7d4d264d50 Speeding up tippecanoe-overzoom (#191)
* Speed up mvt_value comparison

* Converting repetitive ifs to cases

* More conversions from ifs to cases

* Optimize the always-true filter case

* Don't convert types of attributes without accumulators

* Unordered map seems to be faster than map

* Add missing header

* Fix some warnings

* Fix the warnings better

* Avoid an int->string->int conversion

* Lazily initialize layer key and values maps when actually needed

* More switches from maps to unordered_maps

* Sure, I'll take the microoptimization

* More emplacement

* Save some copies

* Emplaces and moves

* Lazy linear scan of attributes instead of building a map

* Extra printfs, missing header

* Avoid clipping if the input and output tiles are the same

* But do clip if the tile extent is being reduced

* Make sure I'm not constructing std::strings here at runtime

* More worrying about runtime string construction

* A couple more std::moves

* Const references!

* More const references

* Another std::move

* Make the string_value of mvt_value std::optional

* Reserve storage when decoding

* Provision for different mvt_values to share a string pool

* Use the string pool when decoding

* Avoid another string construction

* Try limiting the depth of the search for duplicate attributes

* Revert "Try limiting the depth of the search for duplicate attributes"

This reverts commit 9ec94a15ff.

* Update changelog

* Fix typo noticed during code review
2024-01-29 11:33:56 -08:00
Erica FischerandBrandon Liu 3b2599f587 Add support for pmtiles output format (#55)
* add pmtiles.hpp from github.com/protomaps/PMTiles [#10]

* tippecanoe main writes pmtiles output. [#10]

* detect output format using suffix
* after mbtiles is done writing, replace with pmtiles based on map/image tables.
* add method to write_json for writing json sub-object.

* tippecanoe-decode reads pmtiles input. [#10]

* tile-join reads and writes pmtiles. [#10]

* pmtiles test suite for decode and tile-join [#10]

* add base GitHub CI action for compiling and test suite.

* update pmtiles.hpp with z>15 fix

* Fix some ordering problems with pmtiles decode

* Pmtiles should also pass the raw tiles tests

* Eradicate spaces from tileset metadata JSON fields

* Eradicate spaces from more test fixtures

* Update more tests

* Pmtiles tests pass now too

* Remove unnecessary sort (and make indent)

* Update changelog

* The allow-existing test for pmtiles needs -o, not -e

* Declare --allow-existing to be unsupported for pmtiles.

It was always a bad idea even for mbtiles.

Co-authored-by: Brandon Liu <bdon@bdon.org>
2022-12-29 12:00:13 -08: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 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
Eric Fischer 2318673108 Be more systematic about nulls and undefined attribute values
It is an error to write a null attribute to a tile, but
null attributes found within existing tiles will be decoded
into JSON as null.
2018-06-06 11:48:01 -07:00
Eric Fischer b8cfab1eaf Add #define to fix the build on Cygwin 2018-05-04 10:37:27 -07:00
Eric Fischer 3d1ebdb82f Add missing #include 2018-03-16 16:26:19 -07:00
Eric Fischer 3c827b1d68 Use the standard JSON writer when writing metadata.json 2018-03-16 15:35:26 -07:00
Eric Fischer ebb0334ef0 Use the standard JSON writer for tilestats
With a lot of weird special cases to keep the formatting
exactly like it accidentally was before
2018-03-16 15:19:23 -07:00
Eric Fischer 08fc2f281e JSON can be written to either a FILE or a string 2018-03-16 14:20:52 -07:00
Eric Fischer 1c4aa57ffd Change the JSON writing functions to object methods 2018-03-16 13:43:21 -07:00
Eric Fischer 623e0c90fe More regularization of JSON writing 2018-03-15 17:07:26 -07:00
Eric Fischer ddf4a45b33 Use JSON writer functions for tile size stats 2018-03-15 15:19:52 -07:00
Eric Fischer 605ccbe077 Helper functions so I will stop writing JSON by hand 2018-03-15 14:42:53 -07:00
Eric Fischer a8a342f701 Send dot-dropping through the same pipeline.
The first feature in a tile can never be dropped, since there is
no previous feature to attach its properties to.

Remove the previous special case that reset the dropping counter
at the first feature within each tile proper (as opposed to the
first feature in each tile, including its buffer, which is now
the one that is guaranteed to be preserved).
2018-02-23 17:19:54 -08:00
Eric Fischer d49606babf Fix opportunities for integer overflow 2018-01-18 12:37:15 -08:00
Eric Fischer 23004808e4 Merge branch 'master' into more-warnings 2017-11-09 15:13:07 -08:00
Eric Fischer fda0e1f28a Fix more cases of loss of precision for large magnitude integers 2017-11-09 13:56:07 -08:00
Eric Fischer 0152db4a20 More initializers 2017-11-07 15:57:56 -08:00
Eric Fischer f9a007e8c3 Use milo dtoa for consistent string representation of numbers 2017-08-29 14:44:34 -07:00
Eric Fischer 635429cd87 Fix dangling pointer. Defer tilestats generation until tiling if filtering. 2017-08-08 13:38:48 -07:00
Eric Fischer b301512860 Merge branch 'master' into plugins 2017-05-12 17:20:30 -07:00
Eric Fischer 834ba19277 Add option for newline-delimited output format to tippecanoe-decode 2017-03-28 16:25:40 -07:00
Eric Fischer 150e3663e1 Pass the index, sequence, and extent through the prefilter when needed 2017-01-13 14:59:11 -08:00
Eric Fischer a2060299c9 Fix arithmetic overflow that was breaking some prefilter polygons 2016-12-20 15:59:10 -08:00
Eric Fischer a338f5390f Fix where I was closing the prefilter pipe in the wrong thread 2016-12-09 14:15:17 -08:00
Eric Fischer d1dc310bbc The GeoJSON-producing part of prefiltering 2016-12-08 15:13:38 -08:00
Eric Fischer 6530e155eb Don't put a comma between features in filter output 2016-12-08 11:14:06 -08:00
Eric Fischer 112f451c66 Move JSON-writing again to keep it from requiring all plugin code 2016-12-06 17:19:22 -08:00