mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-23 08:51:18 +01:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b362b0cd7 | ||
|
|
829c765d5d | ||
|
|
3b2599f587 | ||
|
|
a374263466 | ||
|
|
079929717e | ||
|
|
2b7bbbdbca | ||
|
|
bfabf8325f | ||
|
|
9c77029b63 | ||
|
|
b9af922650 | ||
|
|
f1df09f147 | ||
|
|
5c647cdb83 | ||
|
|
3095adb467 | ||
|
|
8eec2be462 | ||
|
|
7733cced43 | ||
|
|
622084a507 | ||
|
|
1584543224 | ||
|
|
4317c826a9 | ||
|
|
c2214631f2 | ||
|
|
5b03b18f31 | ||
|
|
b763625862 | ||
|
|
182093bdc7 | ||
|
|
a6abb0bc30 | ||
|
|
4ef430b913 | ||
|
|
6de00c15ec | ||
|
|
3086838a10 | ||
|
|
af1a7ed7ae | ||
|
|
ed31b9ac84 |
@@ -0,0 +1,11 @@
|
||||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: make
|
||||
- run: make test
|
||||
+87
-1
@@ -1,6 +1,92 @@
|
||||
## 2.17.0
|
||||
|
||||
* Add pmtiles output format
|
||||
|
||||
## 2.16.0
|
||||
|
||||
* During tiling, limit the size of the statistics that are kept for -as-needed calculations, because they can get quite large for sources with hundreds of millions of features.
|
||||
|
||||
## 2.15.2
|
||||
|
||||
* Change tile hash function to fnv1a
|
||||
* Report JSON object context on the same line as the error message
|
||||
|
||||
## 2.15.1
|
||||
|
||||
* Correct mbtiles inserts to use text instead of blob
|
||||
* Add an internal data structure to represent tileset metadata
|
||||
|
||||
## 2.15.0
|
||||
|
||||
* Generate label points in a more straightforward checkerboard, and fewer of them at high zoom levels.
|
||||
|
||||
## 2.14.0
|
||||
|
||||
* Don't preflight each zoom level if one of the as-needed options is specified. Instead, go ahead and write out the tiles, and then clear out the zoom level for another try if necessary.
|
||||
|
||||
## 2.13.1
|
||||
|
||||
* Simplify geometry earlier when the in-memory representation of a tile gets large, to reduce peak memory usage
|
||||
|
||||
## 2.13.0
|
||||
|
||||
* Add --limit-tile-feature-count and --limit-tile-feature-count-at-maximum-zoom
|
||||
* Coalesce small features only onto other small features with `--coalesce-smallest-as-needed`, never to large features
|
||||
* Clean coalesced-as-needed features before simplifying them, to improve simplification quality
|
||||
|
||||
## 2.12.0
|
||||
|
||||
* Add `--drop-denser` option to drop points in dense clusters in preference
|
||||
to those in sparse areas.
|
||||
|
||||
## 2.11.0
|
||||
|
||||
* Change sqlite3 schema to deduplicate identical tiles
|
||||
* Limit guessed maxzoom to avoid spending too many tiles on polygon fill
|
||||
|
||||
## 2.10.0
|
||||
|
||||
* Upgrade flatbuffers version
|
||||
|
||||
## 2.9.1
|
||||
|
||||
* Do label generation after simplification, not before.
|
||||
|
||||
## 2.9.0
|
||||
|
||||
* Add an option to generate label points in place of polygons
|
||||
* Add --order-smallest-first and --order-largest-first options
|
||||
* When tiny polygons are being aggregated into dust, keep the attributes of the largest.
|
||||
|
||||
## 2.8.1
|
||||
|
||||
* Improve precision of polygon ring area calculations
|
||||
|
||||
## 2.8.0
|
||||
|
||||
* Add the option to use a different simplification level at maxzoom
|
||||
|
||||
## 2.7.0
|
||||
|
||||
* Add the option to use the Visvalingam simplification algorithm
|
||||
|
||||
## 2.6.4
|
||||
|
||||
* Update tests that should have been updated in 2.6.2
|
||||
|
||||
## 2.6.3
|
||||
|
||||
* Fix crash in tile-join caused by wrong-way comparison
|
||||
|
||||
## 2.6.2
|
||||
|
||||
* Stop adding features to a tile if it can't possibly work, to limit memory use
|
||||
* Add --integer and --fraction options to tippecanoe-decode
|
||||
* Carry `strategies` field from tileset metadata through tile-join
|
||||
|
||||
## 2.6.1
|
||||
|
||||
Upgrade protozero to version 1.7.1
|
||||
* Upgrade protozero to version 1.7.1
|
||||
|
||||
## 2.6.0
|
||||
|
||||
|
||||
@@ -47,16 +47,16 @@ C = $(wildcard *.c) $(wildcard *.cpp)
|
||||
INCLUDES = -I/usr/local/include -I.
|
||||
LIBS = -L/usr/local/lib
|
||||
|
||||
tippecanoe: geojson.o jsonpull/jsonpull.o tile.o pool.o mbtiles.o geometry.o projection.o memfile.o mvt.o serial.o main.o text.o dirtiles.o plugin.o read_json.o write_json.o geobuf.o flatgeobuf.o evaluator.o geocsv.o csv.o geojson-loop.o json_logger.o
|
||||
tippecanoe: geojson.o jsonpull/jsonpull.o tile.o pool.o mbtiles.o geometry.o projection.o memfile.o mvt.o serial.o main.o text.o dirtiles.o pmtiles_file.o plugin.o read_json.o write_json.o geobuf.o flatgeobuf.o evaluator.o geocsv.o csv.o geojson-loop.o json_logger.o visvalingam.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
tippecanoe-enumerate: enumerate.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lsqlite3
|
||||
|
||||
tippecanoe-decode: decode.o projection.o mvt.o write_json.o text.o jsonpull/jsonpull.o dirtiles.o
|
||||
tippecanoe-decode: decode.o projection.o mvt.o write_json.o text.o jsonpull/jsonpull.o dirtiles.o pmtiles_file.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3
|
||||
|
||||
tile-join: tile-join.o projection.o pool.o mbtiles.o mvt.o memfile.o dirtiles.o jsonpull/jsonpull.o text.o evaluator.o csv.o write_json.o
|
||||
tile-join: tile-join.o projection.o pool.o mbtiles.o mvt.o memfile.o dirtiles.o jsonpull/jsonpull.o text.o evaluator.o csv.o write_json.o pmtiles_file.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
tippecanoe-json-tool: jsontool.o jsonpull/jsonpull.o csv.o text.o geojson-loop.o
|
||||
@@ -82,7 +82,7 @@ indent:
|
||||
TESTS = $(wildcard tests/*/out/*.json)
|
||||
SPACE = $(NULL) $(NULL)
|
||||
|
||||
test: tippecanoe tippecanoe-decode $(addsuffix .check,$(TESTS)) raw-tiles-test parallel-test pbf-test join-test enumerate-test decode-test join-filter-test unit json-tool-test allow-existing-test csv-test layer-json-test
|
||||
test: tippecanoe tippecanoe-decode $(addsuffix .check,$(TESTS)) raw-tiles-test parallel-test pbf-test join-test enumerate-test decode-test join-filter-test unit json-tool-test allow-existing-test csv-test layer-json-test pmtiles-test decode-pmtiles-test
|
||||
./unit
|
||||
|
||||
suffixes = json json.gz
|
||||
@@ -156,19 +156,77 @@ raw-tiles-test:
|
||||
cmp tests/raw-tiles/nothing.json.check tests/raw-tiles/nothing.json
|
||||
rm -r tests/raw-tiles/nothing tests/raw-tiles/nothing.json.check
|
||||
|
||||
pmtiles-test:
|
||||
./tippecanoe -q -f -o tests/pmtiles/hackspots.pmtiles -r1 -pC tests/raw-tiles/hackspots.geojson
|
||||
./tippecanoe-decode -x generator tests/pmtiles/hackspots.pmtiles > tests/pmtiles/hackspots.json.check
|
||||
cmp tests/pmtiles/hackspots.json.check tests/pmtiles/hackspots.json
|
||||
# Test generating pmtiles first and then converting to mbtiles with tile-join.
|
||||
./tile-join -q -f -pC -o tests/pmtiles/joined.mbtiles tests/pmtiles/hackspots.pmtiles
|
||||
./tippecanoe-decode -x generator tests/pmtiles/joined.mbtiles > tests/pmtiles/joined.json.check
|
||||
cmp tests/pmtiles/joined.json.check tests/pmtiles/joined.json
|
||||
rm -r tests/pmtiles/hackspots.json.check tests/pmtiles/hackspots.pmtiles
|
||||
|
||||
# Test generating mbtiles first and then converting to pmtiles with tile-join. (Changes bounds)
|
||||
./tippecanoe -q -f -o tests/pmtiles/hackspots.mbtiles -r1 -pC tests/raw-tiles/hackspots.geojson
|
||||
./tile-join -q -f -pC -o tests/pmtiles/joined.pmtiles tests/pmtiles/hackspots.mbtiles
|
||||
|
||||
# decode changes order (ZXY vs TMS order)
|
||||
./tippecanoe-decode -x generator tests/pmtiles/joined.pmtiles > tests/pmtiles/joined_reordered.json.check
|
||||
cmp tests/pmtiles/joined_reordered.json.check tests/pmtiles/joined_reordered.json
|
||||
rm -r tests/pmtiles/joined_reordered.json.check tests/pmtiles/hackspots.mbtiles tests/pmtiles/joined.pmtiles
|
||||
|
||||
# From raw-tiles-test:
|
||||
./tippecanoe -q -f -o tests/raw-tiles/raw-tiles.pmtiles -r1 -pC tests/raw-tiles/hackspots.geojson
|
||||
./tippecanoe-decode -x generator tests/raw-tiles/raw-tiles.pmtiles | sed 's/\.pmtiles//g' | sed 's/ -o / -e /g' > tests/raw-tiles/raw-tiles.json.check
|
||||
cmp tests/raw-tiles/raw-tiles.json.check tests/raw-tiles/raw-tiles.json
|
||||
# Test that -z and -Z work in tippecanoe-decode
|
||||
./tippecanoe-decode -x generator -Z6 -z7 tests/raw-tiles/raw-tiles.pmtiles | sed 's/\.pmtiles//g' | sed 's/ -o / -e /g' > tests/raw-tiles/raw-tiles-z67.json.check
|
||||
cmp tests/raw-tiles/raw-tiles-z67.json.check tests/raw-tiles/raw-tiles-z67.json
|
||||
# Test that -z and -Z work in tile-join
|
||||
./tile-join -q -f -Z6 -z7 -o tests/raw-tiles/raw-tiles-z67.pmtiles tests/raw-tiles/raw-tiles.pmtiles
|
||||
./tippecanoe-decode -x generator tests/raw-tiles/raw-tiles-z67.pmtiles | sed 's/\.pmtiles//g' | sed 's/ -o / -e /g' > tests/raw-tiles/raw-tiles-z67-join.json.check
|
||||
cmp tests/raw-tiles/raw-tiles-z67-join.json.check tests/raw-tiles/raw-tiles-z67-join.json
|
||||
rm -rf tests/raw-tiles/raw-tiles.pmtiles tests/raw-tiles/raw-tiles-z67.pmtiles tests/raw-tiles/raw-tiles.json.check raw-tiles-z67.json.check tests/raw-tiles/raw-tiles-z67-join.json.check
|
||||
# Test that metadata.json is created even if all features are clipped away
|
||||
./tippecanoe -q -f -o tests/raw-tiles/nothing.pmtiles tests/raw-tiles/nothing.geojson
|
||||
./tippecanoe-decode -x generator tests/raw-tiles/nothing.pmtiles | sed 's/\.pmtiles//g' | sed 's/ -o / -e /g' > tests/raw-tiles/nothing.json.check
|
||||
cmp tests/raw-tiles/nothing.json.check tests/raw-tiles/nothing.json
|
||||
rm -r tests/raw-tiles/nothing.pmtiles tests/raw-tiles/nothing.json.check
|
||||
|
||||
decode-test:
|
||||
mkdir -p tests/muni/decode
|
||||
./tippecanoe -q -z11 -Z11 -f -o tests/muni/decode/multi.mbtiles tests/muni/*.json
|
||||
./tippecanoe-decode -x generator -l subway tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.json.check
|
||||
./tippecanoe-decode -x generator -l subway --integer tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.integer.json.check
|
||||
./tippecanoe-decode -x generator -l subway --fraction tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.fraction.json.check
|
||||
./tippecanoe-decode -x generator -c tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.pipeline.json.check
|
||||
./tippecanoe-decode -x generator tests/muni/decode/multi.mbtiles 11 327 791 > tests/muni/decode/multi.mbtiles.onetile.json.check
|
||||
./tippecanoe-decode -x generator --stats tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.stats.json.check
|
||||
cmp tests/muni/decode/multi.mbtiles.json.check tests/muni/decode/multi.mbtiles.json
|
||||
cmp tests/muni/decode/multi.mbtiles.integer.json.check tests/muni/decode/multi.mbtiles.integer.json
|
||||
cmp tests/muni/decode/multi.mbtiles.fraction.json.check tests/muni/decode/multi.mbtiles.fraction.json
|
||||
cmp tests/muni/decode/multi.mbtiles.pipeline.json.check tests/muni/decode/multi.mbtiles.pipeline.json
|
||||
cmp tests/muni/decode/multi.mbtiles.onetile.json.check tests/muni/decode/multi.mbtiles.onetile.json
|
||||
cmp tests/muni/decode/multi.mbtiles.stats.json.check tests/muni/decode/multi.mbtiles.stats.json
|
||||
rm -f tests/muni/decode/multi.mbtiles.json.check tests/muni/decode/multi.mbtiles tests/muni/decode/multi.mbtiles.pipeline.json.check tests/muni/decode/multi.mbtiles.stats.json.check tests/muni/decode/multi.mbtiles.onetile.json.check
|
||||
|
||||
decode-pmtiles-test:
|
||||
mkdir -p tests/muni/decode
|
||||
./tippecanoe -q -z11 -Z11 -f -o tests/muni/decode/multi.pmtiles tests/muni/*.json
|
||||
./tippecanoe-decode -x generator -l subway tests/muni/decode/multi.pmtiles | sed 's/pmtiles/mbtiles/g' > tests/muni/decode/multi.pmtiles.json.check
|
||||
./tippecanoe-decode -x generator -l subway --integer tests/muni/decode/multi.pmtiles | sed 's/pmtiles/mbtiles/g' > tests/muni/decode/multi.pmtiles.integer.json.check
|
||||
./tippecanoe-decode -x generator -l subway --fraction tests/muni/decode/multi.pmtiles | sed 's/pmtiles/mbtiles/g' > tests/muni/decode/multi.pmtiles.fraction.json.check
|
||||
./tippecanoe-decode -x generator -c tests/muni/decode/multi.pmtiles | sed 's/pmtiles/mbtiles/g' > tests/muni/decode/multi.pmtiles.pipeline.json.check
|
||||
./tippecanoe-decode -x generator tests/muni/decode/multi.pmtiles 11 327 791 | sed 's/pmtiles/mbtiles/g' > tests/muni/decode/multi.pmtiles.onetile.json.check
|
||||
./tippecanoe-decode -x generator --stats tests/muni/decode/multi.pmtiles | sed 's/pmtiles/mbtiles/g' > tests/muni/decode/multi.pmtiles.stats.json.check
|
||||
cmp tests/muni/decode/multi.pmtiles.json.check tests/muni/decode/multi.mbtiles.json
|
||||
cmp tests/muni/decode/multi.pmtiles.integer.json.check tests/muni/decode/multi.mbtiles.integer.json
|
||||
cmp tests/muni/decode/multi.pmtiles.fraction.json.check tests/muni/decode/multi.mbtiles.fraction.json
|
||||
cmp tests/muni/decode/multi.pmtiles.pipeline.json.check tests/muni/decode/multi.mbtiles.pipeline.json
|
||||
cmp tests/muni/decode/multi.pmtiles.onetile.json.check tests/muni/decode/multi.mbtiles.onetile.json
|
||||
cmp tests/muni/decode/multi.pmtiles.stats.json.check tests/muni/decode/multi.mbtiles.stats.json
|
||||
rm -f tests/muni/decode/multi.pmtiles.json.check tests/muni/decode/multi.pmtiles tests/muni/decode/multi.pmtiles.pipeline.json.check tests/muni/decode/multi.pmtiles.stats.json.check tests/muni/decode/multi.pmtiles.onetile.json.check
|
||||
|
||||
pbf-test:
|
||||
./tippecanoe-decode -x generator tests/pbf/11-328-791.vector.pbf 11 328 791 > tests/pbf/11-328-791.vector.pbf.out
|
||||
cmp tests/pbf/11-328-791.json tests/pbf/11-328-791.vector.pbf.out
|
||||
@@ -314,7 +372,15 @@ allow-existing-test:
|
||||
./tippecanoe -q -Z10 -z11 -F -e tests/allow-existing/both.dir tests/coalesce-tract/tl_2010_06001_tract10.json
|
||||
./tippecanoe-decode -x generator -x generator_options tests/allow-existing/both.dir | sed 's/both\.dir/both.mbtiles/g' > tests/allow-existing/both.dir.json.check
|
||||
cmp tests/allow-existing/both.dir.json.check tests/allow-existing/both.mbtiles.json
|
||||
rm -r tests/allow-existing/both.dir.json.check tests/allow-existing/both.dir tests/allow-existing/both.mbtiles.json.check tests/allow-existing/both.mbtiles
|
||||
# Make a tileset
|
||||
./tippecanoe -q -Z0 -z0 -f -o tests/allow-existing/both.pmtiles tests/coalesce-tract/tl_2010_06001_tract10.json
|
||||
# Writing to existing should fail
|
||||
if ./tippecanoe -q -Z1 -z1 -o tests/allow-existing/both.pmtiles tests/coalesce-tract/tl_2010_06001_tract10.json; then exit 1; else exit 0; fi
|
||||
# Replace existing
|
||||
./tippecanoe -q -Z8 -z9 -f -o tests/allow-existing/both.pmtiles tests/coalesce-tract/tl_2010_06001_tract10.json
|
||||
# Allow-existing is not supported for pmtiles
|
||||
if ./tippecanoe -q -Z10 -z11 -F -o tests/allow-existing/both.pmtiles tests/coalesce-tract/tl_2010_06001_tract10.json; then exit 1; else exit 0; fi
|
||||
rm -r tests/allow-existing/both.pmtiles tests/allow-existing/both.dir.json.check tests/allow-existing/both.dir tests/allow-existing/both.mbtiles.json.check tests/allow-existing/both.mbtiles
|
||||
|
||||
csv-test:
|
||||
# Reading from named CSV
|
||||
|
||||
@@ -4,12 +4,9 @@ tippecanoe
|
||||
Builds [vector tilesets](https://github.com/mapbox/vector-tile-spec/) from large (or small) collections of [GeoJSON](http://geojson.org/), [FlatGeobuf](https://github.com/flatgeobuf/flatgeobuf), or [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) features,
|
||||
[like these](MADE_WITH.md).
|
||||
|
||||
This intends to be an actively maintained fork of [tippecanoe](https://github.com/mapbox/tippecanoe) originally developed by [Erica Fischer](https://github.com/e-n-f) at Mapbox. Version 2.0.0 is equivalent to [1.36.0](https://github.com/mapbox/tippecanoe/tree/1.36.0) in the original repository. Thank you Mapbox and Erica for an incredible tool!
|
||||
|
||||
Key features of this fork include:
|
||||
|
||||
* Support for [FlatGeobuf](https://github.com/flatgeobuf/flatgeobuf) input which is more compact and 5-10x faster than GeoJsonSeq input.
|
||||
This is the official home of Tippecanoe, developed and actively maintained by [Erica Fischer](https://github.com/e-n-f) at [Felt](https://felt.com).
|
||||
|
||||
Version 2.0.0 is equivalent to [1.36.0](https://github.com/mapbox/tippecanoe/tree/1.36.0) in the original repository. Thank you Mapbox for the many years of early support.
|
||||
|
||||
Intent
|
||||
------
|
||||
@@ -38,7 +35,7 @@ Installation
|
||||
For this fork you will need to build from the source repository:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/protomaps/tippecanoe.git
|
||||
$ git clone https://github.com/felt/tippecanoe.git
|
||||
$ cd tippecanoe
|
||||
$ make -j
|
||||
$ make install
|
||||
@@ -453,6 +450,8 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
|
||||
If you use `-Bg`, it will guess a zoom level that will keep at most 50,000 features in the densest tile.
|
||||
You can also specify a marker-width with `-Bg`*width* to allow fewer features in the densest tile to
|
||||
compensate for the larger marker, or `-Bf`*number* to allow at most *number* features in the densest tile.
|
||||
* `--drop-denser=`_percentage_: When dropping dots at zoom levels below the base zoom, give the specified _percentage_
|
||||
preference to retaining points in sparse areas and dropping points in dense areas.
|
||||
* `--limit-base-zoom-to-maximum-zoom` or `-Pb`: Limit the guessed base zoom not to exceed the maxzoom, even if this would put more than the requested number of features in a base zoom tile.
|
||||
* `-al` or `--drop-lines`: Let "dot" dropping at lower zooms apply to lines too
|
||||
* `-ap` or `--drop-polygons`: Let "dot" dropping at lower zooms apply to polygons too
|
||||
@@ -480,9 +479,11 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
|
||||
the line or polygon within one tile unit of its proper location. You can probably go up to about 10 without too much visible difference.
|
||||
* `-ps` or `--no-line-simplification`: Don't simplify lines and polygons
|
||||
* `-pS` or `--simplify-only-low-zooms`: Don't simplify lines and polygons at maxzoom (but do simplify at lower zooms)
|
||||
* `--simplification-at-maximum-zoom=`_scale_: Use the specified _scale_ at maxzoom instead of the standard simplification scale (which still applies at lower zooms)
|
||||
* `-pn` or `--no-simplification-of-shared-nodes`: Don't simplify away nodes that appear in more than one feature or are used multiple times within the same feature, so that the intersection node will not be lost from intersecting roads. (This will not be effective if you also use `--coalesce` or `--detect-shared-borders`.)
|
||||
* `-pt` or `--no-tiny-polygon-reduction`: Don't combine the area of very small polygons into small squares that represent their combined area.
|
||||
* `--tiny-polygon-size=`_size_: Use the specified _size_ for tiny polygons instead of the default 2. Anything above 6 or so will lead to visible artifacts with the default tile detail.
|
||||
* `-av` or `--visvalingam`: Use Visvalingam's simplification algorithm rather than Douglas-Peucker's.
|
||||
|
||||
### Attempts to improve shared polygon boundaries
|
||||
|
||||
@@ -504,6 +505,8 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
|
||||
* `-ah` or `--hilbert`: Put features in Hilbert Curve order instead of the usual Z-Order. This improves the odds that spatially adjacent features will be sequentially adjacent, and should improve density calculations and spatial coalescing. It should be the default eventually.
|
||||
* `--order-by=`_attribute_: Order features by the specified _attribute_, in alphabetical or numerical order. Multiple `--order-by` and `--order-descending-by` options may be specified, the first being the primary sort key.
|
||||
* `--order-descending-by=`_attribute_: Order features by the specified _attribute_, in reverse alphabetical or numerical order. Multiple `--order-by` and `--order-descending-by` options may be specified, the first being the primary sort key.
|
||||
* `--order-smallest-first`: Order features so the smallest geometry comes first in each tile. Multiple `--order-by` and `--order-descending-by` options may be specified, the first being the primary sort key.
|
||||
* `--order-largest-first`: Order features so the largest geometry comes first in each tile. Multiple `--order-by` and `--order-descending-by` options may be specified, the first being the primary sort key.
|
||||
|
||||
### Adding calculated attributes
|
||||
|
||||
@@ -516,11 +519,14 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
|
||||
* `-pw` or `--use-source-polygon-winding`: Instead of respecting GeoJSON polygon ring order, use the original polygon winding in the source data to distinguish inner (clockwise) and outer (counterclockwise) polygon rings.
|
||||
* `-pW` or `--reverse-source-polygon-winding`: Instead of respecting GeoJSON polygon ring order, use the opposite of the original polygon winding in the source data to distinguish inner (counterclockwise) and outer (clockwise) polygon rings.
|
||||
* `--clip-bounding-box=`*minlon*`,`*minlat*`,`*maxlon*`,`*maxlat*: Clip all features to the specified bounding box.
|
||||
* `-aP` or `--convert-polygons-to-label-points`: Replace polygon geometries with a label point or points for the polygon in each tile it intersects.
|
||||
|
||||
### Setting or disabling tile size limits
|
||||
|
||||
* `-M` _bytes_ or `--maximum-tile-bytes=`_bytes_: Use the specified number of _bytes_ as the maximum compressed tile size instead of 500K.
|
||||
* `-O` _features_ or `--maximum-tile-features=`_features_: Use the specified number of _features_ as the maximum in a tile instead of 200,000.
|
||||
* `--limit-tile-feature-count=`_features_: Abruptly limit each tile to the specified number of _features_, after ordering them if specified.
|
||||
* `--limit-tile-feature-count-at-maximum-zoom=`_features_: Abruptly limit each tile at the maximum zoom level to the specified number of _features_, after ordering them if specified.
|
||||
* `-pf` or `--no-feature-limit`: Don't limit tiles to 200,000 features
|
||||
* `-pk` or `--no-tile-size-limit`: Don't limit tiles to 500K bytes
|
||||
* `-pC` or `--no-tile-compression`: Don't compress the PBF vector tile data. If you are getting "Unimplemented type 3" error messages from a renderer, it is probably because it expects uncompressed tiles using this option rather than the normal gzip-compressed tiles.
|
||||
@@ -880,6 +886,8 @@ resolutions.
|
||||
* `-c` or `--tag-layer-and-zoom`: Include each feature's layer and zoom level as part of its `tippecanoe` object rather than as a FeatureCollection wrapper
|
||||
* `-S` or `--stats`: Just report statistics about each tile's size and the number of features in it, as a JSON structure.
|
||||
* `-f` or `--force`: Decode tiles even if polygon ring order or closure problems are detected
|
||||
* `-I` or `--integer`: Report coordinates in integer tile coordinates
|
||||
* `-F` or `--fraction`: Report coordinates as a fraction of the tile extent
|
||||
|
||||
tippecanoe-json-tool
|
||||
====================
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "csv.hpp"
|
||||
#include "text.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
std::vector<std::string> csv_split(const char *s) {
|
||||
std::vector<std::string> ret;
|
||||
@@ -68,7 +69,7 @@ void readcsv(const char *fn, std::vector<std::string> &header, std::map<std::str
|
||||
FILE *f = fopen(fn, "r");
|
||||
if (f == NULL) {
|
||||
perror(fn);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
std::string s;
|
||||
@@ -76,7 +77,7 @@ void readcsv(const char *fn, std::vector<std::string> &header, std::map<std::str
|
||||
std::string err = check_utf8(s);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s: %s\n", fn, err.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
|
||||
header = csv_split(s.c_str());
|
||||
@@ -89,7 +90,7 @@ void readcsv(const char *fn, std::vector<std::string> &header, std::map<std::str
|
||||
std::string err = check_utf8(s);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s: %s\n", fn, err.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
|
||||
std::vector<std::string> line = csv_split(s.c_str());
|
||||
@@ -105,7 +106,7 @@ void readcsv(const char *fn, std::vector<std::string> &header, std::map<std::str
|
||||
|
||||
if (fclose(f) != 0) {
|
||||
perror("fclose");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+122
-51
@@ -15,13 +15,15 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <protozero/pbf_reader.hpp>
|
||||
#include <sys/stat.h>
|
||||
#include "mvt.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include "write_json.hpp"
|
||||
#include "jsonpull/jsonpull.h"
|
||||
#include "mbtiles.hpp"
|
||||
#include "dirtiles.hpp"
|
||||
#include "pmtiles_file.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
int minzoom = 0;
|
||||
int maxzoom = 32;
|
||||
@@ -85,18 +87,18 @@ void do_stats(mvt_tile &tile, size_t size, bool compressed, int z, unsigned x, u
|
||||
state.json_write_newline();
|
||||
}
|
||||
|
||||
void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::string> const &to_decode, bool pipeline, bool stats, json_writer &state) {
|
||||
void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::string> const &to_decode, bool pipeline, bool stats, json_writer &state, int coordinate_mode) {
|
||||
mvt_tile tile;
|
||||
bool was_compressed;
|
||||
|
||||
try {
|
||||
if (!tile.decode(message, was_compressed)) {
|
||||
fprintf(stderr, "Couldn't parse tile %d/%u/%u\n", z, x, y);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MVT);
|
||||
}
|
||||
} catch (std::exception const &e) {
|
||||
fprintf(stderr, "PBF decoding error in tile %d/%u/%u\n", z, x, y);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PROTOBUF);
|
||||
}
|
||||
|
||||
if (stats) {
|
||||
@@ -159,7 +161,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::st
|
||||
|
||||
if (layer.extent <= 0) {
|
||||
fprintf(stderr, "Impossible layer extent %lld in mbtiles\n", layer.extent);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (to_decode.size() != 0 && !to_decode.count(layer.name)) {
|
||||
@@ -202,10 +204,16 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::st
|
||||
// X and Y are unsigned, so no need to check <0
|
||||
if (x > (1ULL << z) || y > (1ULL << z)) {
|
||||
fprintf(stderr, "Impossible tile %d/%u/%u\n", z, x, y);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
layer_to_geojson(layer, z, x, y, !pipeline, pipeline, pipeline, false, 0, 0, 0, !force, state);
|
||||
double scale = 0;
|
||||
if (coordinate_mode == 1) { // fraction
|
||||
scale = layer.extent;
|
||||
} else if (coordinate_mode == 2) { // integer
|
||||
scale = 1;
|
||||
}
|
||||
layer_to_geojson(layer, z, x, y, !pipeline, pipeline, pipeline, false, 0, 0, 0, !force, state, scale);
|
||||
|
||||
if (!pipeline) {
|
||||
if (true) {
|
||||
@@ -223,7 +231,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::st
|
||||
}
|
||||
}
|
||||
|
||||
void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> const &to_decode, bool pipeline, bool stats, std::set<std::string> const &exclude_meta) {
|
||||
void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> const &to_decode, bool pipeline, bool stats, std::set<std::string> const &exclude_meta, int coordinate_mode) {
|
||||
sqlite3 *db = NULL;
|
||||
bool isdir = false;
|
||||
int oz = z;
|
||||
@@ -237,15 +245,15 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
if (st.st_size < 50 * 1024 * 1024) {
|
||||
char *map = (char *) mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (map != NULL && map != MAP_FAILED) {
|
||||
if (strcmp(map, "SQLite format 3") != 0) {
|
||||
if (strcmp(map, "SQLite format 3") != 0 && strncmp(map, "PMTiles", 7) != 0) {
|
||||
if (z >= 0) {
|
||||
std::string s = std::string(map, st.st_size);
|
||||
handle(s, z, x, y, to_decode, pipeline, stats, state);
|
||||
handle(s, z, x, y, to_decode, pipeline, stats, state, coordinate_mode);
|
||||
munmap(map, st.st_size);
|
||||
return;
|
||||
} else {
|
||||
fprintf(stderr, "Must specify zoom/x/y to decode a single pbf file\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +264,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
}
|
||||
if (close(fd) != 0) {
|
||||
perror("close");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
} else {
|
||||
perror(fname);
|
||||
@@ -264,21 +272,40 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
|
||||
struct stat st;
|
||||
std::vector<zxy> tiles;
|
||||
|
||||
char *pmtiles_map;
|
||||
std::vector<pmtiles::entry_zxy> entries;
|
||||
bool is_pmtiles = false;
|
||||
|
||||
if (stat(fname, &st) == 0 && (st.st_mode & S_IFDIR) != 0) {
|
||||
isdir = true;
|
||||
|
||||
db = dirmeta2tmp(fname);
|
||||
tiles = enumerate_dirtiles(fname, minzoom, maxzoom);
|
||||
} else if (pmtiles_has_suffix(fname)) {
|
||||
int pmtiles_fd = open(fname, O_RDONLY | O_CLOEXEC);
|
||||
pmtiles_map = (char *) mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, pmtiles_fd, 0);
|
||||
if (pmtiles_map == MAP_FAILED) {
|
||||
perror("mmap in decode");
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
if (close(pmtiles_fd) != 0) {
|
||||
perror("close");
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
db = pmtilesmeta2tmp(fname, pmtiles_map);
|
||||
entries = pmtiles_entries_tms(pmtiles_map, minzoom, maxzoom);
|
||||
is_pmtiles = true;
|
||||
} else {
|
||||
if (sqlite3_open(fname, &db) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
char *err = NULL;
|
||||
if (sqlite3_exec(db, "PRAGMA integrity_check;", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: integrity_check: %s\n", fname, err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +326,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
sqlite3_stmt *stmt2;
|
||||
if (sqlite3_prepare_v2(db, sql2, -1, &stmt2, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
while (sqlite3_step(stmt2) == SQLITE_ROW) {
|
||||
@@ -308,7 +335,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
|
||||
if (name == NULL || value == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null metadata\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
if (exclude_meta.count((char *) name) == 0) {
|
||||
@@ -361,7 +388,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
FILE *f = fopen(fn.c_str(), "rb");
|
||||
if (f == NULL) {
|
||||
perror(fn.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
std::string s;
|
||||
@@ -372,14 +399,34 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
handle(s, tiles[i].z, tiles[i].x, tiles[i].y, to_decode, pipeline, stats, state);
|
||||
handle(s, tiles[i].z, tiles[i].x, tiles[i].y, to_decode, pipeline, stats, state, coordinate_mode);
|
||||
}
|
||||
} else if (is_pmtiles) {
|
||||
within = 0;
|
||||
|
||||
for (auto const &entry : entries) {
|
||||
if (!pipeline && !stats) {
|
||||
if (within) {
|
||||
state.json_comma_newline();
|
||||
}
|
||||
within = 1;
|
||||
}
|
||||
if (stats) {
|
||||
if (within) {
|
||||
state.json_comma_newline();
|
||||
}
|
||||
within = 1;
|
||||
}
|
||||
|
||||
std::string s{pmtiles_map + entry.offset, entry.length};
|
||||
handle(s, entry.z, entry.x, entry.y, to_decode, pipeline, stats, state, coordinate_mode);
|
||||
}
|
||||
} else {
|
||||
const char *sql = "SELECT tile_data, zoom_level, tile_column, tile_row from tiles where zoom_level between ? and ? order by zoom_level, tile_column, tile_row;";
|
||||
sqlite3_stmt *stmt;
|
||||
if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, minzoom);
|
||||
@@ -407,7 +454,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
|
||||
if (tz < 0 || tz >= 32) {
|
||||
fprintf(stderr, "Impossible zoom level %d in mbtiles\n", tz);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
ty = (1LL << tz) - 1 - ty;
|
||||
@@ -415,10 +462,10 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in tiles table\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
handle(std::string(s, len), tz, tx, ty, to_decode, pipeline, stats, state);
|
||||
handle(std::string(s, len), tz, tx, ty, to_decode, pipeline, stats, state, coordinate_mode);
|
||||
}
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
@@ -439,36 +486,49 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
} else {
|
||||
int handled = 0;
|
||||
while (z >= 0 && !handled) {
|
||||
const char *sql = "SELECT tile_data from tiles where zoom_level = ? and tile_column = ? and tile_row = ?;";
|
||||
sqlite3_stmt *stmt;
|
||||
if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, z);
|
||||
sqlite3_bind_int(stmt, 2, x);
|
||||
sqlite3_bind_int(stmt, 3, (1LL << z) - 1 - y);
|
||||
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
int len = sqlite3_column_bytes(stmt, 0);
|
||||
const char *s = (const char *) sqlite3_column_blob(stmt, 0);
|
||||
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in tiles table\n");
|
||||
exit(EXIT_FAILURE);
|
||||
if (is_pmtiles) {
|
||||
uint64_t tile_offset;
|
||||
uint32_t tile_length;
|
||||
std::tie(tile_offset, tile_length) = pmtiles_get_tile(pmtiles_map, z, x, y);
|
||||
if (tile_length > 0) {
|
||||
if (z != oz) {
|
||||
fprintf(stderr, "%s: Warning: using tile %d/%u/%u instead of %d/%u/%u\n", fname, z, x, y, oz, ox, oy);
|
||||
}
|
||||
std::string s{pmtiles_map + tile_offset, tile_length};
|
||||
handle(s, z, x, y, to_decode, pipeline, stats, state, coordinate_mode);
|
||||
handled = 1;
|
||||
}
|
||||
} else {
|
||||
const char *sql = "SELECT tile_data from tiles where zoom_level = ? and tile_column = ? and tile_row = ?;";
|
||||
sqlite3_stmt *stmt;
|
||||
if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
if (z != oz) {
|
||||
fprintf(stderr, "%s: Warning: using tile %d/%u/%u instead of %d/%u/%u\n", fname, z, x, y, oz, ox, oy);
|
||||
sqlite3_bind_int(stmt, 1, z);
|
||||
sqlite3_bind_int(stmt, 2, x);
|
||||
sqlite3_bind_int(stmt, 3, (1LL << z) - 1 - y);
|
||||
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
int len = sqlite3_column_bytes(stmt, 0);
|
||||
const char *s = (const char *) sqlite3_column_blob(stmt, 0);
|
||||
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in tiles table\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
if (z != oz) {
|
||||
fprintf(stderr, "%s: Warning: using tile %d/%u/%u instead of %d/%u/%u\n", fname, z, x, y, oz, ox, oy);
|
||||
}
|
||||
|
||||
handle(std::string(s, len), z, x, y, to_decode, pipeline, stats, state, coordinate_mode);
|
||||
handled = 1;
|
||||
}
|
||||
|
||||
handle(std::string(s, len), z, x, y, to_decode, pipeline, stats, state);
|
||||
handled = 1;
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
z--;
|
||||
x /= 2;
|
||||
y /= 2;
|
||||
@@ -477,13 +537,13 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
|
||||
if (sqlite3_close(db) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: could not close database: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
void usage(char **argv) {
|
||||
fprintf(stderr, "Usage: %s [-s projection] [-Z minzoom] [-z maxzoom] [-l layer ...] file.mbtiles [zoom x y]\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -494,9 +554,12 @@ int main(int argc, char **argv) {
|
||||
bool pipeline = false;
|
||||
bool stats = false;
|
||||
std::set<std::string> exclude_meta;
|
||||
int coordinate_mode = 0;
|
||||
|
||||
struct option long_options[] = {
|
||||
{"projection", required_argument, 0, 's'},
|
||||
{"fractional-coordinates", no_argument, 0, 'F'},
|
||||
{"integer-coordinates", no_argument, 0, 'I'},
|
||||
{"maximum-zoom", required_argument, 0, 'z'},
|
||||
{"minimum-zoom", required_argument, 0, 'Z'},
|
||||
{"layer", required_argument, 0, 'l'},
|
||||
@@ -527,6 +590,14 @@ int main(int argc, char **argv) {
|
||||
set_projection_or_exit(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
coordinate_mode = 1;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
coordinate_mode = 2;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
maxzoom = atoi(optarg);
|
||||
break;
|
||||
@@ -561,9 +632,9 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (argc == optind + 4) {
|
||||
decode(argv[optind], atoi(argv[optind + 1]), atoi(argv[optind + 2]), atoi(argv[optind + 3]), to_decode, pipeline, stats, exclude_meta);
|
||||
decode(argv[optind], atoi(argv[optind + 1]), atoi(argv[optind + 2]), atoi(argv[optind + 3]), to_decode, pipeline, stats, exclude_meta, coordinate_mode);
|
||||
} else if (argc == optind + 1) {
|
||||
decode(argv[optind], -1, -1, -1, to_decode, pipeline, stats, exclude_meta);
|
||||
decode(argv[optind], -1, -1, -1, to_decode, pipeline, stats, exclude_meta, coordinate_mode);
|
||||
} else {
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
+151
-13
@@ -11,7 +11,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sqlite3.h>
|
||||
#include "jsonpull/jsonpull.h"
|
||||
#include "mbtiles.hpp"
|
||||
#include "dirtiles.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "write_json.hpp"
|
||||
|
||||
std::string dir_read_tile(std::string base, struct zxy tile) {
|
||||
std::ifstream pbfFile(base + "/" + tile.path(), std::ios::in | std::ios::binary);
|
||||
@@ -23,24 +26,42 @@ std::string dir_read_tile(std::string base, struct zxy tile) {
|
||||
}
|
||||
|
||||
void dir_write_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf) {
|
||||
// Don't check mkdir error returns, since most of these calls to
|
||||
// mkdir will be creating directories that already exist.
|
||||
mkdir(outdir, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
std::string curdir(outdir);
|
||||
std::string slash("/");
|
||||
|
||||
std::string newdir = curdir + slash + std::to_string(z);
|
||||
mkdir(newdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
newdir = newdir + "/" + std::to_string(tx);
|
||||
mkdir(newdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
newdir = newdir + "/" + std::to_string(ty) + ".pbf";
|
||||
|
||||
struct stat st;
|
||||
if (stat(newdir.c_str(), &st) == 0) {
|
||||
fprintf(stderr, "Can't write tile to already existing %s\n", newdir.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
|
||||
std::ofstream pbfFile(newdir, std::ios::out | std::ios::binary);
|
||||
pbfFile.write(pbf.data(), pbf.size());
|
||||
pbfFile.close();
|
||||
FILE *fp = fopen(newdir.c_str(), "wb");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "%s: %s\n", newdir.c_str(), strerror(errno));
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
|
||||
if (fwrite(pbf.c_str(), sizeof(char), pbf.size(), fp) != pbf.size()) {
|
||||
fprintf(stderr, "%s: %s\n", newdir.c_str(), strerror(errno));
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
|
||||
if (fclose(fp) != 0) {
|
||||
fprintf(stderr, "%s: %s\n", newdir.c_str(), strerror(errno));
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
static bool numeric(const char *s) {
|
||||
@@ -75,7 +96,7 @@ void check_dir(const char *dir, char **argv, bool force, bool forcetable) {
|
||||
fprintf(stderr, "%s: Tileset \"%s\" already exists. You can use --force if you want to delete the old tileset.\n", argv[0], dir);
|
||||
fprintf(stderr, "%s: %s: file exists\n", argv[0], meta.c_str());
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,11 +114,11 @@ void check_dir(const char *dir, char **argv, bool force, bool forcetable) {
|
||||
if (force) {
|
||||
if (unlink(fn.c_str()) != 0) {
|
||||
perror(fn.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UNLINK);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%s: file exists\n", fn.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +137,7 @@ std::vector<zxy> enumerate_dirtiles(const char *fname, int minzoom, int maxzoom)
|
||||
DIR *d2 = opendir(z.c_str());
|
||||
if (d2 == NULL) {
|
||||
perror(z.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
struct dirent *dp2;
|
||||
@@ -128,7 +149,7 @@ std::vector<zxy> enumerate_dirtiles(const char *fname, int minzoom, int maxzoom)
|
||||
DIR *d3 = opendir(x.c_str());
|
||||
if (d3 == NULL) {
|
||||
perror(x.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
struct dirent *dp3;
|
||||
@@ -159,17 +180,65 @@ std::vector<zxy> enumerate_dirtiles(const char *fname, int minzoom, int maxzoom)
|
||||
return tiles;
|
||||
}
|
||||
|
||||
void dir_erase_zoom(const char *fname, int zoom) {
|
||||
DIR *d1 = opendir(fname);
|
||||
if (d1 != NULL) {
|
||||
struct dirent *dp;
|
||||
while ((dp = readdir(d1)) != NULL) {
|
||||
if (numeric(dp->d_name) && atoi(dp->d_name) == zoom) {
|
||||
std::string z = std::string(fname) + "/" + dp->d_name;
|
||||
|
||||
DIR *d2 = opendir(z.c_str());
|
||||
if (d2 == NULL) {
|
||||
perror(z.c_str());
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
struct dirent *dp2;
|
||||
while ((dp2 = readdir(d2)) != NULL) {
|
||||
if (numeric(dp2->d_name)) {
|
||||
std::string x = z + "/" + dp2->d_name;
|
||||
|
||||
DIR *d3 = opendir(x.c_str());
|
||||
if (d3 == NULL) {
|
||||
perror(x.c_str());
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
struct dirent *dp3;
|
||||
while ((dp3 = readdir(d3)) != NULL) {
|
||||
if (pbfname(dp3->d_name)) {
|
||||
std::string y = x + "/" + dp3->d_name;
|
||||
if (unlink(y.c_str()) != 0) {
|
||||
perror(y.c_str());
|
||||
exit(EXIT_UNLINK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir(d3);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(d2);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(d1);
|
||||
}
|
||||
}
|
||||
|
||||
sqlite3 *dirmeta2tmp(const char *fname) {
|
||||
sqlite3 *db;
|
||||
char *err = NULL;
|
||||
|
||||
if (sqlite3_open("", &db) != SQLITE_OK) {
|
||||
fprintf(stderr, "Temporary db: %s\n", sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_exec(db, "CREATE TABLE metadata (name text, value text);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "Create metadata table: %s\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
std::string name = fname;
|
||||
@@ -183,12 +252,12 @@ sqlite3 *dirmeta2tmp(const char *fname) {
|
||||
json_object *o = json_read_tree(jp);
|
||||
if (o == NULL) {
|
||||
fprintf(stderr, "%s: metadata parsing error: %s\n", name.c_str(), jp->error);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
if (o->type != JSON_HASH) {
|
||||
fprintf(stderr, "%s: bad metadata format\n", name.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < o->value.object.length; i++) {
|
||||
@@ -209,3 +278,72 @@ sqlite3 *dirmeta2tmp(const char *fname) {
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
static void out(json_writer &state, std::string k, std::string v) {
|
||||
state.json_comma_newline();
|
||||
state.json_write_string(k);
|
||||
state.json_write_string(v);
|
||||
}
|
||||
|
||||
void dir_write_metadata(const char *outdir, const metadata &m) {
|
||||
std::string metadata = std::string(outdir) + "/metadata.json";
|
||||
|
||||
struct stat st;
|
||||
if (stat(metadata.c_str(), &st) == 0) {
|
||||
// Leave existing metadata in place with --allow-existing
|
||||
} else {
|
||||
FILE *fp = fopen(metadata.c_str(), "w");
|
||||
if (fp == NULL) {
|
||||
perror(metadata.c_str());
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
json_writer state(fp);
|
||||
|
||||
state.json_write_hash();
|
||||
state.json_write_newline();
|
||||
|
||||
out(state, "name", m.name);
|
||||
out(state, "description", m.description);
|
||||
out(state, "version", std::to_string(m.version));
|
||||
out(state, "minzoom", std::to_string(m.minzoom));
|
||||
out(state, "maxzoom", std::to_string(m.maxzoom));
|
||||
out(state, "center", std::to_string(m.center_lon) + "," + std::to_string(m.center_lat) + "," + std::to_string(m.center_z));
|
||||
out(state, "bounds", std::to_string(m.minlon) + "," + std::to_string(m.minlat) + "," + std::to_string(m.maxlon) + "," + std::to_string(m.maxlat));
|
||||
out(state, "type", m.type);
|
||||
if (m.attribution.size() > 0) {
|
||||
out(state, "attribution", m.attribution);
|
||||
}
|
||||
if (m.strategies_json.size() > 0) {
|
||||
out(state, "strategies", m.strategies_json);
|
||||
}
|
||||
out(state, "format", m.format);
|
||||
out(state, "generator", m.generator);
|
||||
out(state, "generator_options", m.generator_options);
|
||||
|
||||
if (m.vector_layers_json.size() > 0 || m.tilestats_json.size() > 0) {
|
||||
std::string json = "{";
|
||||
|
||||
if (m.vector_layers_json.size() > 0) {
|
||||
json += "\"vector_layers\":" + m.vector_layers_json;
|
||||
|
||||
if (m.tilestats_json.size() > 0) {
|
||||
json += ",\"tilestats\":" + m.tilestats_json;
|
||||
}
|
||||
} else {
|
||||
if (m.tilestats_json.size() > 0) {
|
||||
json += "\"tilestats\":" + m.tilestats_json;
|
||||
}
|
||||
}
|
||||
|
||||
json += "}";
|
||||
|
||||
out(state, "json", json);
|
||||
}
|
||||
|
||||
state.json_write_newline();
|
||||
state.json_end_hash();
|
||||
state.json_write_newline();
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#define DIRTILES_HPP
|
||||
|
||||
void dir_write_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf);
|
||||
void dir_erase_zoom(const char *outdir, int z);
|
||||
void dir_write_metadata(const char *outdir, const metadata &m);
|
||||
|
||||
void check_dir(const char *d, char **argv, bool force, bool forcetable);
|
||||
|
||||
|
||||
+7
-6
@@ -2,19 +2,20 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sqlite3.h>
|
||||
#include "errors.hpp"
|
||||
|
||||
void enumerate(char *fname) {
|
||||
sqlite3 *db;
|
||||
|
||||
if (sqlite3_open(fname, &db) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
char *err = NULL;
|
||||
if (sqlite3_exec(db, "PRAGMA integrity_check;", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: integrity_check: %s\n", fname, err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
const char *sql = "SELECT zoom_level, tile_column, tile_row from tiles order by zoom_level, tile_column, tile_row;";
|
||||
@@ -22,7 +23,7 @@ void enumerate(char *fname) {
|
||||
sqlite3_stmt *stmt;
|
||||
if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
@@ -32,7 +33,7 @@ void enumerate(char *fname) {
|
||||
|
||||
if (zoom < 0 || zoom > 31) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: impossible zoom level %lld\n", zoom);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
y = (1LL << zoom) - 1 - y;
|
||||
@@ -43,13 +44,13 @@ void enumerate(char *fname) {
|
||||
|
||||
if (sqlite3_close(db) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: could not close database: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
void usage(char **argv) {
|
||||
fprintf(stderr, "Usage: %s file.mbtiles ...\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#define EXIT_INCOMPLETE 100
|
||||
#define EXIT_ARGS 101
|
||||
#define EXIT_CLOSE 102
|
||||
#define EXIT_CSV 103
|
||||
#define EXIT_EXISTS 104
|
||||
#define EXIT_FILTER 105
|
||||
#define EXIT_IMPOSSIBLE 106
|
||||
#define EXIT_JSON 107
|
||||
#define EXIT_MEMORY 108
|
||||
#define EXIT_MVT 109
|
||||
#define EXIT_NODATA 110
|
||||
#define EXIT_OPEN 111
|
||||
#define EXIT_PROTOBUF 112
|
||||
#define EXIT_PTHREAD 113
|
||||
#define EXIT_READ 114
|
||||
#define EXIT_SEEK 115
|
||||
#define EXIT_SQLITE 116
|
||||
#define EXIT_STAT 117
|
||||
#define EXIT_UNLINK 118
|
||||
#define EXIT_UTF8 119
|
||||
#define EXIT_WRITE 120
|
||||
|
||||
// avoid 124, 125, 126, 127, 137, which are used by GNU timeout
|
||||
+23
-22
@@ -4,6 +4,7 @@
|
||||
#include <map>
|
||||
#include "mvt.hpp"
|
||||
#include "evaluator.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
int compare(mvt_value one, json_object *two, bool &fail) {
|
||||
if (one.type == mvt_string) {
|
||||
@@ -34,7 +35,7 @@ int compare(mvt_value one, json_object *two, bool &fail) {
|
||||
v = one.numeric_value.sint_value;
|
||||
} else {
|
||||
fprintf(stderr, "Internal error: bad mvt type %d\n", one.type);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (v < two->value.number.number) {
|
||||
@@ -66,36 +67,36 @@ int compare(mvt_value one, json_object *two, bool &fail) {
|
||||
}
|
||||
|
||||
fprintf(stderr, "Internal error: bad mvt type %d\n", one.type);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::set<std::string> &exclude_attributes) {
|
||||
if (f == NULL || f->type != JSON_ARRAY) {
|
||||
fprintf(stderr, "Filter is not an array: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
if (f->value.array.length < 1) {
|
||||
fprintf(stderr, "Array too small in filter: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
if (f->value.array.array[0]->type != JSON_STRING) {
|
||||
fprintf(stderr, "Filter operation is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "has") == 0 ||
|
||||
strcmp(f->value.array.array[0]->value.string.string, "!has") == 0) {
|
||||
if (f->value.array.length != 2) {
|
||||
fprintf(stderr, "Wrong number of array elements in filter: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "has") == 0) {
|
||||
if (f->value.array.array[1]->type != JSON_STRING) {
|
||||
fprintf(stderr, "\"has\" key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
return feature.count(std::string(f->value.array.array[1]->value.string.string)) != 0;
|
||||
}
|
||||
@@ -103,7 +104,7 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "!has") == 0) {
|
||||
if (f->value.array.array[1]->type != JSON_STRING) {
|
||||
fprintf(stderr, "\"!has\" key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
return feature.count(std::string(f->value.array.array[1]->value.string.string)) == 0;
|
||||
}
|
||||
@@ -117,11 +118,11 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
strcmp(f->value.array.array[0]->value.string.string, "<=") == 0) {
|
||||
if (f->value.array.length != 3) {
|
||||
fprintf(stderr, "Wrong number of array elements in filter: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
if (f->value.array.array[1]->type != JSON_STRING) {
|
||||
fprintf(stderr, "\"!has\" key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
fprintf(stderr, "comparison key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
auto ff = feature.find(std::string(f->value.array.array[1]->value.string.string));
|
||||
@@ -176,7 +177,7 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
}
|
||||
|
||||
fprintf(stderr, "Internal error: can't happen: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "all") == 0 ||
|
||||
@@ -217,12 +218,12 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
strcmp(f->value.array.array[0]->value.string.string, "!in") == 0) {
|
||||
if (f->value.array.length < 2) {
|
||||
fprintf(stderr, "Array too small in filter: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
if (f->value.array.array[1]->type != JSON_STRING) {
|
||||
fprintf(stderr, "\"!has\" key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
fprintf(stderr, "\"!in\" key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
auto ff = feature.find(std::string(f->value.array.array[1]->value.string.string));
|
||||
@@ -272,12 +273,12 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "attribute-filter") == 0) {
|
||||
if (f->value.array.length != 3) {
|
||||
fprintf(stderr, "Wrong number of array elements in filter: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
if (f->value.array.array[1]->type != JSON_STRING) {
|
||||
fprintf(stderr, "\"attribute-filter\" key is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
bool ok = eval(feature, f->value.array.array[2], exclude_attributes);
|
||||
@@ -289,13 +290,13 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
}
|
||||
|
||||
fprintf(stderr, "Unknown filter %s\n", json_stringify(f));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
bool evaluate(std::map<std::string, mvt_value> const &feature, std::string const &layer, json_object *filter, std::set<std::string> &exclude_attributes) {
|
||||
if (filter == NULL || filter->type != JSON_HASH) {
|
||||
fprintf(stderr, "Error: filter is not a hash: %s\n", json_stringify(filter));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
@@ -318,14 +319,14 @@ json_object *read_filter(const char *fname) {
|
||||
FILE *fp = fopen(fname, "r");
|
||||
if (fp == NULL) {
|
||||
perror(fname);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
json_pull *jp = json_begin_file(fp);
|
||||
json_object *filter = json_read_tree(jp);
|
||||
if (filter == NULL) {
|
||||
fprintf(stderr, "%s: %s\n", fname, jp->error);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
json_disconnect(filter);
|
||||
json_end(jp);
|
||||
@@ -339,7 +340,7 @@ json_object *parse_filter(const char *s) {
|
||||
if (filter == NULL) {
|
||||
fprintf(stderr, "Could not parse filter %s\n", s);
|
||||
fprintf(stderr, "%s\n", jp->error);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
json_disconnect(filter);
|
||||
json_end(jp);
|
||||
|
||||
+28
-16
@@ -138,9 +138,9 @@
|
||||
#endif
|
||||
#endif // !defined(FLATBUFFERS_LITTLEENDIAN)
|
||||
|
||||
#define FLATBUFFERS_VERSION_MAJOR 2
|
||||
#define FLATBUFFERS_VERSION_MINOR 0
|
||||
#define FLATBUFFERS_VERSION_REVISION 5
|
||||
#define FLATBUFFERS_VERSION_MAJOR 22
|
||||
#define FLATBUFFERS_VERSION_MINOR 9
|
||||
#define FLATBUFFERS_VERSION_REVISION 29
|
||||
#define FLATBUFFERS_STRING_EXPAND(X) #X
|
||||
#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X)
|
||||
namespace flatbuffers {
|
||||
@@ -260,9 +260,12 @@ namespace flatbuffers {
|
||||
#endif // !FLATBUFFERS_HAS_NEW_STRTOD
|
||||
|
||||
#ifndef FLATBUFFERS_LOCALE_INDEPENDENT
|
||||
// Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}.
|
||||
#if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \
|
||||
(defined(_XOPEN_VERSION) && (_XOPEN_VERSION>=700)) && (!defined(__ANDROID_API__) || (defined(__ANDROID_API__) && (__ANDROID_API__>=21))))
|
||||
// Enable locale independent functions {strtof_l, strtod_l,strtoll_l,
|
||||
// strtoull_l}.
|
||||
#if (defined(_MSC_VER) && _MSC_VER >= 1800) || \
|
||||
(defined(__ANDROID_API__) && __ANDROID_API__>= 21) || \
|
||||
(defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 700)) && \
|
||||
(!defined(__Fuchsia__) && !defined(__ANDROID_API__))
|
||||
#define FLATBUFFERS_LOCALE_INDEPENDENT 1
|
||||
#else
|
||||
#define FLATBUFFERS_LOCALE_INDEPENDENT 0
|
||||
@@ -270,14 +273,14 @@ namespace flatbuffers {
|
||||
#endif // !FLATBUFFERS_LOCALE_INDEPENDENT
|
||||
|
||||
// Suppress Undefined Behavior Sanitizer (recoverable only). Usage:
|
||||
// - __supress_ubsan__("undefined")
|
||||
// - __supress_ubsan__("signed-integer-overflow")
|
||||
// - __suppress_ubsan__("undefined")
|
||||
// - __suppress_ubsan__("signed-integer-overflow")
|
||||
#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))
|
||||
#define __supress_ubsan__(type) __attribute__((no_sanitize(type)))
|
||||
#define __suppress_ubsan__(type) __attribute__((no_sanitize(type)))
|
||||
#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)
|
||||
#define __supress_ubsan__(type) __attribute__((no_sanitize_undefined))
|
||||
#define __suppress_ubsan__(type) __attribute__((no_sanitize_undefined))
|
||||
#else
|
||||
#define __supress_ubsan__(type)
|
||||
#define __suppress_ubsan__(type)
|
||||
#endif
|
||||
|
||||
// This is constexpr function used for checking compile-time constants.
|
||||
@@ -328,8 +331,17 @@ typedef uintmax_t largest_scalar_t;
|
||||
// In 32bits, this evaluates to 2GB - 1
|
||||
#define FLATBUFFERS_MAX_BUFFER_SIZE ((1ULL << (sizeof(::flatbuffers::soffset_t) * 8 - 1)) - 1)
|
||||
|
||||
// The minimum size buffer that can be a valid flatbuffer.
|
||||
// Includes the offset to the root table (uoffset_t), the offset to the vtable
|
||||
// of the root table (soffset_t), the size of the vtable (uint16_t), and the
|
||||
// size of the referring table (uint16_t).
|
||||
#define FLATBUFFERS_MIN_BUFFER_SIZE sizeof(uoffset_t) + sizeof(soffset_t) + \
|
||||
sizeof(uint16_t) + sizeof(uint16_t)
|
||||
|
||||
// We support aligning the contents of buffers up to this size.
|
||||
#define FLATBUFFERS_MAX_ALIGNMENT 16
|
||||
#ifndef FLATBUFFERS_MAX_ALIGNMENT
|
||||
#define FLATBUFFERS_MAX_ALIGNMENT 32
|
||||
#endif
|
||||
|
||||
/// @brief The length of a FlatBuffer file header.
|
||||
static const size_t kFileIdentifierLength = 4;
|
||||
@@ -401,7 +413,7 @@ template<typename T> T EndianScalar(T t) {
|
||||
|
||||
template<typename T>
|
||||
// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
|
||||
__supress_ubsan__("alignment")
|
||||
__suppress_ubsan__("alignment")
|
||||
T ReadScalar(const void *p) {
|
||||
return EndianScalar(*reinterpret_cast<const T *>(p));
|
||||
}
|
||||
@@ -415,13 +427,13 @@ T ReadScalar(const void *p) {
|
||||
|
||||
template<typename T>
|
||||
// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
|
||||
__supress_ubsan__("alignment")
|
||||
__suppress_ubsan__("alignment")
|
||||
void WriteScalar(void *p, T t) {
|
||||
*reinterpret_cast<T *>(p) = EndianScalar(t);
|
||||
}
|
||||
|
||||
template<typename T> struct Offset;
|
||||
template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Offset<T> t) {
|
||||
template<typename T> __suppress_ubsan__("alignment") void WriteScalar(void *p, Offset<T> t) {
|
||||
*reinterpret_cast<uoffset_t *>(p) = EndianScalar(t.o);
|
||||
}
|
||||
|
||||
@@ -432,7 +444,7 @@ template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Of
|
||||
// Computes how many bytes you'd have to pad to be able to write an
|
||||
// "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in
|
||||
// memory).
|
||||
__supress_ubsan__("unsigned-integer-overflow")
|
||||
__suppress_ubsan__("unsigned-integer-overflow")
|
||||
inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) {
|
||||
return ((~buf_size) + 1) & (scalar_size - 1);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ template<typename T> struct IndirectHelper<const T *> {
|
||||
}
|
||||
};
|
||||
|
||||
/// @brief Get a pointer to the the file_identifier section of the buffer.
|
||||
/// @brief Get a pointer to the file_identifier section of the buffer.
|
||||
/// @return Returns a const char pointer to the start of the file_identifier
|
||||
/// characters in the buffer. The returned char * has length
|
||||
/// 'flatbuffers::FlatBufferBuilder::kFileIdentifierLength'.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define FLATBUFFERS_FLATBUFFER_BUILDER_H_
|
||||
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
|
||||
#include "flatbuffers/allocator.h"
|
||||
#include "flatbuffers/array.h"
|
||||
@@ -42,14 +43,15 @@ inline voffset_t FieldIndexToOffset(voffset_t field_id) {
|
||||
return static_cast<voffset_t>((field_id + fixed_fields) * sizeof(voffset_t));
|
||||
}
|
||||
|
||||
template<typename T, typename Alloc>
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
const T *data(const std::vector<T, Alloc> &v) {
|
||||
// Eventually the returned pointer gets passed down to memcpy, so
|
||||
// we need it to be non-null to avoid undefined behavior.
|
||||
static uint8_t t;
|
||||
return v.empty() ? reinterpret_cast<const T *>(&t) : &v.front();
|
||||
}
|
||||
template<typename T, typename Alloc> T *data(std::vector<T, Alloc> &v) {
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
T *data(std::vector<T, Alloc> &v) {
|
||||
// Eventually the returned pointer gets passed down to memcpy, so
|
||||
// we need it to be non-null to avoid undefined behavior.
|
||||
static uint8_t t;
|
||||
@@ -285,9 +287,7 @@ class FlatBufferBuilder {
|
||||
FieldLoc fl = { off, field };
|
||||
buf_.scratch_push_small(fl);
|
||||
num_field_loc++;
|
||||
if (field > max_voffset_) {
|
||||
max_voffset_ = field;
|
||||
}
|
||||
if (field > max_voffset_) { max_voffset_ = field; }
|
||||
}
|
||||
|
||||
// Like PushElement, but additionally tracks the field this represents.
|
||||
@@ -358,7 +358,7 @@ class FlatBufferBuilder {
|
||||
// If you get this assert, a corresponding StartTable wasn't called.
|
||||
FLATBUFFERS_ASSERT(nested);
|
||||
// Write the vtable offset, which is the start of any Table.
|
||||
// We fill it's value later.
|
||||
// We fill its value later.
|
||||
auto vtableoffsetloc = PushElement<soffset_t>(0);
|
||||
// Write a vtable, which consists entirely of voffset_t elements.
|
||||
// It starts with the number of offsets, followed by a type id, followed
|
||||
@@ -443,12 +443,13 @@ class FlatBufferBuilder {
|
||||
// Aligns such that when "len" bytes are written, an object can be written
|
||||
// after it with "alignment" without padding.
|
||||
void PreAlign(size_t len, size_t alignment) {
|
||||
if (len == 0) return;
|
||||
TrackMinAlign(alignment);
|
||||
buf_.fill(PaddingBytes(GetSize() + len, alignment));
|
||||
}
|
||||
template<typename T> void PreAlign(size_t len) {
|
||||
AssertScalarT<T>();
|
||||
PreAlign(len, sizeof(T));
|
||||
PreAlign(len, AlignOf<T>());
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
@@ -578,7 +579,7 @@ class FlatBufferBuilder {
|
||||
/// @param[in] str A const pointer to a `String` struct to add to the buffer.
|
||||
/// @return Returns the offset in the buffer where the string starts
|
||||
Offset<String> CreateSharedString(const String *str) {
|
||||
return CreateSharedString(str->c_str(), str->size());
|
||||
return str ? CreateSharedString(str->c_str(), str->size()) : 0;
|
||||
}
|
||||
|
||||
/// @cond FLATBUFFERS_INTERNAL
|
||||
@@ -588,11 +589,15 @@ class FlatBufferBuilder {
|
||||
return PushElement(static_cast<uoffset_t>(len));
|
||||
}
|
||||
|
||||
void StartVector(size_t len, size_t elemsize) {
|
||||
void StartVector(size_t len, size_t elemsize, size_t alignment) {
|
||||
NotNested();
|
||||
nested = true;
|
||||
PreAlign<uoffset_t>(len * elemsize);
|
||||
PreAlign(len * elemsize, elemsize); // Just in case elemsize > uoffset_t.
|
||||
PreAlign(len * elemsize, alignment); // Just in case elemsize > uoffset_t.
|
||||
}
|
||||
|
||||
template<typename T> void StartVector(size_t len) {
|
||||
return StartVector(len, sizeof(T), AlignOf<T>());
|
||||
}
|
||||
|
||||
// Call this right before StartVector/CreateVector if you want to force the
|
||||
@@ -601,12 +606,14 @@ class FlatBufferBuilder {
|
||||
// This is useful when storing a nested_flatbuffer in a vector of bytes,
|
||||
// or when storing SIMD floats, etc.
|
||||
void ForceVectorAlignment(size_t len, size_t elemsize, size_t alignment) {
|
||||
if (len == 0) return;
|
||||
FLATBUFFERS_ASSERT(VerifyAlignmentRequirements(alignment));
|
||||
PreAlign(len * elemsize, alignment);
|
||||
}
|
||||
|
||||
// Similar to ForceVectorAlignment but for String fields.
|
||||
void ForceStringAlignment(size_t len, size_t alignment) {
|
||||
if (len == 0) return;
|
||||
FLATBUFFERS_ASSERT(VerifyAlignmentRequirements(alignment));
|
||||
PreAlign((len + 1) * sizeof(char), alignment);
|
||||
}
|
||||
@@ -624,7 +631,7 @@ class FlatBufferBuilder {
|
||||
// If this assert hits, you're specifying a template argument that is
|
||||
// causing the wrong overload to be selected, remove it.
|
||||
AssertScalarT<T>();
|
||||
StartVector(len, sizeof(T));
|
||||
StartVector<T>(len);
|
||||
if (len == 0) { return Offset<Vector<T>>(EndVector(len)); }
|
||||
// clang-format off
|
||||
#if FLATBUFFERS_LITTLEENDIAN
|
||||
@@ -642,9 +649,30 @@ class FlatBufferBuilder {
|
||||
return Offset<Vector<T>>(EndVector(len));
|
||||
}
|
||||
|
||||
/// @brief Serialize an array like object into a FlatBuffer `vector`.
|
||||
/// @tparam T The data type of the array elements.
|
||||
/// @tparam C The type of the array.
|
||||
/// @param[in] array A reference to an array like object of type `T` to
|
||||
/// serialize into the buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, class C> Offset<Vector<T>> CreateVector(const C &array) {
|
||||
return CreateVector(array.data(), array.size());
|
||||
}
|
||||
|
||||
/// @brief Serialize an initializer list into a FlatBuffer `vector`.
|
||||
/// @tparam T The data type of the initializer list elements.
|
||||
/// @param[in] v The value of the initializer list.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T>
|
||||
Offset<Vector<T>> CreateVector(std::initializer_list<T> v) {
|
||||
return CreateVector(v.begin(), v.size());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Offset<Vector<Offset<T>>> CreateVector(const Offset<T> *v, size_t len) {
|
||||
StartVector(len, sizeof(Offset<T>));
|
||||
StartVector<Offset<T>>(len);
|
||||
for (auto i = len; i > 0;) { PushElement(v[--i]); }
|
||||
return Offset<Vector<Offset<T>>>(EndVector(len));
|
||||
}
|
||||
@@ -655,7 +683,7 @@ class FlatBufferBuilder {
|
||||
/// buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename Alloc>
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
Offset<Vector<T>> CreateVector(const std::vector<T, Alloc> &v) {
|
||||
return CreateVector(data(v), v.size());
|
||||
}
|
||||
@@ -664,7 +692,7 @@ class FlatBufferBuilder {
|
||||
// an array. Instead, read elements manually.
|
||||
// Background: https://isocpp.org/blog/2012/11/on-vectorbool
|
||||
Offset<Vector<uint8_t>> CreateVector(const std::vector<bool> &v) {
|
||||
StartVector(v.size(), sizeof(uint8_t));
|
||||
StartVector<uint8_t>(v.size());
|
||||
for (auto i = v.size(); i > 0;) {
|
||||
PushElement(static_cast<uint8_t>(v[--i]));
|
||||
}
|
||||
@@ -706,21 +734,24 @@ class FlatBufferBuilder {
|
||||
return CreateVector(elems);
|
||||
}
|
||||
|
||||
/// @brief Serialize a `std::vector<std::string>` into a FlatBuffer `vector`.
|
||||
/// @brief Serialize a `std::vector<StringType>` into a FlatBuffer `vector`.
|
||||
/// whereas StringType is any type that is accepted by the CreateString()
|
||||
/// overloads.
|
||||
/// This is a convenience function for a common case.
|
||||
/// @param v A const reference to the `std::vector` to serialize into the
|
||||
/// buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename Alloc>
|
||||
template<typename StringType = std::string,
|
||||
typename Alloc = std::allocator<StringType>>
|
||||
Offset<Vector<Offset<String>>> CreateVectorOfStrings(
|
||||
const std::vector<std::string, Alloc> &v) {
|
||||
const std::vector<StringType, Alloc> &v) {
|
||||
return CreateVectorOfStrings(v.cbegin(), v.cend());
|
||||
}
|
||||
|
||||
/// @brief Serialize a collection of Strings into a FlatBuffer `vector`.
|
||||
/// This is a convenience function for a common case.
|
||||
/// @param begin The begining iterator of the collection
|
||||
/// @param begin The beginning iterator of the collection
|
||||
/// @param end The ending iterator of the collection
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
@@ -730,12 +761,12 @@ class FlatBufferBuilder {
|
||||
auto scratch_buffer_usage = size * sizeof(Offset<String>);
|
||||
// If there is not enough space to store the offsets, there definitely won't
|
||||
// be enough space to store all the strings. So ensuring space for the
|
||||
// scratch region is OK, for it it fails, it would have failed later.
|
||||
// scratch region is OK, for if it fails, it would have failed later.
|
||||
buf_.ensure_space(scratch_buffer_usage);
|
||||
for (auto it = begin; it != end; ++it) {
|
||||
buf_.scratch_push_small(CreateString(*it));
|
||||
}
|
||||
StartVector(size, sizeof(Offset<String>));
|
||||
StartVector<Offset<String>>(size);
|
||||
for (auto i = 1; i <= size; i++) {
|
||||
// Note we re-evaluate the buf location each iteration to account for any
|
||||
// underlying buffer resizing that may occur.
|
||||
@@ -755,7 +786,7 @@ class FlatBufferBuilder {
|
||||
/// where the vector is stored.
|
||||
template<typename T>
|
||||
Offset<Vector<const T *>> CreateVectorOfStructs(const T *v, size_t len) {
|
||||
StartVector(len * sizeof(T) / AlignOf<T>(), AlignOf<T>());
|
||||
StartVector(len * sizeof(T) / AlignOf<T>(), sizeof(T), AlignOf<T>());
|
||||
if (len > 0) {
|
||||
PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
|
||||
}
|
||||
@@ -841,7 +872,7 @@ class FlatBufferBuilder {
|
||||
/// serialize into the buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename Alloc>
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
Offset<Vector<const T *>> CreateVectorOfStructs(
|
||||
const std::vector<T, Alloc> &v) {
|
||||
return CreateVectorOfStructs(data(v), v.size());
|
||||
@@ -857,7 +888,7 @@ class FlatBufferBuilder {
|
||||
/// to the FlatBuffer struct.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename S, typename Alloc>
|
||||
template<typename T, typename S, typename Alloc = std::allocator<T>>
|
||||
Offset<Vector<const T *>> CreateVectorOfNativeStructs(
|
||||
const std::vector<S, Alloc> &v, T (*const pack_func)(const S &)) {
|
||||
return CreateVectorOfNativeStructs<T, S>(data(v), v.size(), pack_func);
|
||||
@@ -871,7 +902,7 @@ class FlatBufferBuilder {
|
||||
/// serialize into the buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename S, typename Alloc>
|
||||
template<typename T, typename S, typename Alloc = std::allocator<S>>
|
||||
Offset<Vector<const T *>> CreateVectorOfNativeStructs(
|
||||
const std::vector<S, Alloc> &v) {
|
||||
return CreateVectorOfNativeStructs<T, S>(data(v), v.size());
|
||||
@@ -892,7 +923,7 @@ class FlatBufferBuilder {
|
||||
/// serialize into the buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename Alloc>
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
Offset<Vector<const T *>> CreateVectorOfSortedStructs(
|
||||
std::vector<T, Alloc> *v) {
|
||||
return CreateVectorOfSortedStructs(data(*v), v->size());
|
||||
@@ -906,7 +937,7 @@ class FlatBufferBuilder {
|
||||
/// serialize into the buffer as a `vector`.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename S, typename Alloc>
|
||||
template<typename T, typename S, typename Alloc = std::allocator<T>>
|
||||
Offset<Vector<const T *>> CreateVectorOfSortedNativeStructs(
|
||||
std::vector<S, Alloc> *v) {
|
||||
return CreateVectorOfSortedNativeStructs<T, S>(data(*v), v->size());
|
||||
@@ -922,7 +953,7 @@ class FlatBufferBuilder {
|
||||
/// where the vector is stored.
|
||||
template<typename T>
|
||||
Offset<Vector<const T *>> CreateVectorOfSortedStructs(T *v, size_t len) {
|
||||
std::sort(v, v + len, StructKeyComparator<T>());
|
||||
std::stable_sort(v, v + len, StructKeyComparator<T>());
|
||||
return CreateVectorOfStructs(v, len);
|
||||
}
|
||||
|
||||
@@ -941,7 +972,7 @@ class FlatBufferBuilder {
|
||||
extern T Pack(const S &);
|
||||
auto structs = StartVectorOfStructs<T>(len);
|
||||
for (size_t i = 0; i < len; i++) { structs[i] = Pack(v[i]); }
|
||||
std::sort(structs, structs + len, StructKeyComparator<T>());
|
||||
std::stable_sort(structs, structs + len, StructKeyComparator<T>());
|
||||
return EndVectorOfStructs<T>(len);
|
||||
}
|
||||
|
||||
@@ -973,7 +1004,7 @@ class FlatBufferBuilder {
|
||||
template<typename T>
|
||||
Offset<Vector<Offset<T>>> CreateVectorOfSortedTables(Offset<T> *v,
|
||||
size_t len) {
|
||||
std::sort(v, v + len, TableKeyComparator<T>(buf_));
|
||||
std::stable_sort(v, v + len, TableKeyComparator<T>(buf_));
|
||||
return CreateVector(v, len);
|
||||
}
|
||||
|
||||
@@ -984,7 +1015,7 @@ class FlatBufferBuilder {
|
||||
/// offsets to store in the buffer in sorted order.
|
||||
/// @return Returns a typed `Offset` into the serialized data indicating
|
||||
/// where the vector is stored.
|
||||
template<typename T, typename Alloc>
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
Offset<Vector<Offset<T>>> CreateVectorOfSortedTables(
|
||||
std::vector<Offset<T>, Alloc> *v) {
|
||||
return CreateVectorOfSortedTables(data(*v), v->size());
|
||||
@@ -998,9 +1029,9 @@ class FlatBufferBuilder {
|
||||
/// written to at a later time to serialize the data into a `vector`
|
||||
/// in the buffer.
|
||||
uoffset_t CreateUninitializedVector(size_t len, size_t elemsize,
|
||||
uint8_t **buf) {
|
||||
size_t alignment, uint8_t **buf) {
|
||||
NotNested();
|
||||
StartVector(len, elemsize);
|
||||
StartVector(len, elemsize, alignment);
|
||||
buf_.make_space(len * elemsize);
|
||||
auto vec_start = GetSize();
|
||||
auto vec_end = EndVector(len);
|
||||
@@ -1008,6 +1039,12 @@ class FlatBufferBuilder {
|
||||
return vec_end;
|
||||
}
|
||||
|
||||
FLATBUFFERS_ATTRIBUTE([[deprecated("call the version above instead")]])
|
||||
uoffset_t CreateUninitializedVector(size_t len, size_t elemsize,
|
||||
uint8_t **buf) {
|
||||
return CreateUninitializedVector(len, elemsize, elemsize, buf);
|
||||
}
|
||||
|
||||
/// @brief Specialized version of `CreateVector` for non-copying use cases.
|
||||
/// Write the data any time later to the returned buffer pointer `buf`.
|
||||
/// @tparam T The data type of the data that will be stored in the buffer
|
||||
@@ -1019,14 +1056,14 @@ class FlatBufferBuilder {
|
||||
template<typename T>
|
||||
Offset<Vector<T>> CreateUninitializedVector(size_t len, T **buf) {
|
||||
AssertScalarT<T>();
|
||||
return CreateUninitializedVector(len, sizeof(T),
|
||||
return CreateUninitializedVector(len, sizeof(T), AlignOf<T>(),
|
||||
reinterpret_cast<uint8_t **>(buf));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Offset<Vector<const T *>> CreateUninitializedVectorOfStructs(size_t len,
|
||||
T **buf) {
|
||||
return CreateUninitializedVector(len, sizeof(T),
|
||||
return CreateUninitializedVector(len, sizeof(T), AlignOf<T>(),
|
||||
reinterpret_cast<uint8_t **>(buf));
|
||||
}
|
||||
|
||||
@@ -1037,7 +1074,7 @@ class FlatBufferBuilder {
|
||||
Offset<Vector<T>> CreateVectorScalarCast(const U *v, size_t len) {
|
||||
AssertScalarT<T>();
|
||||
AssertScalarT<U>();
|
||||
StartVector(len, sizeof(T));
|
||||
StartVector<T>(len);
|
||||
for (auto i = len; i > 0;) { PushElement(static_cast<T>(v[--i])); }
|
||||
return Offset<Vector<T>>(EndVector(len));
|
||||
}
|
||||
@@ -1074,7 +1111,7 @@ class FlatBufferBuilder {
|
||||
void SwapBufAllocator(FlatBufferBuilder &other) {
|
||||
buf_.swap_allocator(other.buf_);
|
||||
}
|
||||
|
||||
|
||||
/// @brief The length of a FlatBuffer file header.
|
||||
static const size_t kFileIdentifierLength =
|
||||
::flatbuffers::kFileIdentifierLength;
|
||||
@@ -1146,7 +1183,7 @@ class FlatBufferBuilder {
|
||||
// Allocates space for a vector of structures.
|
||||
// Must be completed with EndVectorOfStructs().
|
||||
template<typename T> T *StartVectorOfStructs(size_t vector_size) {
|
||||
StartVector(vector_size * sizeof(T) / AlignOf<T>(), AlignOf<T>());
|
||||
StartVector(vector_size * sizeof(T) / AlignOf<T>(), sizeof(T), AlignOf<T>());
|
||||
return reinterpret_cast<T *>(buf_.make_space(vector_size * sizeof(T)));
|
||||
}
|
||||
|
||||
|
||||
@@ -226,27 +226,13 @@ struct TypeTable {
|
||||
};
|
||||
|
||||
// String which identifies the current version of FlatBuffers.
|
||||
// flatbuffer_version_string is used by Google developers to identify which
|
||||
// applications uploaded to Google Play are using this library. This allows
|
||||
// the development team at Google to determine the popularity of the library.
|
||||
// How it works: Applications that are uploaded to the Google Play Store are
|
||||
// scanned for this version string. We track which applications are using it
|
||||
// to measure popularity. You are free to remove it (of course) but we would
|
||||
// appreciate if you left it in.
|
||||
inline const char *flatbuffers_version_string() {
|
||||
return "FlatBuffers " FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MAJOR) "."
|
||||
FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MINOR) "."
|
||||
FLATBUFFERS_STRING(FLATBUFFERS_VERSION_REVISION);
|
||||
}
|
||||
|
||||
// Weak linkage is culled by VS & doesn't work on cygwin.
|
||||
// clang-format off
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__)
|
||||
|
||||
extern volatile __attribute__((weak)) const char *flatbuffer_version_string;
|
||||
volatile __attribute__((weak)) const char *flatbuffer_version_string =
|
||||
"FlatBuffers "
|
||||
FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MAJOR) "."
|
||||
FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MINOR) "."
|
||||
FLATBUFFERS_STRING(FLATBUFFERS_VERSION_REVISION);
|
||||
|
||||
#endif // !defined(_WIN32) && !defined(__CYGWIN__)
|
||||
|
||||
#define FLATBUFFERS_DEFINE_BITMASK_OPERATORS(E, T)\
|
||||
inline E operator | (E lhs, E rhs){\
|
||||
return E(T(lhs) | T(rhs));\
|
||||
|
||||
+45
-44
@@ -26,22 +26,27 @@
|
||||
#include <memory>
|
||||
#include <limits>
|
||||
|
||||
// Detect C++17 compatible compiler.
|
||||
// __cplusplus >= 201703L - a compiler has support of 'static inline' variables.
|
||||
#if defined(FLATBUFFERS_USE_STD_OPTIONAL) \
|
||||
|| (defined(__cplusplus) && __cplusplus >= 201703L) \
|
||||
|| (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))
|
||||
#ifndef FLATBUFFERS_USE_STD_OPTIONAL
|
||||
// Detect C++17 compatible compiler.
|
||||
// __cplusplus >= 201703L - a compiler has support of 'static inline' variables.
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201703L) \
|
||||
|| (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
|
||||
#define FLATBUFFERS_USE_STD_OPTIONAL 1
|
||||
#else
|
||||
#define FLATBUFFERS_USE_STD_OPTIONAL 0
|
||||
#endif // (defined(__cplusplus) && __cplusplus >= 201703L) ...
|
||||
#endif // FLATBUFFERS_USE_STD_OPTIONAL
|
||||
|
||||
#if FLATBUFFERS_USE_STD_OPTIONAL
|
||||
#include <optional>
|
||||
#ifndef FLATBUFFERS_USE_STD_OPTIONAL
|
||||
#define FLATBUFFERS_USE_STD_OPTIONAL
|
||||
#endif
|
||||
#endif // defined(FLATBUFFERS_USE_STD_OPTIONAL) ...
|
||||
#endif
|
||||
|
||||
// The __cpp_lib_span is the predefined feature macro.
|
||||
#if defined(FLATBUFFERS_USE_STD_SPAN)
|
||||
#include <span>
|
||||
#elif defined(__cpp_lib_span) && defined(__has_include)
|
||||
#if __has_include(<span>)
|
||||
#include <array>
|
||||
#include <span>
|
||||
#define FLATBUFFERS_USE_STD_SPAN
|
||||
#endif
|
||||
@@ -128,7 +133,7 @@ namespace flatbuffers {
|
||||
};
|
||||
#endif // defined(FLATBUFFERS_TEMPLATES_ALIASES)
|
||||
|
||||
#ifdef FLATBUFFERS_USE_STD_OPTIONAL
|
||||
#if FLATBUFFERS_USE_STD_OPTIONAL
|
||||
template<class T>
|
||||
using Optional = std::optional<T>;
|
||||
using nullopt_t = std::nullopt_t;
|
||||
@@ -284,13 +289,13 @@ FLATBUFFERS_CONSTEXPR std::size_t dynamic_extent = static_cast<std::size_t>(-1);
|
||||
namespace internal {
|
||||
// This is SFINAE helper class for checking of a common condition:
|
||||
// > This overload only participates in overload resolution
|
||||
// > Check whether a pointer to an array of U can be converted
|
||||
// > to a pointer to an array of E.
|
||||
// This helper is used for checking of 'U -> const U'.
|
||||
template<class E, std::size_t Extent, class U, std::size_t N>
|
||||
struct is_span_convertable {
|
||||
// > Check whether a pointer to an array of From can be converted
|
||||
// > to a pointer to an array of To.
|
||||
// This helper is used for checking of 'From -> const From'.
|
||||
template<class To, std::size_t Extent, class From, std::size_t N>
|
||||
struct is_span_convertible {
|
||||
using type =
|
||||
typename std::conditional<std::is_convertible<U (*)[], E (*)[]>::value
|
||||
typename std::conditional<std::is_convertible<From (*)[], To (*)[]>::value
|
||||
&& (Extent == dynamic_extent || N == Extent),
|
||||
int, void>::type;
|
||||
};
|
||||
@@ -362,13 +367,9 @@ class span FLATBUFFERS_FINAL_CLASS {
|
||||
|
||||
#if !defined(FLATBUFFERS_SPAN_MINIMAL)
|
||||
using Iterator = internal::SpanIterator<T>;
|
||||
using ConstIterator = internal::SpanIterator<const T>;
|
||||
|
||||
Iterator begin() const { return Iterator(data()); }
|
||||
Iterator end() const { return Iterator(data() + size()); }
|
||||
|
||||
ConstIterator cbegin() const { return ConstIterator(data()); }
|
||||
ConstIterator cend() const { return ConstIterator(data() + size()); }
|
||||
#endif
|
||||
|
||||
// Returns a reference to the idx-th element of the sequence.
|
||||
@@ -414,7 +415,7 @@ class span FLATBUFFERS_FINAL_CLASS {
|
||||
// extent == 0 || extent == flatbuffers::dynamic_extent.
|
||||
// A dummy template argument N is need dependency for SFINAE.
|
||||
template<std::size_t N = 0,
|
||||
typename internal::is_span_convertable<element_type, Extent, element_type, (N - N)>::type = 0>
|
||||
typename internal::is_span_convertible<element_type, Extent, element_type, (N - N)>::type = 0>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 span() FLATBUFFERS_NOEXCEPT : data_(nullptr),
|
||||
count_(0) {
|
||||
static_assert(extent == 0 || extent == dynamic_extent, "invalid span");
|
||||
@@ -427,12 +428,12 @@ class span FLATBUFFERS_FINAL_CLASS {
|
||||
// std::remove_pointer_t<decltype(std::data(arr))>(*)[]
|
||||
// is convertible to element_type (*)[].
|
||||
template<std::size_t N,
|
||||
typename internal::is_span_convertable<element_type, Extent, element_type, N>::type = 0>
|
||||
typename internal::is_span_convertible<element_type, Extent, element_type, N>::type = 0>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 span(element_type (&arr)[N]) FLATBUFFERS_NOEXCEPT
|
||||
: data_(arr), count_(N) {}
|
||||
|
||||
template<class U, std::size_t N,
|
||||
typename internal::is_span_convertable<element_type, Extent, U, N>::type = 0>
|
||||
typename internal::is_span_convertible<element_type, Extent, U, N>::type = 0>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 span(std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT
|
||||
: data_(arr.data()), count_(N) {}
|
||||
|
||||
@@ -442,7 +443,7 @@ class span FLATBUFFERS_FINAL_CLASS {
|
||||
// : data_(arr.data()), count_(N) {}
|
||||
|
||||
template<class U, std::size_t N,
|
||||
typename internal::is_span_convertable<element_type, Extent, U, N>::type = 0>
|
||||
typename internal::is_span_convertible<element_type, Extent, U, N>::type = 0>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 span(const std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT
|
||||
: data_(arr.data()), count_(N) {}
|
||||
|
||||
@@ -452,7 +453,7 @@ class span FLATBUFFERS_FINAL_CLASS {
|
||||
// if extent == std::dynamic_extent || N == extent is true and U (*)[]
|
||||
// is convertible to element_type (*)[].
|
||||
template<class U, std::size_t N,
|
||||
typename internal::is_span_convertable<element_type, Extent, U, N>::type = 0>
|
||||
typename internal::is_span_convertible<element_type, Extent, U, N>::type = 0>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 span(const flatbuffers::span<U, N> &s) FLATBUFFERS_NOEXCEPT
|
||||
: span(s.data(), s.size()) {
|
||||
}
|
||||
@@ -462,45 +463,45 @@ class span FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
// This is a naive implementation with 'count_' member even if (Extent != dynamic_extent).
|
||||
pointer const data_;
|
||||
const size_type count_;
|
||||
size_type count_;
|
||||
};
|
||||
#endif // defined(FLATBUFFERS_USE_STD_SPAN)
|
||||
|
||||
#if !defined(FLATBUFFERS_SPAN_MINIMAL)
|
||||
template<class U, std::size_t N>
|
||||
template<class ElementType, std::size_t Extent>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11
|
||||
flatbuffers::span<U, N> make_span(U(&arr)[N]) FLATBUFFERS_NOEXCEPT {
|
||||
return span<U, N>(arr);
|
||||
flatbuffers::span<ElementType, Extent> make_span(ElementType(&arr)[Extent]) FLATBUFFERS_NOEXCEPT {
|
||||
return span<ElementType, Extent>(arr);
|
||||
}
|
||||
|
||||
template<class U, std::size_t N>
|
||||
template<class ElementType, std::size_t Extent>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11
|
||||
flatbuffers::span<const U, N> make_span(const U(&arr)[N]) FLATBUFFERS_NOEXCEPT {
|
||||
return span<const U, N>(arr);
|
||||
flatbuffers::span<const ElementType, Extent> make_span(const ElementType(&arr)[Extent]) FLATBUFFERS_NOEXCEPT {
|
||||
return span<const ElementType, Extent>(arr);
|
||||
}
|
||||
|
||||
template<class U, std::size_t N>
|
||||
template<class ElementType, std::size_t Extent>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11
|
||||
flatbuffers::span<U, N> make_span(std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT {
|
||||
return span<U, N>(arr);
|
||||
flatbuffers::span<ElementType, Extent> make_span(std::array<ElementType, Extent> &arr) FLATBUFFERS_NOEXCEPT {
|
||||
return span<ElementType, Extent>(arr);
|
||||
}
|
||||
|
||||
template<class U, std::size_t N>
|
||||
template<class ElementType, std::size_t Extent>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11
|
||||
flatbuffers::span<const U, N> make_span(const std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT {
|
||||
return span<const U, N>(arr);
|
||||
flatbuffers::span<const ElementType, Extent> make_span(const std::array<ElementType, Extent> &arr) FLATBUFFERS_NOEXCEPT {
|
||||
return span<const ElementType, Extent>(arr);
|
||||
}
|
||||
|
||||
template<class U, std::size_t N>
|
||||
template<class ElementType, std::size_t Extent>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11
|
||||
flatbuffers::span<U, dynamic_extent> make_span(U *first, std::size_t count) FLATBUFFERS_NOEXCEPT {
|
||||
return span<U, dynamic_extent>(first, count);
|
||||
flatbuffers::span<ElementType, dynamic_extent> make_span(ElementType *first, std::size_t count) FLATBUFFERS_NOEXCEPT {
|
||||
return span<ElementType, dynamic_extent>(first, count);
|
||||
}
|
||||
|
||||
template<class U, std::size_t N>
|
||||
template<class ElementType, std::size_t Extent>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11
|
||||
flatbuffers::span<const U, dynamic_extent> make_span(const U *first, std::size_t count) FLATBUFFERS_NOEXCEPT {
|
||||
return span<const U, dynamic_extent>(first, count);
|
||||
flatbuffers::span<const ElementType, dynamic_extent> make_span(const ElementType *first, std::size_t count) FLATBUFFERS_NOEXCEPT {
|
||||
return span<const ElementType, dynamic_extent>(first, count);
|
||||
}
|
||||
#endif // !defined(FLATBUFFERS_SPAN_MINIMAL)
|
||||
|
||||
|
||||
+7
-5
@@ -112,20 +112,22 @@ class Table {
|
||||
|
||||
// Verify a particular field.
|
||||
template<typename T>
|
||||
bool VerifyField(const Verifier &verifier, voffset_t field) const {
|
||||
bool VerifyField(const Verifier &verifier, voffset_t field,
|
||||
size_t align) const {
|
||||
// Calling GetOptionalFieldOffset should be safe now thanks to
|
||||
// VerifyTable().
|
||||
auto field_offset = GetOptionalFieldOffset(field);
|
||||
// Check the actual field.
|
||||
return !field_offset || verifier.Verify<T>(data_, field_offset);
|
||||
return !field_offset || verifier.VerifyField<T>(data_, field_offset, align);
|
||||
}
|
||||
|
||||
// VerifyField for required fields.
|
||||
template<typename T>
|
||||
bool VerifyFieldRequired(const Verifier &verifier, voffset_t field) const {
|
||||
bool VerifyFieldRequired(const Verifier &verifier, voffset_t field,
|
||||
size_t align) const {
|
||||
auto field_offset = GetOptionalFieldOffset(field);
|
||||
return verifier.Check(field_offset != 0) &&
|
||||
verifier.Verify<T>(data_, field_offset);
|
||||
verifier.VerifyField<T>(data_, field_offset, align);
|
||||
}
|
||||
|
||||
// Versions for offsets.
|
||||
@@ -163,4 +165,4 @@ inline flatbuffers::Optional<bool> Table::GetOptional<uint8_t, bool>(
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif // FLATBUFFERS_TABLE_H_
|
||||
#endif // FLATBUFFERS_TABLE_H_
|
||||
|
||||
+32
-5
@@ -17,19 +17,20 @@
|
||||
#ifndef FLATBUFFERS_UTIL_H_
|
||||
#define FLATBUFFERS_UTIL_H_
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "flatbuffers/base.h"
|
||||
#include "flatbuffers/stl_emulation.h"
|
||||
|
||||
#ifndef FLATBUFFERS_PREFER_PRINTF
|
||||
# include <iomanip>
|
||||
# include <sstream>
|
||||
#else // FLATBUFFERS_PREFER_PRINTF
|
||||
# include <float.h>
|
||||
# include <stdio.h>
|
||||
#endif // FLATBUFFERS_PREFER_PRINTF
|
||||
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
|
||||
namespace flatbuffers {
|
||||
@@ -94,7 +95,7 @@ template<typename T> size_t IntToDigitCount(T t) {
|
||||
// Count a single 0 left of the dot for fractional numbers
|
||||
if (-1 < t && t < 1) digit_count++;
|
||||
// Count digits until fractional part
|
||||
T eps = std::numeric_limits<float>::epsilon();
|
||||
T eps = std::numeric_limits<T>::epsilon();
|
||||
while (t <= (-1 + eps) || (1 - eps) <= t) {
|
||||
t /= 10;
|
||||
digit_count++;
|
||||
@@ -254,7 +255,7 @@ inline void strtoval_impl(double *val, const char *str, char **endptr) {
|
||||
}
|
||||
|
||||
// UBSAN: double to float is safe if numeric_limits<float>::is_iec559 is true.
|
||||
__supress_ubsan__("float-cast-overflow")
|
||||
__suppress_ubsan__("float-cast-overflow")
|
||||
inline void strtoval_impl(float *val, const char *str, char **endptr) {
|
||||
*val = __strtof_impl(str, endptr);
|
||||
}
|
||||
@@ -447,6 +448,9 @@ std::string StripPath(const std::string &filepath);
|
||||
// Strip the last component of the path + separator.
|
||||
std::string StripFileName(const std::string &filepath);
|
||||
|
||||
std::string StripPrefix(const std::string &filepath,
|
||||
const std::string &prefix_to_remove);
|
||||
|
||||
// Concatenates a path with a filename, regardless of whether the path
|
||||
// ends in a separator or not.
|
||||
std::string ConCatPathFileName(const std::string &path,
|
||||
@@ -681,8 +685,31 @@ bool SetGlobalTestLocale(const char *locale_name,
|
||||
bool ReadEnvironmentVariable(const char *var_name,
|
||||
std::string *_value = nullptr);
|
||||
|
||||
// MSVC specific: Send all assert reports to STDOUT to prevent CI hangs.
|
||||
void SetupDefaultCRTReportMode();
|
||||
enum class Case {
|
||||
kUnknown = 0,
|
||||
// TheQuickBrownFox
|
||||
kUpperCamel = 1,
|
||||
// theQuickBrownFox
|
||||
kLowerCamel = 2,
|
||||
// the_quick_brown_fox
|
||||
kSnake = 3,
|
||||
// THE_QUICK_BROWN_FOX
|
||||
kScreamingSnake = 4,
|
||||
// THEQUICKBROWNFOX
|
||||
kAllUpper = 5,
|
||||
// thequickbrownfox
|
||||
kAllLower = 6,
|
||||
// the-quick-brown-fox
|
||||
kDasher = 7,
|
||||
// THEQuiCKBr_ownFox (or whatever you want, we won't change it)
|
||||
kKeep = 8,
|
||||
// the_quick_brown_fox123 (as opposed to the_quick_brown_fox_123)
|
||||
kSnake2 = 9,
|
||||
};
|
||||
|
||||
// Convert the `input` string of case `input_case` to the specified `output_case`.
|
||||
std::string ConvertCase(const std::string &input, Case output_case,
|
||||
Case input_case = Case::kSnake);
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "flatbuffers/base.h"
|
||||
#include "flatbuffers/buffer.h"
|
||||
#include "flatbuffers/stl_emulation.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
@@ -326,6 +327,24 @@ FLATBUFFERS_CONSTEXPR_CPP11 flatbuffers::span<const uint8_t> make_bytes_span(
|
||||
return span<const uint8_t>(vec.Data(), vec.size() * sizeof(U));
|
||||
}
|
||||
|
||||
// Convenient helper functions to get a span of any vector, regardless
|
||||
// of whether it is null or not (the field is not set).
|
||||
template<class U>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 flatbuffers::span<U> make_span(Vector<U> *ptr)
|
||||
FLATBUFFERS_NOEXCEPT {
|
||||
static_assert(Vector<U>::is_span_observable,
|
||||
"wrong type U, only LE-scalar, or byte types are allowed");
|
||||
return ptr ? make_span(*ptr) : span<U>();
|
||||
}
|
||||
|
||||
template<class U>
|
||||
FLATBUFFERS_CONSTEXPR_CPP11 flatbuffers::span<const U> make_span(
|
||||
const Vector<U> *ptr) FLATBUFFERS_NOEXCEPT {
|
||||
static_assert(Vector<U>::is_span_observable,
|
||||
"wrong type U, only LE-scalar, or byte types are allowed");
|
||||
return ptr ? make_span(*ptr) : span<const U>();
|
||||
}
|
||||
|
||||
// Represent a vector much like the template above, but in this case we
|
||||
// don't know what the element types are (used with reflection.h).
|
||||
class VectorOfAny {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace flatbuffers {
|
||||
|
||||
// This is a minimal replication of std::vector<uint8_t> functionality,
|
||||
// except growing from higher to lower addresses. i.e push_back() inserts data
|
||||
// except growing from higher to lower addresses. i.e. push_back() inserts data
|
||||
// in the lowest address in the vector.
|
||||
// Since this vector leaves the lower part unused, we support a "scratch-pad"
|
||||
// that can be stored there for temporary data, to share the allocated space.
|
||||
|
||||
+114
-67
@@ -18,7 +18,6 @@
|
||||
#define FLATBUFFERS_VERIFIER_H_
|
||||
|
||||
#include "flatbuffers/base.h"
|
||||
#include "flatbuffers/util.h"
|
||||
#include "flatbuffers/vector.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
@@ -26,21 +25,37 @@ namespace flatbuffers {
|
||||
// Helper class to verify the integrity of a FlatBuffer
|
||||
class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
public:
|
||||
Verifier(const uint8_t *buf, size_t buf_len, uoffset_t _max_depth = 64,
|
||||
uoffset_t _max_tables = 1000000, bool _check_alignment = true)
|
||||
: buf_(buf),
|
||||
size_(buf_len),
|
||||
depth_(0),
|
||||
max_depth_(_max_depth),
|
||||
num_tables_(0),
|
||||
max_tables_(_max_tables),
|
||||
upper_bound_(0),
|
||||
check_alignment_(_check_alignment) {
|
||||
struct Options {
|
||||
// The maximum nesting of tables and vectors before we call it invalid.
|
||||
uoffset_t max_depth = 64;
|
||||
// The maximum number of tables we will verify before we call it invalid.
|
||||
uoffset_t max_tables = 1000000;
|
||||
// If true, verify all data is aligned.
|
||||
bool check_alignment = true;
|
||||
// If true, run verifier on nested flatbuffers
|
||||
bool check_nested_flatbuffers = true;
|
||||
};
|
||||
|
||||
explicit Verifier(const uint8_t *const buf, const size_t buf_len,
|
||||
const Options &opts)
|
||||
: buf_(buf), size_(buf_len), opts_(opts) {
|
||||
FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
// Deprecated API, please construct with Verifier::Options.
|
||||
Verifier(const uint8_t *const buf, const size_t buf_len,
|
||||
const uoffset_t max_depth = 64, const uoffset_t max_tables = 1000000,
|
||||
const bool check_alignment = true)
|
||||
: Verifier(buf, buf_len, [&] {
|
||||
Options opts;
|
||||
opts.max_depth = max_depth;
|
||||
opts.max_tables = max_tables;
|
||||
opts.check_alignment = check_alignment;
|
||||
return opts;
|
||||
}()) {}
|
||||
|
||||
// Central location where any verification failures register.
|
||||
bool Check(bool ok) const {
|
||||
bool Check(const bool ok) const {
|
||||
// clang-format off
|
||||
#ifdef FLATBUFFERS_DEBUG_VERIFICATION_FAILURE
|
||||
FLATBUFFERS_ASSERT(ok);
|
||||
@@ -54,7 +69,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
}
|
||||
|
||||
// Verify any range within the buffer.
|
||||
bool Verify(size_t elem, size_t elem_len) const {
|
||||
bool Verify(const size_t elem, const size_t elem_len) const {
|
||||
// clang-format off
|
||||
#ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
|
||||
auto upper_bound = elem + elem_len;
|
||||
@@ -65,48 +80,52 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
return Check(elem_len < size_ && elem <= size_ - elem_len);
|
||||
}
|
||||
|
||||
template<typename T> bool VerifyAlignment(size_t elem) const {
|
||||
return Check((elem & (sizeof(T) - 1)) == 0 || !check_alignment_);
|
||||
bool VerifyAlignment(const size_t elem, const size_t align) const {
|
||||
return Check((elem & (align - 1)) == 0 || !opts_.check_alignment);
|
||||
}
|
||||
|
||||
// Verify a range indicated by sizeof(T).
|
||||
template<typename T> bool Verify(size_t elem) const {
|
||||
return VerifyAlignment<T>(elem) && Verify(elem, sizeof(T));
|
||||
template<typename T> bool Verify(const size_t elem) const {
|
||||
return VerifyAlignment(elem, sizeof(T)) && Verify(elem, sizeof(T));
|
||||
}
|
||||
|
||||
bool VerifyFromPointer(const uint8_t *p, size_t len) {
|
||||
auto o = static_cast<size_t>(p - buf_);
|
||||
return Verify(o, len);
|
||||
bool VerifyFromPointer(const uint8_t *const p, const size_t len) {
|
||||
return Verify(static_cast<size_t>(p - buf_), len);
|
||||
}
|
||||
|
||||
// Verify relative to a known-good base pointer.
|
||||
bool Verify(const uint8_t *base, voffset_t elem_off, size_t elem_len) const {
|
||||
return Verify(static_cast<size_t>(base - buf_) + elem_off, elem_len);
|
||||
bool VerifyFieldStruct(const uint8_t *const base, const voffset_t elem_off,
|
||||
const size_t elem_len, const size_t align) const {
|
||||
const auto f = static_cast<size_t>(base - buf_) + elem_off;
|
||||
return VerifyAlignment(f, align) && Verify(f, elem_len);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Verify(const uint8_t *base, voffset_t elem_off) const {
|
||||
return Verify(static_cast<size_t>(base - buf_) + elem_off, sizeof(T));
|
||||
bool VerifyField(const uint8_t *const base, const voffset_t elem_off,
|
||||
const size_t align) const {
|
||||
const auto f = static_cast<size_t>(base - buf_) + elem_off;
|
||||
return VerifyAlignment(f, align) && Verify(f, sizeof(T));
|
||||
}
|
||||
|
||||
// Verify a pointer (may be NULL) of a table type.
|
||||
template<typename T> bool VerifyTable(const T *table) {
|
||||
template<typename T> bool VerifyTable(const T *const table) {
|
||||
return !table || table->Verify(*this);
|
||||
}
|
||||
|
||||
// Verify a pointer (may be NULL) of any vector type.
|
||||
template<typename T> bool VerifyVector(const Vector<T> *vec) const {
|
||||
template<typename T> bool VerifyVector(const Vector<T> *const vec) const {
|
||||
return !vec || VerifyVectorOrString(reinterpret_cast<const uint8_t *>(vec),
|
||||
sizeof(T));
|
||||
}
|
||||
|
||||
// Verify a pointer (may be NULL) of a vector to struct.
|
||||
template<typename T> bool VerifyVector(const Vector<const T *> *vec) const {
|
||||
template<typename T>
|
||||
bool VerifyVector(const Vector<const T *> *const vec) const {
|
||||
return VerifyVector(reinterpret_cast<const Vector<T> *>(vec));
|
||||
}
|
||||
|
||||
// Verify a pointer (may be NULL) to string.
|
||||
bool VerifyString(const String *str) const {
|
||||
bool VerifyString(const String *const str) const {
|
||||
size_t end;
|
||||
return !str || (VerifyVectorOrString(reinterpret_cast<const uint8_t *>(str),
|
||||
1, &end) &&
|
||||
@@ -115,24 +134,24 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
}
|
||||
|
||||
// Common code between vectors and strings.
|
||||
bool VerifyVectorOrString(const uint8_t *vec, size_t elem_size,
|
||||
size_t *end = nullptr) const {
|
||||
auto veco = static_cast<size_t>(vec - buf_);
|
||||
bool VerifyVectorOrString(const uint8_t *const vec, const size_t elem_size,
|
||||
size_t *const end = nullptr) const {
|
||||
const auto veco = static_cast<size_t>(vec - buf_);
|
||||
// Check we can read the size field.
|
||||
if (!Verify<uoffset_t>(veco)) return false;
|
||||
// Check the whole array. If this is a string, the byte past the array
|
||||
// must be 0.
|
||||
auto size = ReadScalar<uoffset_t>(vec);
|
||||
auto max_elems = FLATBUFFERS_MAX_BUFFER_SIZE / elem_size;
|
||||
// Check the whole array. If this is a string, the byte past the array must
|
||||
// be 0.
|
||||
const auto size = ReadScalar<uoffset_t>(vec);
|
||||
const auto max_elems = FLATBUFFERS_MAX_BUFFER_SIZE / elem_size;
|
||||
if (!Check(size < max_elems))
|
||||
return false; // Protect against byte_size overflowing.
|
||||
auto byte_size = sizeof(size) + elem_size * size;
|
||||
const auto byte_size = sizeof(size) + elem_size * size;
|
||||
if (end) *end = veco + byte_size;
|
||||
return Verify(veco, byte_size);
|
||||
}
|
||||
|
||||
// Special case for string contents, after the above has been called.
|
||||
bool VerifyVectorOfStrings(const Vector<Offset<String>> *vec) const {
|
||||
bool VerifyVectorOfStrings(const Vector<Offset<String>> *const vec) const {
|
||||
if (vec) {
|
||||
for (uoffset_t i = 0; i < vec->size(); i++) {
|
||||
if (!VerifyString(vec->Get(i))) return false;
|
||||
@@ -142,7 +161,8 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
}
|
||||
|
||||
// Special case for table contents, after the above has been called.
|
||||
template<typename T> bool VerifyVectorOfTables(const Vector<Offset<T>> *vec) {
|
||||
template<typename T>
|
||||
bool VerifyVectorOfTables(const Vector<Offset<T>> *const vec) {
|
||||
if (vec) {
|
||||
for (uoffset_t i = 0; i < vec->size(); i++) {
|
||||
if (!vec->Get(i)->Verify(*this)) return false;
|
||||
@@ -151,30 +171,41 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
return true;
|
||||
}
|
||||
|
||||
__supress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart(
|
||||
const uint8_t *table) {
|
||||
__suppress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart(
|
||||
const uint8_t *const table) {
|
||||
// Check the vtable offset.
|
||||
auto tableo = static_cast<size_t>(table - buf_);
|
||||
const auto tableo = static_cast<size_t>(table - buf_);
|
||||
if (!Verify<soffset_t>(tableo)) return false;
|
||||
// This offset may be signed, but doing the subtraction unsigned always
|
||||
// gives the result we want.
|
||||
auto vtableo = tableo - static_cast<size_t>(ReadScalar<soffset_t>(table));
|
||||
const auto vtableo =
|
||||
tableo - static_cast<size_t>(ReadScalar<soffset_t>(table));
|
||||
// Check the vtable size field, then check vtable fits in its entirety.
|
||||
return VerifyComplexity() && Verify<voffset_t>(vtableo) &&
|
||||
VerifyAlignment<voffset_t>(ReadScalar<voffset_t>(buf_ + vtableo)) &&
|
||||
Verify(vtableo, ReadScalar<voffset_t>(buf_ + vtableo));
|
||||
if (!(VerifyComplexity() && Verify<voffset_t>(vtableo) &&
|
||||
VerifyAlignment(ReadScalar<voffset_t>(buf_ + vtableo),
|
||||
sizeof(voffset_t))))
|
||||
return false;
|
||||
const auto vsize = ReadScalar<voffset_t>(buf_ + vtableo);
|
||||
return Check((vsize & 1) == 0) && Verify(vtableo, vsize);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool VerifyBufferFromStart(const char *identifier, size_t start) {
|
||||
bool VerifyBufferFromStart(const char *const identifier, const size_t start) {
|
||||
// Buffers have to be of some size to be valid. The reason it is a runtime
|
||||
// check instead of static_assert, is that nested flatbuffers go through
|
||||
// this call and their size is determined at runtime.
|
||||
if (!Check(size_ >= FLATBUFFERS_MIN_BUFFER_SIZE)) return false;
|
||||
|
||||
// If an identifier is provided, check that we have a buffer
|
||||
if (identifier && !Check((size_ >= 2 * sizeof(flatbuffers::uoffset_t) &&
|
||||
BufferHasIdentifier(buf_ + start, identifier)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Call T::Verify, which must be in the generated code for this type.
|
||||
auto o = VerifyOffset(start);
|
||||
return o && reinterpret_cast<const T *>(buf_ + start + o)->Verify(*this)
|
||||
const auto o = VerifyOffset(start);
|
||||
return Check(o != 0) &&
|
||||
reinterpret_cast<const T *>(buf_ + start + o)->Verify(*this)
|
||||
// clang-format off
|
||||
#ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
|
||||
&& GetComputedSize()
|
||||
@@ -184,9 +215,17 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool VerifyNestedFlatBuffer(const Vector<uint8_t> *buf,
|
||||
const char *identifier) {
|
||||
bool VerifyNestedFlatBuffer(const Vector<uint8_t> *const buf,
|
||||
const char *const identifier) {
|
||||
// Caller opted out of this.
|
||||
if (!opts_.check_nested_flatbuffers) return true;
|
||||
|
||||
// An empty buffer is OK as it indicates not present.
|
||||
if (!buf) return true;
|
||||
|
||||
// If there is a nested buffer, it must be greater than the min size.
|
||||
if (!Check(buf->size() >= FLATBUFFERS_MIN_BUFFER_SIZE)) return false;
|
||||
|
||||
Verifier nested_verifier(buf->data(), buf->size());
|
||||
return nested_verifier.VerifyBuffer<T>(identifier);
|
||||
}
|
||||
@@ -194,19 +233,20 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
// Verify this whole buffer, starting with root type T.
|
||||
template<typename T> bool VerifyBuffer() { return VerifyBuffer<T>(nullptr); }
|
||||
|
||||
template<typename T> bool VerifyBuffer(const char *identifier) {
|
||||
template<typename T> bool VerifyBuffer(const char *const identifier) {
|
||||
return VerifyBufferFromStart<T>(identifier, 0);
|
||||
}
|
||||
|
||||
template<typename T> bool VerifySizePrefixedBuffer(const char *identifier) {
|
||||
template<typename T>
|
||||
bool VerifySizePrefixedBuffer(const char *const identifier) {
|
||||
return Verify<uoffset_t>(0U) &&
|
||||
ReadScalar<uoffset_t>(buf_) == size_ - sizeof(uoffset_t) &&
|
||||
Check(ReadScalar<uoffset_t>(buf_) == size_ - sizeof(uoffset_t)) &&
|
||||
VerifyBufferFromStart<T>(identifier, sizeof(uoffset_t));
|
||||
}
|
||||
|
||||
uoffset_t VerifyOffset(size_t start) const {
|
||||
uoffset_t VerifyOffset(const size_t start) const {
|
||||
if (!Verify<uoffset_t>(start)) return 0;
|
||||
auto o = ReadScalar<uoffset_t>(buf_ + start);
|
||||
const auto o = ReadScalar<uoffset_t>(buf_ + start);
|
||||
// May not point to itself.
|
||||
if (!Check(o != 0)) return 0;
|
||||
// Can't wrap around / buffers are max 2GB.
|
||||
@@ -217,18 +257,18 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
return o;
|
||||
}
|
||||
|
||||
uoffset_t VerifyOffset(const uint8_t *base, voffset_t start) const {
|
||||
uoffset_t VerifyOffset(const uint8_t *const base,
|
||||
const voffset_t start) const {
|
||||
return VerifyOffset(static_cast<size_t>(base - buf_) + start);
|
||||
}
|
||||
|
||||
// Called at the start of a table to increase counters measuring data
|
||||
// structure depth and amount, and possibly bails out with false if
|
||||
// limits set by the constructor have been hit. Needs to be balanced
|
||||
// with EndTable().
|
||||
// structure depth and amount, and possibly bails out with false if limits set
|
||||
// by the constructor have been hit. Needs to be balanced with EndTable().
|
||||
bool VerifyComplexity() {
|
||||
depth_++;
|
||||
num_tables_++;
|
||||
return Check(depth_ <= max_depth_ && num_tables_ <= max_tables_);
|
||||
return Check(depth_ <= opts_.max_depth && num_tables_ <= opts_.max_tables);
|
||||
}
|
||||
|
||||
// Called at the end of a table to pop the depth count.
|
||||
@@ -254,15 +294,22 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
std::vector<uint8_t> *GetFlexReuseTracker() { return flex_reuse_tracker_; }
|
||||
|
||||
void SetFlexReuseTracker(std::vector<uint8_t> *const rt) {
|
||||
flex_reuse_tracker_ = rt;
|
||||
}
|
||||
|
||||
private:
|
||||
const uint8_t *buf_;
|
||||
size_t size_;
|
||||
uoffset_t depth_;
|
||||
uoffset_t max_depth_;
|
||||
uoffset_t num_tables_;
|
||||
uoffset_t max_tables_;
|
||||
mutable size_t upper_bound_;
|
||||
bool check_alignment_;
|
||||
const size_t size_;
|
||||
const Options opts_;
|
||||
|
||||
mutable size_t upper_bound_ = 0;
|
||||
|
||||
uoffset_t depth_ = 0;
|
||||
uoffset_t num_tables_ = 0;
|
||||
std::vector<uint8_t> *flex_reuse_tracker_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
+37
-36
@@ -6,6 +6,7 @@
|
||||
#include "flatgeobuf/header_generated.h"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "main.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
static constexpr uint8_t magicbytes[8] = { 0x66, 0x67, 0x62, 0x03, 0x66, 0x67, 0x62, 0x01 };
|
||||
|
||||
@@ -70,19 +71,19 @@ drawvec readLinePart(const FlatGeobuf::Geometry *geometry) {
|
||||
|
||||
drawvec readGeometry(const FlatGeobuf::Geometry *geometry, FlatGeobuf::GeometryType h_geometry_type) {
|
||||
FlatGeobuf::GeometryType geometry_type = h_geometry_type;
|
||||
if (h_geometry_type == FlatGeobuf::GeometryType::Unknown) geometry_type = geometry->type();
|
||||
if (h_geometry_type == FlatGeobuf::GeometryType_Unknown) geometry_type = geometry->type();
|
||||
|
||||
if (geometry_type == FlatGeobuf::GeometryType::Point) {
|
||||
if (geometry_type == FlatGeobuf::GeometryType_Point) {
|
||||
return readPoints(geometry);
|
||||
} if (geometry_type == FlatGeobuf::GeometryType::MultiPoint) {
|
||||
} if (geometry_type == FlatGeobuf::GeometryType_MultiPoint) {
|
||||
return readPoints(geometry);
|
||||
} if (geometry_type == FlatGeobuf::GeometryType::LineString) {
|
||||
} if (geometry_type == FlatGeobuf::GeometryType_LineString) {
|
||||
return readLinePart(geometry);
|
||||
} else if (h_geometry_type == FlatGeobuf::GeometryType::MultiLineString) {
|
||||
} else if (h_geometry_type == FlatGeobuf::GeometryType_MultiLineString) {
|
||||
return readLinePart(geometry);
|
||||
} if (geometry_type == FlatGeobuf::GeometryType::Polygon) {
|
||||
} if (geometry_type == FlatGeobuf::GeometryType_Polygon) {
|
||||
return readLinePart(geometry);
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType::MultiPolygon) {
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType_MultiPolygon) {
|
||||
// if it is a GeometryCollection, parse Parts, ignore XY
|
||||
drawvec dv;
|
||||
for (size_t part = 0; part < geometry->parts()->size(); part++) {
|
||||
@@ -95,7 +96,7 @@ drawvec readGeometry(const FlatGeobuf::Geometry *geometry, FlatGeobuf::GeometryT
|
||||
return dv;
|
||||
} else {
|
||||
fprintf(stderr, "flatgeobuf has unsupported geometry type %u\n", (unsigned int)h_geometry_type);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,26 +106,26 @@ void readFeature(const FlatGeobuf::Feature *feature, long long feature_sequence_
|
||||
int drawvec_type = -1;
|
||||
|
||||
FlatGeobuf::GeometryType geometry_type = h_geometry_type;
|
||||
if (h_geometry_type == FlatGeobuf::GeometryType::Unknown) geometry_type = feature->geometry()->type();
|
||||
if (h_geometry_type == FlatGeobuf::GeometryType_Unknown) geometry_type = feature->geometry()->type();
|
||||
|
||||
switch (geometry_type) {
|
||||
case FlatGeobuf::GeometryType::Point :
|
||||
case FlatGeobuf::GeometryType::MultiPoint :
|
||||
case FlatGeobuf::GeometryType_Point :
|
||||
case FlatGeobuf::GeometryType_MultiPoint :
|
||||
drawvec_type = 1;
|
||||
break;
|
||||
case FlatGeobuf::GeometryType::LineString :
|
||||
case FlatGeobuf::GeometryType::MultiLineString :
|
||||
case FlatGeobuf::GeometryType_LineString :
|
||||
case FlatGeobuf::GeometryType_MultiLineString :
|
||||
drawvec_type = 2;
|
||||
break;
|
||||
case FlatGeobuf::GeometryType::Polygon :
|
||||
case FlatGeobuf::GeometryType::MultiPolygon :
|
||||
case FlatGeobuf::GeometryType_Polygon :
|
||||
case FlatGeobuf::GeometryType_MultiPolygon :
|
||||
drawvec_type = 3;
|
||||
break;
|
||||
case FlatGeobuf::GeometryType::Unknown :
|
||||
case FlatGeobuf::GeometryType::GeometryCollection :
|
||||
case FlatGeobuf::GeometryType_Unknown :
|
||||
case FlatGeobuf::GeometryType_GeometryCollection :
|
||||
default:
|
||||
fprintf(stderr, "flatgeobuf has unsupported geometry type %u\n", (unsigned int)h_geometry_type);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
serial_feature sf;
|
||||
@@ -160,73 +161,73 @@ void readFeature(const FlatGeobuf::Feature *feature, long long feature_sequence_
|
||||
FlatGeobuf::ColumnType col_type = h_column_types[col_idx];
|
||||
|
||||
serial_val sv;
|
||||
if (col_type == FlatGeobuf::ColumnType::Byte) {
|
||||
if (col_type == FlatGeobuf::ColumnType_Byte) {
|
||||
sv.type = mvt_sint;
|
||||
int8_t byte_val;
|
||||
memcpy(&byte_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(byte_val));
|
||||
sv.s = std::to_string(byte_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(byte_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::UByte) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_UByte) {
|
||||
sv.type = mvt_uint;
|
||||
uint8_t ubyte_val;
|
||||
memcpy(&ubyte_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(ubyte_val));
|
||||
sv.s = std::to_string(ubyte_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(ubyte_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::Bool) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_Bool) {
|
||||
sv.type = mvt_bool;
|
||||
uint8_t bool_val;
|
||||
memcpy(&bool_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(bool_val));
|
||||
sv.s = std::to_string(bool_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(bool_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::Short) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_Short) {
|
||||
sv.type = mvt_sint;
|
||||
int16_t short_val;
|
||||
memcpy(&short_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(short_val));
|
||||
sv.s = std::to_string(short_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(short_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::UShort) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_UShort) {
|
||||
sv.type = mvt_uint;
|
||||
uint16_t ushort_val;
|
||||
memcpy(&ushort_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(ushort_val));
|
||||
sv.s = std::to_string(ushort_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(ushort_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::Int) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_Int) {
|
||||
sv.type = mvt_sint;
|
||||
int32_t int_val;
|
||||
memcpy(&int_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(int_val));
|
||||
sv.s = std::to_string(int_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(int_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::UInt) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_UInt) {
|
||||
sv.type = mvt_uint;
|
||||
uint32_t uint_val;
|
||||
memcpy(&uint_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(uint_val));
|
||||
sv.s = std::to_string(uint_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(uint_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::Long) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_Long) {
|
||||
sv.type = mvt_sint;
|
||||
int64_t long_val;
|
||||
memcpy(&long_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(long_val));
|
||||
sv.s = std::to_string(long_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(long_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::ULong) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_ULong) {
|
||||
sv.type = mvt_uint;
|
||||
int64_t ulong_val;
|
||||
memcpy(&ulong_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(ulong_val));
|
||||
sv.s = std::to_string(ulong_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(ulong_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::Float) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_Float) {
|
||||
sv.type = mvt_float;
|
||||
float float_val;
|
||||
memcpy(&float_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(float_val));
|
||||
sv.s = milo::dtoa_milo(float_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(float_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::Double) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_Double) {
|
||||
sv.type = mvt_double;
|
||||
double double_val;
|
||||
memcpy(&double_val, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(double_val));
|
||||
sv.s = milo::dtoa_milo(double_val);
|
||||
p_pos += sizeof(uint16_t) + sizeof(double_val);
|
||||
} else if (col_type == FlatGeobuf::ColumnType::String || col_type == FlatGeobuf::ColumnType::Json || col_type == FlatGeobuf::ColumnType::DateTime) {
|
||||
} else if (col_type == FlatGeobuf::ColumnType_String || col_type == FlatGeobuf::ColumnType_Json || col_type == FlatGeobuf::ColumnType_DateTime) {
|
||||
sv.type = mvt_string;
|
||||
uint32_t val_len;
|
||||
memcpy(&val_len, feature->properties()->data() + p_pos + sizeof(uint16_t), sizeof(val_len));
|
||||
@@ -236,7 +237,7 @@ void readFeature(const FlatGeobuf::Feature *feature, long long feature_sequence_
|
||||
} else {
|
||||
// Binary is not representable in MVT
|
||||
fprintf(stderr, "flatgeobuf has unsupported column type %u\n", (unsigned int)col_type);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
full_keys.push_back(h_column_names[col_idx]);
|
||||
full_values.push_back(sv);
|
||||
@@ -251,7 +252,7 @@ void readFeature(const FlatGeobuf::Feature *feature, long long feature_sequence_
|
||||
struct fgb_queued_feature {
|
||||
const FlatGeobuf::Feature *feature = NULL;
|
||||
long long feature_sequence_id = -1;
|
||||
FlatGeobuf::GeometryType h_geometry_type = FlatGeobuf::GeometryType::Unknown;
|
||||
FlatGeobuf::GeometryType h_geometry_type = FlatGeobuf::GeometryType_Unknown;
|
||||
const std::vector<std::string> *h_column_names = NULL;
|
||||
const std::vector<FlatGeobuf::ColumnType> *h_column_types = NULL;
|
||||
std::vector<struct serialization_state> *sst = NULL;
|
||||
@@ -302,9 +303,9 @@ void fgbRunQueue() {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
if (pthread_create_wrap(&pthreads[i], NULL, fgb_run_parse_feature, &qra[i]) != 0) {
|
||||
if (pthread_create(&pthreads[i], NULL, fgb_run_parse_feature, &qra[i]) != 0) {
|
||||
perror("pthread_create");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +348,7 @@ void parse_flatgeobuf(std::vector<struct serialization_state> *sst, const char *
|
||||
const auto ok = FlatGeobuf::VerifySizePrefixedHeaderBuffer(v);
|
||||
if (!ok) {
|
||||
fprintf(stderr, "flatgeobuf header verification failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
auto header = FlatGeobuf::GetSizePrefixedHeader(src + sizeof(magicbytes));
|
||||
@@ -384,7 +385,7 @@ void parse_flatgeobuf(std::vector<struct serialization_state> *sst, const char *
|
||||
const auto ok2 = FlatGeobuf::VerifySizePrefixedFeatureBuffer(v2);
|
||||
if (!ok2) {
|
||||
fprintf(stderr, "flatgeobuf feature buffer verification failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
auto feature = FlatGeobuf::GetSizePrefixedFeature(start);
|
||||
|
||||
@@ -6,6 +6,13 @@
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 22 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 9 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 29,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "header_generated.h"
|
||||
|
||||
namespace FlatGeobuf {
|
||||
@@ -66,7 +73,7 @@ struct Geometry FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
verifier.VerifyVector(t()) &&
|
||||
VerifyOffset(verifier, VT_TM) &&
|
||||
verifier.VerifyVector(tm()) &&
|
||||
VerifyField<uint8_t>(verifier, VT_TYPE) &&
|
||||
VerifyField<uint8_t>(verifier, VT_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_PARTS) &&
|
||||
verifier.VerifyVector(parts()) &&
|
||||
verifier.VerifyVectorOfTables(parts()) &&
|
||||
@@ -121,7 +128,7 @@ inline flatbuffers::Offset<Geometry> CreateGeometry(
|
||||
flatbuffers::Offset<flatbuffers::Vector<double>> m = 0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<double>> t = 0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint64_t>> tm = 0,
|
||||
FlatGeobuf::GeometryType type = FlatGeobuf::GeometryType::Unknown,
|
||||
FlatGeobuf::GeometryType type = FlatGeobuf::GeometryType_Unknown,
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<FlatGeobuf::Geometry>>> parts = 0) {
|
||||
GeometryBuilder builder_(_fbb);
|
||||
builder_.add_parts(parts);
|
||||
@@ -143,7 +150,7 @@ inline flatbuffers::Offset<Geometry> CreateGeometryDirect(
|
||||
const std::vector<double> *m = nullptr,
|
||||
const std::vector<double> *t = nullptr,
|
||||
const std::vector<uint64_t> *tm = nullptr,
|
||||
FlatGeobuf::GeometryType type = FlatGeobuf::GeometryType::Unknown,
|
||||
FlatGeobuf::GeometryType type = FlatGeobuf::GeometryType_Unknown,
|
||||
const std::vector<flatbuffers::Offset<FlatGeobuf::Geometry>> *parts = nullptr) {
|
||||
auto ends__ = ends ? _fbb.CreateVector<uint32_t>(*ends) : 0;
|
||||
auto xy__ = xy ? _fbb.CreateVector<double>(*xy) : 0;
|
||||
|
||||
+100
-93
@@ -6,6 +6,13 @@
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 22 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 9 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 29,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace FlatGeobuf {
|
||||
|
||||
struct Column;
|
||||
@@ -17,49 +24,49 @@ struct CrsBuilder;
|
||||
struct Header;
|
||||
struct HeaderBuilder;
|
||||
|
||||
enum class GeometryType : uint8_t {
|
||||
Unknown = 0,
|
||||
Point = 1,
|
||||
LineString = 2,
|
||||
Polygon = 3,
|
||||
MultiPoint = 4,
|
||||
MultiLineString = 5,
|
||||
MultiPolygon = 6,
|
||||
GeometryCollection = 7,
|
||||
CircularString = 8,
|
||||
CompoundCurve = 9,
|
||||
CurvePolygon = 10,
|
||||
MultiCurve = 11,
|
||||
MultiSurface = 12,
|
||||
Curve = 13,
|
||||
Surface = 14,
|
||||
PolyhedralSurface = 15,
|
||||
TIN = 16,
|
||||
Triangle = 17,
|
||||
MIN = Unknown,
|
||||
MAX = Triangle
|
||||
enum GeometryType : uint8_t {
|
||||
GeometryType_Unknown = 0,
|
||||
GeometryType_Point = 1,
|
||||
GeometryType_LineString = 2,
|
||||
GeometryType_Polygon = 3,
|
||||
GeometryType_MultiPoint = 4,
|
||||
GeometryType_MultiLineString = 5,
|
||||
GeometryType_MultiPolygon = 6,
|
||||
GeometryType_GeometryCollection = 7,
|
||||
GeometryType_CircularString = 8,
|
||||
GeometryType_CompoundCurve = 9,
|
||||
GeometryType_CurvePolygon = 10,
|
||||
GeometryType_MultiCurve = 11,
|
||||
GeometryType_MultiSurface = 12,
|
||||
GeometryType_Curve = 13,
|
||||
GeometryType_Surface = 14,
|
||||
GeometryType_PolyhedralSurface = 15,
|
||||
GeometryType_TIN = 16,
|
||||
GeometryType_Triangle = 17,
|
||||
GeometryType_MIN = GeometryType_Unknown,
|
||||
GeometryType_MAX = GeometryType_Triangle
|
||||
};
|
||||
|
||||
inline const GeometryType (&EnumValuesGeometryType())[18] {
|
||||
static const GeometryType values[] = {
|
||||
GeometryType::Unknown,
|
||||
GeometryType::Point,
|
||||
GeometryType::LineString,
|
||||
GeometryType::Polygon,
|
||||
GeometryType::MultiPoint,
|
||||
GeometryType::MultiLineString,
|
||||
GeometryType::MultiPolygon,
|
||||
GeometryType::GeometryCollection,
|
||||
GeometryType::CircularString,
|
||||
GeometryType::CompoundCurve,
|
||||
GeometryType::CurvePolygon,
|
||||
GeometryType::MultiCurve,
|
||||
GeometryType::MultiSurface,
|
||||
GeometryType::Curve,
|
||||
GeometryType::Surface,
|
||||
GeometryType::PolyhedralSurface,
|
||||
GeometryType::TIN,
|
||||
GeometryType::Triangle
|
||||
GeometryType_Unknown,
|
||||
GeometryType_Point,
|
||||
GeometryType_LineString,
|
||||
GeometryType_Polygon,
|
||||
GeometryType_MultiPoint,
|
||||
GeometryType_MultiLineString,
|
||||
GeometryType_MultiPolygon,
|
||||
GeometryType_GeometryCollection,
|
||||
GeometryType_CircularString,
|
||||
GeometryType_CompoundCurve,
|
||||
GeometryType_CurvePolygon,
|
||||
GeometryType_MultiCurve,
|
||||
GeometryType_MultiSurface,
|
||||
GeometryType_Curve,
|
||||
GeometryType_Surface,
|
||||
GeometryType_PolyhedralSurface,
|
||||
GeometryType_TIN,
|
||||
GeometryType_Triangle
|
||||
};
|
||||
return values;
|
||||
}
|
||||
@@ -90,48 +97,48 @@ inline const char * const *EnumNamesGeometryType() {
|
||||
}
|
||||
|
||||
inline const char *EnumNameGeometryType(GeometryType e) {
|
||||
if (flatbuffers::IsOutRange(e, GeometryType::Unknown, GeometryType::Triangle)) return "";
|
||||
if (flatbuffers::IsOutRange(e, GeometryType_Unknown, GeometryType_Triangle)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesGeometryType()[index];
|
||||
}
|
||||
|
||||
enum class ColumnType : uint8_t {
|
||||
Byte = 0,
|
||||
UByte = 1,
|
||||
Bool = 2,
|
||||
Short = 3,
|
||||
UShort = 4,
|
||||
Int = 5,
|
||||
UInt = 6,
|
||||
Long = 7,
|
||||
ULong = 8,
|
||||
Float = 9,
|
||||
Double = 10,
|
||||
String = 11,
|
||||
Json = 12,
|
||||
DateTime = 13,
|
||||
Binary = 14,
|
||||
MIN = Byte,
|
||||
MAX = Binary
|
||||
enum ColumnType : uint8_t {
|
||||
ColumnType_Byte = 0,
|
||||
ColumnType_UByte = 1,
|
||||
ColumnType_Bool = 2,
|
||||
ColumnType_Short = 3,
|
||||
ColumnType_UShort = 4,
|
||||
ColumnType_Int = 5,
|
||||
ColumnType_UInt = 6,
|
||||
ColumnType_Long = 7,
|
||||
ColumnType_ULong = 8,
|
||||
ColumnType_Float = 9,
|
||||
ColumnType_Double = 10,
|
||||
ColumnType_String = 11,
|
||||
ColumnType_Json = 12,
|
||||
ColumnType_DateTime = 13,
|
||||
ColumnType_Binary = 14,
|
||||
ColumnType_MIN = ColumnType_Byte,
|
||||
ColumnType_MAX = ColumnType_Binary
|
||||
};
|
||||
|
||||
inline const ColumnType (&EnumValuesColumnType())[15] {
|
||||
static const ColumnType values[] = {
|
||||
ColumnType::Byte,
|
||||
ColumnType::UByte,
|
||||
ColumnType::Bool,
|
||||
ColumnType::Short,
|
||||
ColumnType::UShort,
|
||||
ColumnType::Int,
|
||||
ColumnType::UInt,
|
||||
ColumnType::Long,
|
||||
ColumnType::ULong,
|
||||
ColumnType::Float,
|
||||
ColumnType::Double,
|
||||
ColumnType::String,
|
||||
ColumnType::Json,
|
||||
ColumnType::DateTime,
|
||||
ColumnType::Binary
|
||||
ColumnType_Byte,
|
||||
ColumnType_UByte,
|
||||
ColumnType_Bool,
|
||||
ColumnType_Short,
|
||||
ColumnType_UShort,
|
||||
ColumnType_Int,
|
||||
ColumnType_UInt,
|
||||
ColumnType_Long,
|
||||
ColumnType_ULong,
|
||||
ColumnType_Float,
|
||||
ColumnType_Double,
|
||||
ColumnType_String,
|
||||
ColumnType_Json,
|
||||
ColumnType_DateTime,
|
||||
ColumnType_Binary
|
||||
};
|
||||
return values;
|
||||
}
|
||||
@@ -159,7 +166,7 @@ inline const char * const *EnumNamesColumnType() {
|
||||
}
|
||||
|
||||
inline const char *EnumNameColumnType(ColumnType e) {
|
||||
if (flatbuffers::IsOutRange(e, ColumnType::Byte, ColumnType::Binary)) return "";
|
||||
if (flatbuffers::IsOutRange(e, ColumnType_Byte, ColumnType_Binary)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesColumnType()[index];
|
||||
}
|
||||
@@ -216,17 +223,17 @@ struct Column FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffsetRequired(verifier, VT_NAME) &&
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyField<uint8_t>(verifier, VT_TYPE) &&
|
||||
VerifyField<uint8_t>(verifier, VT_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_TITLE) &&
|
||||
verifier.VerifyString(title()) &&
|
||||
VerifyOffset(verifier, VT_DESCRIPTION) &&
|
||||
verifier.VerifyString(description()) &&
|
||||
VerifyField<int32_t>(verifier, VT_WIDTH) &&
|
||||
VerifyField<int32_t>(verifier, VT_PRECISION) &&
|
||||
VerifyField<int32_t>(verifier, VT_SCALE) &&
|
||||
VerifyField<uint8_t>(verifier, VT_NULLABLE) &&
|
||||
VerifyField<uint8_t>(verifier, VT_UNIQUE) &&
|
||||
VerifyField<uint8_t>(verifier, VT_PRIMARY_KEY) &&
|
||||
VerifyField<int32_t>(verifier, VT_WIDTH, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_PRECISION, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_SCALE, 4) &&
|
||||
VerifyField<uint8_t>(verifier, VT_NULLABLE, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_UNIQUE, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_PRIMARY_KEY, 1) &&
|
||||
VerifyOffset(verifier, VT_METADATA) &&
|
||||
verifier.VerifyString(metadata()) &&
|
||||
verifier.EndTable();
|
||||
@@ -285,7 +292,7 @@ struct ColumnBuilder {
|
||||
inline flatbuffers::Offset<Column> CreateColumn(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||
FlatGeobuf::ColumnType type = FlatGeobuf::ColumnType::Byte,
|
||||
FlatGeobuf::ColumnType type = FlatGeobuf::ColumnType_Byte,
|
||||
flatbuffers::Offset<flatbuffers::String> title = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> description = 0,
|
||||
int32_t width = -1,
|
||||
@@ -313,7 +320,7 @@ inline flatbuffers::Offset<Column> CreateColumn(
|
||||
inline flatbuffers::Offset<Column> CreateColumnDirect(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *name = nullptr,
|
||||
FlatGeobuf::ColumnType type = FlatGeobuf::ColumnType::Byte,
|
||||
FlatGeobuf::ColumnType type = FlatGeobuf::ColumnType_Byte,
|
||||
const char *title = nullptr,
|
||||
const char *description = nullptr,
|
||||
int32_t width = -1,
|
||||
@@ -374,7 +381,7 @@ struct Crs FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_ORG) &&
|
||||
verifier.VerifyString(org()) &&
|
||||
VerifyField<int32_t>(verifier, VT_CODE) &&
|
||||
VerifyField<int32_t>(verifier, VT_CODE, 4) &&
|
||||
VerifyOffset(verifier, VT_NAME) &&
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyOffset(verifier, VT_DESCRIPTION) &&
|
||||
@@ -527,16 +534,16 @@ struct Header FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyOffset(verifier, VT_ENVELOPE) &&
|
||||
verifier.VerifyVector(envelope()) &&
|
||||
VerifyField<uint8_t>(verifier, VT_GEOMETRY_TYPE) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_Z) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_M) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_T) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_TM) &&
|
||||
VerifyField<uint8_t>(verifier, VT_GEOMETRY_TYPE, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_Z, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_M, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_T, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_HAS_TM, 1) &&
|
||||
VerifyOffset(verifier, VT_COLUMNS) &&
|
||||
verifier.VerifyVector(columns()) &&
|
||||
verifier.VerifyVectorOfTables(columns()) &&
|
||||
VerifyField<uint64_t>(verifier, VT_FEATURES_COUNT) &&
|
||||
VerifyField<uint16_t>(verifier, VT_INDEX_NODE_SIZE) &&
|
||||
VerifyField<uint64_t>(verifier, VT_FEATURES_COUNT, 8) &&
|
||||
VerifyField<uint16_t>(verifier, VT_INDEX_NODE_SIZE, 2) &&
|
||||
VerifyOffset(verifier, VT_CRS) &&
|
||||
verifier.VerifyTable(crs()) &&
|
||||
VerifyOffset(verifier, VT_TITLE) &&
|
||||
@@ -610,7 +617,7 @@ inline flatbuffers::Offset<Header> CreateHeader(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<double>> envelope = 0,
|
||||
FlatGeobuf::GeometryType geometry_type = FlatGeobuf::GeometryType::Unknown,
|
||||
FlatGeobuf::GeometryType geometry_type = FlatGeobuf::GeometryType_Unknown,
|
||||
bool has_z = false,
|
||||
bool has_m = false,
|
||||
bool has_t = false,
|
||||
@@ -644,7 +651,7 @@ inline flatbuffers::Offset<Header> CreateHeaderDirect(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *name = nullptr,
|
||||
const std::vector<double> *envelope = nullptr,
|
||||
FlatGeobuf::GeometryType geometry_type = FlatGeobuf::GeometryType::Unknown,
|
||||
FlatGeobuf::GeometryType geometry_type = FlatGeobuf::GeometryType_Unknown,
|
||||
bool has_z = false,
|
||||
bool has_m = false,
|
||||
bool has_t = false,
|
||||
|
||||
+9
-8
@@ -14,6 +14,7 @@
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "jsonpull/jsonpull.h"
|
||||
#include "text.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
#define POINT 0
|
||||
#define MULTIPOINT 1
|
||||
@@ -37,7 +38,7 @@ static std::vector<queued_feature> feature_queue;
|
||||
void ensureDim(size_t dim) {
|
||||
if (dim < 2) {
|
||||
fprintf(stderr, "Geometry has fewer than 2 dimensions: %zu\n", dim);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ drawvec readLinePart(std::vector<long long> &coords, size_t dim, double e, size_
|
||||
for (size_t i = start; i + dim - 1 < end; i += dim) {
|
||||
if (i + dim - 1 >= coords.size()) {
|
||||
fprintf(stderr, "Internal error: line segment %zu vs %zu\n", i + dim - 1, coords.size());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
for (size_t d = 0; d < dim; d++) {
|
||||
@@ -328,12 +329,12 @@ void readFeature(protozero::pbf_reader &pbf, size_t dim, double e, std::vector<s
|
||||
for (size_t i = 0; i + 1 < properties.size(); i += 2) {
|
||||
if (properties[i] >= keys.size()) {
|
||||
fprintf(stderr, "Out of bounds key: %zu in %zu\n", properties[i], keys.size());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (properties[i + 1] >= values.size()) {
|
||||
fprintf(stderr, "Out of bounds value: %zu in %zu\n", properties[i + 1], values.size());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
full_keys.push_back(keys[properties[i]]);
|
||||
@@ -354,12 +355,12 @@ void readFeature(protozero::pbf_reader &pbf, size_t dim, double e, std::vector<s
|
||||
for (size_t i = 0; i + 1 < misc.size(); i += 2) {
|
||||
if (misc[i] >= keys.size()) {
|
||||
fprintf(stderr, "Out of bounds key: %zu in %zu\n", misc[i], keys.size());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (misc[i + 1] >= values.size()) {
|
||||
fprintf(stderr, "Out of bounds value: %zu in %zu\n", misc[i + 1], values.size());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
other.insert(std::pair<std::string, serial_val>(keys[misc[i]], values[misc[i + 1]]));
|
||||
@@ -464,9 +465,9 @@ void runQueue() {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
if (pthread_create_wrap(&pthreads[i], NULL, run_parse_feature, &qra[i]) != 0) {
|
||||
if (pthread_create(&pthreads[i], NULL, run_parse_feature, &qra[i]) != 0) {
|
||||
perror("pthread_create");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -9,6 +9,7 @@
|
||||
#include "csv.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "options.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fname, int layer, std::string layername) {
|
||||
FILE *f;
|
||||
@@ -19,7 +20,7 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
|
||||
f = fopen(fname.c_str(), "r");
|
||||
if (f == NULL) {
|
||||
perror(fname.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +32,7 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
|
||||
std::string err = check_utf8(s);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s: %s\n", fname.c_str(), err.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
|
||||
header = csv_split(s.c_str());
|
||||
@@ -53,7 +54,7 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
|
||||
|
||||
if (latcol < 0 || loncol < 0) {
|
||||
fprintf(stderr, "%s: Can't find \"lat\" and \"lon\" columns\n", fname.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CSV);
|
||||
}
|
||||
|
||||
size_t seq = 0;
|
||||
@@ -61,7 +62,7 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
|
||||
std::string err = check_utf8(s);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s: %s\n", fname.c_str(), err.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
|
||||
seq++;
|
||||
@@ -69,7 +70,7 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
|
||||
|
||||
if (line.size() != header.size()) {
|
||||
fprintf(stderr, "%s:%zu: Mismatched column count: %zu in line, %zu in header\n", fname.c_str(), seq + 1, line.size(), header.size());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CSV);
|
||||
}
|
||||
|
||||
if (line[loncol].empty() || line[latcol].empty()) {
|
||||
@@ -133,7 +134,7 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
|
||||
if (fname.size() != 0) {
|
||||
if (fclose(f) != 0) {
|
||||
perror("fclose");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -32,7 +32,7 @@ static void json_context(json_object *j) {
|
||||
sprintf(s + 497, "...");
|
||||
}
|
||||
|
||||
fprintf(stderr, "In JSON object %s\n", s);
|
||||
fprintf(stderr, "in JSON object %s\n", s);
|
||||
free(s); // stringify
|
||||
}
|
||||
|
||||
@@ -45,9 +45,11 @@ void parse_json(json_feature_action *jfa, json_pull *jp) {
|
||||
json_object *j = json_read(jp);
|
||||
if (j == NULL) {
|
||||
if (jp->error != NULL) {
|
||||
fprintf(stderr, "%s:%d: %s\n", jfa->fname.c_str(), jp->line, jp->error);
|
||||
fprintf(stderr, "%s:%d: %s: ", jfa->fname.c_str(), jp->line, jp->error);
|
||||
if (jp->root != NULL) {
|
||||
json_context(jp->root);
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +142,7 @@ void parse_json(json_feature_action *jfa, json_pull *jp) {
|
||||
|
||||
json_object *geometry = json_hash_get(j, "geometry");
|
||||
if (geometry == NULL) {
|
||||
fprintf(stderr, "%s:%d: feature with no geometry\n", jfa->fname.c_str(), jp->line);
|
||||
fprintf(stderr, "%s:%d: feature with no geometry: ", jfa->fname.c_str(), jp->line);
|
||||
json_context(j);
|
||||
json_free(j);
|
||||
continue;
|
||||
@@ -148,7 +150,7 @@ void parse_json(json_feature_action *jfa, json_pull *jp) {
|
||||
|
||||
json_object *properties = json_hash_get(j, "properties");
|
||||
if (properties == NULL || (properties->type != JSON_HASH && properties->type != JSON_NULL)) {
|
||||
fprintf(stderr, "%s:%d: feature without properties hash\n", jfa->fname.c_str(), jp->line);
|
||||
fprintf(stderr, "%s:%d: feature without properties hash: ", jfa->fname.c_str(), jp->line);
|
||||
json_context(j);
|
||||
json_free(j);
|
||||
continue;
|
||||
|
||||
+6
-5
@@ -39,13 +39,14 @@
|
||||
#include "mvt.hpp"
|
||||
#include "geojson-loop.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "errors.hpp"
|
||||
|
||||
int serialize_geojson_feature(struct serialization_state *sst, json_object *geometry, json_object *properties, json_object *id, int layer, json_object *tippecanoe, json_object *feature, std::string layername) {
|
||||
json_object *geometry_type = json_hash_get(geometry, "type");
|
||||
if (geometry_type == NULL) {
|
||||
static int warned = 0;
|
||||
if (!warned) {
|
||||
fprintf(stderr, "%s:%d: null geometry (additional not reported)\n", sst->fname, sst->line);
|
||||
fprintf(stderr, "%s:%d: null geometry (additional not reported): ", sst->fname, sst->line);
|
||||
json_context(feature);
|
||||
warned = 1;
|
||||
}
|
||||
@@ -54,14 +55,14 @@ int serialize_geojson_feature(struct serialization_state *sst, json_object *geom
|
||||
}
|
||||
|
||||
if (geometry_type->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s:%d: geometry type is not a string\n", sst->fname, sst->line);
|
||||
fprintf(stderr, "%s:%d: geometry type is not a string: ", sst->fname, sst->line);
|
||||
json_context(feature);
|
||||
return 0;
|
||||
}
|
||||
|
||||
json_object *coordinates = json_hash_get(geometry, "coordinates");
|
||||
if (coordinates == NULL || coordinates->type != JSON_ARRAY) {
|
||||
fprintf(stderr, "%s:%d: feature without coordinates array\n", sst->fname, sst->line);
|
||||
fprintf(stderr, "%s:%d: feature without coordinates array: ", sst->fname, sst->line);
|
||||
json_context(feature);
|
||||
return 0;
|
||||
}
|
||||
@@ -73,7 +74,7 @@ int serialize_geojson_feature(struct serialization_state *sst, json_object *geom
|
||||
}
|
||||
}
|
||||
if (t >= GEOM_TYPES) {
|
||||
fprintf(stderr, "%s:%d: Can't handle geometry type %s\n", sst->fname, sst->line, geometry_type->value.string.string);
|
||||
fprintf(stderr, "%s:%d: Can't handle geometry type %s: ", sst->fname, sst->line, geometry_type->value.string.string);
|
||||
json_context(feature);
|
||||
return 0;
|
||||
}
|
||||
@@ -332,7 +333,7 @@ struct json_pull *json_begin_map(char *map, long long len) {
|
||||
struct jsonmap *jm = new jsonmap;
|
||||
if (jm == NULL) {
|
||||
perror("Out of memory");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
|
||||
jm->map = map;
|
||||
|
||||
+475
-22
@@ -20,8 +20,8 @@
|
||||
#include "serial.hpp"
|
||||
#include "main.hpp"
|
||||
#include "options.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
static int pnpoly(drawvec &vert, size_t start, size_t nvert, long long testx, long long testy);
|
||||
static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
|
||||
|
||||
drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y) {
|
||||
@@ -39,7 +39,7 @@ drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsi
|
||||
|
||||
if (!deserialize_byte_io(meta, &d.op, geompos)) {
|
||||
fprintf(stderr, "Internal error: Unexpected end of file in geometry\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
if (d.op == VT_END) {
|
||||
break;
|
||||
@@ -92,6 +92,17 @@ void to_tile_scale(drawvec &geom, int z, int detail) {
|
||||
}
|
||||
}
|
||||
|
||||
drawvec from_tile_scale(drawvec const &geom, int z, int detail) {
|
||||
drawvec out;
|
||||
for (size_t i = 0; i < geom.size(); i++) {
|
||||
draw d = geom[i];
|
||||
d.x <<= (32 - detail - z);
|
||||
d.y <<= (32 - detail - z);
|
||||
out.push_back(d);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
drawvec remove_noop(drawvec geom, int type, int shift) {
|
||||
// first pass: remove empty linetos
|
||||
|
||||
@@ -159,13 +170,88 @@ drawvec remove_noop(drawvec geom, int type, int shift) {
|
||||
return out;
|
||||
}
|
||||
|
||||
double get_area(drawvec &geom, size_t i, size_t j) {
|
||||
double get_area_scaled(const drawvec &geom, size_t i, size_t j) {
|
||||
const double max_exact_double = (double) ((1LL << 53) - 1);
|
||||
|
||||
// keep scaling the geometry down until we can calculate its area without overflow
|
||||
for (long long scale = 2; scale < (1LL << 30); scale *= 2) {
|
||||
long long bx = geom[i].x;
|
||||
long long by = geom[i].y;
|
||||
bool again = false;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Shoelace_formula
|
||||
double area = 0;
|
||||
for (size_t k = i; k < j; k++) {
|
||||
area += (double) ((geom[k].x - bx) / scale) * (double) ((geom[i + ((k - i + 1) % (j - i))].y - by) / scale);
|
||||
if (std::fabs(area) >= max_exact_double) {
|
||||
again = true;
|
||||
break;
|
||||
}
|
||||
area -= (double) ((geom[k].y - by) / scale) * (double) ((geom[i + ((k - i + 1) % (j - i))].x - bx) / scale);
|
||||
if (std::fabs(area) >= max_exact_double) {
|
||||
again = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (again) {
|
||||
continue;
|
||||
} else {
|
||||
area /= 2;
|
||||
return area * scale * scale;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "get_area_scaled: can't happen\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
double get_area(const drawvec &geom, size_t i, size_t j) {
|
||||
const double max_exact_double = (double) ((1LL << 53) - 1);
|
||||
|
||||
// Coordinates in `geom` are 40-bit integers, so there is no good way
|
||||
// to multiply them without possible precision loss. Since they probably
|
||||
// do not use the full precision, shift them nearer to the origin so
|
||||
// their product is more likely to be exactly representable as a double.
|
||||
//
|
||||
// (In practice they are actually 34-bit integers: 32 bits for the
|
||||
// Mercator world plane, plus another two bits so features can stick
|
||||
// off either the left or right side. But that is still too many bits
|
||||
// for the product to fit either in a 64-bit long long or in a
|
||||
// double where the largest exact integer is 2^53.)
|
||||
//
|
||||
// If the intermediate calculation still exceeds 2^53, start trying to
|
||||
// recalculate the area by scaling down the geometry. This will not
|
||||
// produce as precise an area, but it will still be close, and the
|
||||
// sign will be correct, which is more important, since the sign
|
||||
// determines the winding order of the rings. We can then use that
|
||||
// sign with this generally more precise area calculation.
|
||||
|
||||
long long bx = geom[i].x;
|
||||
long long by = geom[i].y;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Shoelace_formula
|
||||
double area = 0;
|
||||
bool overflow = false;
|
||||
for (size_t k = i; k < j; k++) {
|
||||
area += (long double) geom[k].x * (long double) geom[i + ((k - i + 1) % (j - i))].y;
|
||||
area -= (long double) geom[k].y * (long double) geom[i + ((k - i + 1) % (j - i))].x;
|
||||
area += (double) (geom[k].x - bx) * (double) (geom[i + ((k - i + 1) % (j - i))].y - by);
|
||||
if (std::fabs(area) >= max_exact_double) {
|
||||
overflow = true;
|
||||
}
|
||||
area -= (double) (geom[k].y - by) * (double) (geom[i + ((k - i + 1) % (j - i))].x - bx);
|
||||
if (std::fabs(area) >= max_exact_double) {
|
||||
overflow = true;
|
||||
}
|
||||
}
|
||||
area /= 2;
|
||||
|
||||
if (overflow) {
|
||||
double scaled_area = get_area_scaled(geom, i, j);
|
||||
if ((area < 0 && scaled_area > 0) || (area > 0 && scaled_area < 0)) {
|
||||
area = -area;
|
||||
}
|
||||
}
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
@@ -210,7 +296,7 @@ static void decode_clipped(mapbox::geometry::multi_polygon<long long> &t, drawve
|
||||
|
||||
if ((j == 0 && area < 0) || (j != 0 && area > 0)) {
|
||||
fprintf(stderr, "Ring area has wrong sign: %f for %zu\n", area, j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
for (size_t k = 0; k < ring.size(); k++) {
|
||||
@@ -316,7 +402,7 @@ drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip) {
|
||||
|
||||
fclose(f);
|
||||
fprintf(stderr, "Internal error: Polygon cleaning failed. Log in /tmp/wagyu.log\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
drawvec ret;
|
||||
@@ -335,7 +421,7 @@ The name of W. Randolph Franklin may not be used to endorse or promote products
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
static int pnpoly(drawvec &vert, size_t start, size_t nvert, long long testx, long long testy) {
|
||||
int pnpoly(const drawvec &vert, size_t start, size_t nvert, long long testx, long long testy) {
|
||||
size_t i, j;
|
||||
bool c = false;
|
||||
for (i = 0, j = nvert - 1; i < nvert; j = i++) {
|
||||
@@ -501,7 +587,7 @@ drawvec simple_clip_poly(drawvec &geom, long long minx, long long miny, long lon
|
||||
i = j - 1;
|
||||
} else {
|
||||
fprintf(stderr, "Unexpected operation in polygon %d\n", (int) geom[i].op);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,9 +601,11 @@ drawvec simple_clip_poly(drawvec &geom, int z, int buffer) {
|
||||
return simple_clip_poly(geom, -clip_buffer, -clip_buffer, area + clip_buffer, area + clip_buffer);
|
||||
}
|
||||
|
||||
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area) {
|
||||
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature) {
|
||||
drawvec out;
|
||||
const long long pixel = (1 << (32 - detail - z)) * tiny_polygon_size;
|
||||
const double pixel = (1LL << (32 - detail - z)) * (double) tiny_polygon_size;
|
||||
bool includes_real = false;
|
||||
bool includes_dust = false;
|
||||
|
||||
*reduced = true;
|
||||
bool included_last_outer = false;
|
||||
@@ -544,12 +632,12 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
||||
// inner rings must just have their area de-accumulated rather
|
||||
// than being drawn since we don't really know where they are.
|
||||
|
||||
// i.e., this ring (inner or outer) is small enough that we are including it
|
||||
// i.e., this outer ring is small enough that we are including it
|
||||
// in a tiny polygon rather than letting it represent itself,
|
||||
// OR it is an inner ring and we haven't output an outer ring for it to be
|
||||
// cut out of, so we are just subtracting its area from the tiny polygon
|
||||
// rather than trying to deal with it geometrically
|
||||
if (std::fabs(area) <= pixel * pixel || (area < 0 && !included_last_outer)) {
|
||||
if ((area > 0 && area <= pixel * pixel) || (area < 0 && !included_last_outer)) {
|
||||
// printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
|
||||
|
||||
*accum_area += area;
|
||||
@@ -561,6 +649,7 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
||||
out.push_back(draw(VT_LINETO, geom[i].x - pixel / 2 + pixel, geom[i].y - pixel / 2 + pixel));
|
||||
out.push_back(draw(VT_LINETO, geom[i].x - pixel / 2, geom[i].y - pixel / 2 + pixel));
|
||||
out.push_back(draw(VT_LINETO, geom[i].x - pixel / 2, geom[i].y - pixel / 2));
|
||||
includes_dust = true;
|
||||
|
||||
*accum_area -= pixel * pixel;
|
||||
}
|
||||
@@ -570,16 +659,20 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
||||
}
|
||||
}
|
||||
// i.e., this ring is large enough that it gets to represent itself
|
||||
// or it is a tiny hole out of a real polygon, which we are still treating
|
||||
// as a real geometry because otherwise we can accumulate enough tiny holes
|
||||
// that we will drop the next several outer rings getting back up to 0.
|
||||
else {
|
||||
// printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
|
||||
|
||||
for (size_t k = i; k <= j && k < geom.size(); k++) {
|
||||
for (size_t k = i; k < j && k < geom.size(); k++) {
|
||||
out.push_back(geom[k]);
|
||||
}
|
||||
|
||||
// which means that the overall polygon has a real geometry,
|
||||
// which means that it gets to be simplified.
|
||||
*reduced = false;
|
||||
includes_real = true;
|
||||
|
||||
if (area > 0) {
|
||||
included_last_outer = true;
|
||||
@@ -597,6 +690,28 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
out.push_back(geom[i]);
|
||||
includes_real = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!includes_real) {
|
||||
if (includes_dust) {
|
||||
// this geometry is just dust, so if there is another feature that
|
||||
// contributed to the dust that is larger than this feature,
|
||||
// keep its attributes instead of this one that just happened to be
|
||||
// the one that hit the threshold of survival.
|
||||
|
||||
if (tiny_feature->extent > this_feature->extent) {
|
||||
*this_feature = *tiny_feature;
|
||||
tiny_feature->extent = 0;
|
||||
}
|
||||
} else {
|
||||
// this is a feature that we are throwing away, so hang on to it
|
||||
// attributes if it is bigger than the biggest one we threw away so far
|
||||
|
||||
if (this_feature->extent > tiny_feature->extent) {
|
||||
*tiny_feature = *this_feature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,9 +869,17 @@ static void douglas_peucker(drawvec &geom, int start, int n, double e, size_t ke
|
||||
|
||||
double distance = std::fabs(temp_dist);
|
||||
|
||||
if ((distance > e || kept < retain) && distance > max_distance) {
|
||||
farthest_element_index = i;
|
||||
max_distance = distance;
|
||||
if ((distance > e || kept < retain) && distance >= max_distance) {
|
||||
if (distance > max_distance) {
|
||||
farthest_element_index = i;
|
||||
max_distance = distance;
|
||||
} else if (geom[i].y > geom[farthest_element_index].y) {
|
||||
farthest_element_index = i;
|
||||
max_distance = distance;
|
||||
} else if (geom[i].y == geom[farthest_element_index].y && geom[i].x == geom[farthest_element_index].x) {
|
||||
farthest_element_index = i;
|
||||
max_distance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,7 +934,7 @@ drawvec impose_tile_boundaries(drawvec &geom, long long extent) {
|
||||
return out;
|
||||
}
|
||||
|
||||
drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes) {
|
||||
drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes, std::set<std::pair<long long, long long>> &kept) {
|
||||
int res = 1 << (32 - detail - z);
|
||||
long long area = 1LL << (32 - z);
|
||||
|
||||
@@ -824,6 +947,11 @@ drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds,
|
||||
geom[i].necessary = 1;
|
||||
}
|
||||
|
||||
auto found = kept.find(std::pair<long long, long long>((long long) geom[i].x, (long long) geom[i].y));
|
||||
if (found != kept.end()) {
|
||||
geom[i].necessary = 1;
|
||||
}
|
||||
|
||||
if (prevent[P_SIMPLIFY_SHARED_NODES]) {
|
||||
auto pt = std::lower_bound(shared_nodes.begin(), shared_nodes.end(), geom[i]);
|
||||
if (pt != shared_nodes.end() && *pt == geom[i]) {
|
||||
@@ -848,9 +976,28 @@ drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds,
|
||||
geom[i].necessary = 1;
|
||||
geom[j - 1].necessary = 1;
|
||||
|
||||
if (j - i > 1) {
|
||||
douglas_peucker(geom, i, j - i, res * simplification, 2, retain);
|
||||
size_t start = i;
|
||||
for (size_t k = start + 1; k <= j - 1; k++) {
|
||||
if (geom[k].necessary) {
|
||||
if (k - start > 1) {
|
||||
// empirical mapping from douglas-peucker simplifications
|
||||
// to visvalingam simplifications that yield similar
|
||||
// output sizes
|
||||
double sim = simplification * (0.1596 * z + 0.878);
|
||||
double scale = (res * sim) * (res * sim);
|
||||
scale = exp(1.002 * log(scale) + 0.3043);
|
||||
|
||||
if (additional[A_VISVALINGAM]) {
|
||||
visvalingam(geom, start, k + 1, scale, retain);
|
||||
} else {
|
||||
douglas_peucker(geom, start, k + 1 - start, res * simplification, 2, retain);
|
||||
}
|
||||
}
|
||||
|
||||
start = k;
|
||||
}
|
||||
}
|
||||
|
||||
i = j - 1;
|
||||
}
|
||||
}
|
||||
@@ -859,6 +1006,7 @@ drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds,
|
||||
for (size_t i = 0; i < geom.size(); i++) {
|
||||
if (geom[i].necessary) {
|
||||
out.push_back(geom[i]);
|
||||
kept.insert(std::pair<long long, long long>((long long) geom[i].x, (long long) geom[i].y));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1023,7 +1171,7 @@ drawvec fix_polygon(drawvec &geom) {
|
||||
outer = 0;
|
||||
} else {
|
||||
fprintf(stderr, "Internal error: polygon ring begins with %d, not moveto\n", geom[i].op);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1266,7 +1414,7 @@ drawvec stairstep(drawvec &geom, int z, int detail) {
|
||||
// out.push_back(draw(VT_LINETO, xx, yy));
|
||||
} else {
|
||||
fprintf(stderr, "Can't happen: stairstepping lineto with no moveto\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1277,3 +1425,308 @@ drawvec stairstep(drawvec &geom, int z, int detail) {
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// https://github.com/Turfjs/turf/blob/master/packages/turf-center-of-mass/index.ts
|
||||
//
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2019 Morgan Herlocker
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
// this software and associated documentation files (the "Software"), to deal in
|
||||
// the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
draw centerOfMass(const drawvec &dv, size_t start, size_t end, draw centre) {
|
||||
std::vector<draw> coords;
|
||||
for (size_t i = start; i < end; i++) {
|
||||
coords.push_back(dv[i]);
|
||||
}
|
||||
|
||||
// First, we neutralize the feature (set it around coordinates [0,0]) to prevent rounding errors
|
||||
// We take any point to translate all the points around 0
|
||||
draw translation = centre;
|
||||
double sx = 0;
|
||||
double sy = 0;
|
||||
double sArea = 0;
|
||||
draw pi, pj;
|
||||
double xi, xj, yi, yj, a;
|
||||
|
||||
std::vector<draw> neutralizedPoints;
|
||||
for (size_t i = 0; i < coords.size(); i++) {
|
||||
neutralizedPoints.push_back(draw(coords[i].op, coords[i].x - translation.x, coords[i].y - translation.y));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < coords.size() - 1; i++) {
|
||||
// pi is the current point
|
||||
pi = neutralizedPoints[i];
|
||||
xi = pi.x;
|
||||
yi = pi.y;
|
||||
|
||||
// pj is the next point (pi+1)
|
||||
pj = neutralizedPoints[i + 1];
|
||||
xj = pj.x;
|
||||
yj = pj.y;
|
||||
|
||||
// a is the common factor to compute the signed area and the final coordinates
|
||||
a = xi * yj - xj * yi;
|
||||
|
||||
// sArea is the sum used to compute the signed area
|
||||
sArea += a;
|
||||
|
||||
// sx and sy are the sums used to compute the final coordinates
|
||||
sx += (xi + xj) * a;
|
||||
sy += (yi + yj) * a;
|
||||
}
|
||||
|
||||
// Shape has no area: fallback on turf.centroid
|
||||
if (sArea == 0) {
|
||||
return centre;
|
||||
} else {
|
||||
// Compute the signed area, and factorize 1/6A
|
||||
double area = sArea * 0.5;
|
||||
double areaFactor = 1 / (6 * area);
|
||||
|
||||
// Compute the final coordinates, adding back the values that have been neutralized
|
||||
return draw(VT_MOVETO, translation.x + areaFactor * sx, translation.y + areaFactor * sy);
|
||||
}
|
||||
}
|
||||
|
||||
double label_goodness(const drawvec &dv, size_t start, size_t count, long long x, long long y) {
|
||||
if (!pnpoly(dv, start, count, x, y)) {
|
||||
return 0; // outside the polygon is as bad as it gets
|
||||
}
|
||||
|
||||
double closest = INFINITY; // square of closest distance to the border
|
||||
|
||||
for (size_t i = start; i < start + count; i++) {
|
||||
double dx = dv[i].x - x;
|
||||
double dy = dv[i].y - y;
|
||||
double squared = dx * dx + dy * dy;
|
||||
if (squared < closest) {
|
||||
closest = squared;
|
||||
}
|
||||
}
|
||||
|
||||
return sqrt(closest);
|
||||
}
|
||||
|
||||
// Generate a label point for a polygon feature.
|
||||
//
|
||||
// A good label point will be near the center of the feature and far from any border.
|
||||
//
|
||||
// Polylabel is supposed to be able to do this optimally, but can be quite slow
|
||||
// and sometimes still produces some odd results.
|
||||
//
|
||||
// The centroid is often off-center because edges with many curves will be
|
||||
// weighted higher than edges with straight lines.
|
||||
//
|
||||
// Turf's center-of-mass algorithm generally does a good job, but can sometimes
|
||||
// find a point that is outside the bounds of the polygon or quite close to the edge.
|
||||
//
|
||||
// So prefer the center of mass, but if it produces something too close to the border
|
||||
// or outside the polygon, try a series of gridded points within the feature's bounding box
|
||||
// until something works well, or if nothing does after several iterations, use the
|
||||
// least-bad option.
|
||||
|
||||
drawvec polygon_to_anchor(const drawvec &geom) {
|
||||
size_t start = 0, end = 0;
|
||||
size_t best_area = 0;
|
||||
|
||||
for (size_t i = 0; i < geom.size(); i++) {
|
||||
if (geom[i].op == VT_MOVETO) {
|
||||
size_t j;
|
||||
for (j = i + 1; j < geom.size(); j++) {
|
||||
if (geom[j].op != VT_LINETO) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double area = get_area(geom, i, j);
|
||||
if (area > best_area) {
|
||||
start = i;
|
||||
end = j;
|
||||
best_area = area;
|
||||
}
|
||||
|
||||
i = j - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (best_area > 0) {
|
||||
long long xsum = 0;
|
||||
long long ysum = 0;
|
||||
size_t count = 0;
|
||||
long long xmin = LLONG_MAX, ymin = LLONG_MAX, xmax = LLONG_MIN, ymax = LLONG_MIN;
|
||||
|
||||
// Calculate centroid and bounding box.
|
||||
// start + 1 to exclude the first point, which is duplicated as the last
|
||||
for (size_t k = start + 1; k < end; k++) {
|
||||
xsum += geom[k].x;
|
||||
ysum += geom[k].y;
|
||||
count++;
|
||||
|
||||
xmin = std::min(xmin, geom[k].x);
|
||||
ymin = std::min(ymin, geom[k].y);
|
||||
xmax = std::max(xmax, geom[k].x);
|
||||
ymax = std::max(ymax, geom[k].y);
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
draw centroid(VT_MOVETO, xsum / count, ysum / count);
|
||||
draw d = centerOfMass(geom, start, end, centroid);
|
||||
|
||||
double radius = sqrt(best_area / M_PI);
|
||||
double goodness_threshold = radius / 5;
|
||||
|
||||
double goodness = label_goodness(geom, start, end - start - 1, d.x, d.y);
|
||||
if (goodness < goodness_threshold) {
|
||||
// Label is too close to the border or outside it,
|
||||
// so try some other possible points
|
||||
|
||||
for (long long sub = 2;
|
||||
sub < 32 && (xmax - xmin) > 2 * sub && (ymax - ymin) > 2 * sub;
|
||||
sub *= 2) {
|
||||
for (long long x = 1; x < sub; x++) {
|
||||
for (long long y = 1; y < sub; y++) {
|
||||
draw maybe(VT_MOVETO,
|
||||
xmin + x * (xmax - xmin) / sub,
|
||||
ymin + y * (ymax - ymin) / sub);
|
||||
|
||||
double maybe_goodness = label_goodness(geom, start, end - start, maybe.x, maybe.y);
|
||||
if (maybe_goodness > goodness) {
|
||||
// better than the previous
|
||||
d = maybe;
|
||||
goodness = maybe_goodness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (goodness > goodness_threshold) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// There is nothing really good. Is the centroid maybe better?
|
||||
// If not, we're stuck with whatever the best we found was.
|
||||
if (label_goodness(geom, start, end - start, centroid.x, centroid.y) > goodness) {
|
||||
d = centroid;
|
||||
}
|
||||
}
|
||||
|
||||
drawvec dv;
|
||||
dv.push_back(d);
|
||||
return dv;
|
||||
}
|
||||
}
|
||||
|
||||
return drawvec();
|
||||
}
|
||||
|
||||
drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, unsigned long long label_point) {
|
||||
drawvec out;
|
||||
|
||||
// anchor point in world coordinates
|
||||
unsigned wx, wy;
|
||||
decode_index(label_point, &wx, &wy);
|
||||
|
||||
// upper left of tile in world coordinates
|
||||
long long tx1 = 0, ty1 = 0;
|
||||
// lower right of tile in world coordinates;
|
||||
long long tx2 = 1LL << 32; // , ty2 = 1LL << 32;
|
||||
if (z != 0) {
|
||||
tx1 = (long long) tx << (32 - z);
|
||||
ty1 = (long long) ty << (32 - z);
|
||||
|
||||
tx2 = (long long) (tx + 1) << (32 - z);
|
||||
// ty2 = (long long) (ty + 1) << (32 - z);
|
||||
}
|
||||
|
||||
// upper left of feature in world coordinates
|
||||
long long bx1 = LLONG_MAX, by1 = LLONG_MAX;
|
||||
// lower right of feature in world coordinates;
|
||||
long long bx2 = LLONG_MIN, by2 = LLONG_MIN;
|
||||
|
||||
for (auto const &g : geom) {
|
||||
bx1 = std::min(bx1, g.x + tx1);
|
||||
by1 = std::min(by1, g.y + ty1);
|
||||
|
||||
bx2 = std::max(bx2, g.x + tx1);
|
||||
by2 = std::max(by2, g.y + ty1);
|
||||
}
|
||||
|
||||
if (bx1 > bx2 || by1 > by2) {
|
||||
return out;
|
||||
}
|
||||
|
||||
// labels repeat every 0.3 tiles at z0
|
||||
double spiral_dist = 0.3;
|
||||
if (z > 0) {
|
||||
// only every ~6 tiles by the time we get to z15
|
||||
spiral_dist = spiral_dist * exp(log(z) * 1.2);
|
||||
}
|
||||
|
||||
const long long label_spacing = spiral_dist * (tx2 - tx1);
|
||||
|
||||
long long x1 = floor(std::min(bx1 - wx, bx2 - wx) / label_spacing);
|
||||
long long x2 = ceil(std::max(bx1 - wx, bx2 - wx) / label_spacing);
|
||||
|
||||
long long y1 = floor(std::min(by1 - wy, by2 - wy) / label_spacing - 0.5);
|
||||
long long y2 = ceil(std::max(by1 - wy, by2 - wy) / label_spacing);
|
||||
|
||||
for (long long lx = x1; lx <= x2; lx++) {
|
||||
for (long long ly = y1; ly <= y2; ly++) {
|
||||
long long x = lx * label_spacing + wx;
|
||||
long long y = ly * label_spacing + wy;
|
||||
|
||||
if (((unsigned long long) lx & 1) == 1) {
|
||||
y += label_spacing / 2;
|
||||
}
|
||||
|
||||
if (x < bx1 || x > bx2 || y < by1 || y > by2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (size_t a = 0; a < geom.size(); a++) {
|
||||
if (geom[a].op == VT_MOVETO) {
|
||||
size_t b;
|
||||
for (b = a + 1; b < geom.size(); b++) {
|
||||
if (geom[b].op != VT_LINETO) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If it's the central label, it's the best we've got,
|
||||
// so accept it in any case. If it's from the outer spiral,
|
||||
// don't use it if it's too close to a border.
|
||||
if (lx == 0 && ly == 0) {
|
||||
out.push_back(draw(VT_MOVETO, x - tx1, y - ty1));
|
||||
break;
|
||||
} else {
|
||||
double tilesize = 1LL << (32 - z);
|
||||
double goodness_threshold = tilesize / 100;
|
||||
if (label_goodness(geom, a, b - a, x - tx1, y - ty1) > goodness_threshold) {
|
||||
out.push_back(draw(VT_MOVETO, x - tx1, y - ty1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
a = b - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
+11
-3
@@ -2,8 +2,10 @@
|
||||
#define GEOMETRY_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <atomic>
|
||||
#include <sqlite3.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define VT_POINT 1
|
||||
#define VT_LINE 2
|
||||
@@ -55,29 +57,35 @@ struct draw {
|
||||
};
|
||||
|
||||
typedef std::vector<draw> drawvec;
|
||||
struct serial_feature;
|
||||
|
||||
drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y);
|
||||
void to_tile_scale(drawvec &geom, int z, int detail);
|
||||
drawvec from_tile_scale(drawvec const &geom, int z, int detail);
|
||||
drawvec remove_noop(drawvec geom, int type, int shift);
|
||||
drawvec clip_point(drawvec &geom, int z, long long buffer);
|
||||
drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip);
|
||||
drawvec simple_clip_poly(drawvec &geom, int z, int buffer);
|
||||
drawvec close_poly(drawvec &geom);
|
||||
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area);
|
||||
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature);
|
||||
drawvec clip_lines(drawvec &geom, int z, long long buffer);
|
||||
drawvec stairstep(drawvec &geom, int z, int detail);
|
||||
bool point_within_tile(long long x, long long y, int z);
|
||||
int quick_check(long long *bbox, int z, long long buffer);
|
||||
drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes);
|
||||
drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes, std::set<std::pair<long long, long long>> &kept);
|
||||
drawvec reorder_lines(drawvec &geom);
|
||||
drawvec fix_polygon(drawvec &geom);
|
||||
std::vector<drawvec> chop_polygon(std::vector<drawvec> &geoms);
|
||||
void check_polygon(drawvec &geom);
|
||||
double get_area(drawvec &geom, size_t i, size_t j);
|
||||
double get_area(const drawvec &geom, size_t i, size_t j);
|
||||
double get_mp_area(drawvec &geom);
|
||||
drawvec polygon_to_anchor(const drawvec &geom);
|
||||
drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, unsigned long long label_point);
|
||||
|
||||
drawvec simple_clip_poly(drawvec &geom, long long x1, long long y1, long long x2, long long y2);
|
||||
drawvec clip_lines(drawvec &geom, long long x1, long long y1, long long x2, long long y2);
|
||||
drawvec clip_point(drawvec &geom, long long x1, long long y1, long long x2, long long y2);
|
||||
void visvalingam(drawvec &ls, size_t start, size_t end, double threshold, size_t retain);
|
||||
int pnpoly(const drawvec &vert, size_t start, size_t nvert, long long testx, long long testy);
|
||||
|
||||
#endif
|
||||
|
||||
+18
-17
@@ -12,6 +12,7 @@
|
||||
#include "text.hpp"
|
||||
#include "geojson-loop.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "errors.hpp"
|
||||
|
||||
int fail = EXIT_SUCCESS;
|
||||
bool wrap = false;
|
||||
@@ -198,7 +199,7 @@ void out(std::string const &s, int type, json_object *properties) {
|
||||
|
||||
if (type != buffered_type) {
|
||||
fprintf(stderr, "Error: mix of bare geometries and features\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,13 +210,13 @@ void join_csv(json_object *j) {
|
||||
std::string s = csv_getline(csvfile);
|
||||
if (s.size() == 0) {
|
||||
fprintf(stderr, "Couldn't get column header from CSV file\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CSV);
|
||||
}
|
||||
|
||||
std::string err = check_utf8(s);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s\n", err.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
|
||||
header = csv_split(s.c_str());
|
||||
@@ -226,7 +227,7 @@ void join_csv(json_object *j) {
|
||||
|
||||
if (header.size() == 0) {
|
||||
fprintf(stderr, "No columns in CSV header \"%s\"\n", s.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CSV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +260,7 @@ void join_csv(json_object *j) {
|
||||
|
||||
if (joinkey < prev_joinkey) {
|
||||
fprintf(stderr, "GeoJSON file is out of sort: \"%s\" follows \"%s\"\n", joinkey.c_str(), prev_joinkey.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
prev_joinkey = joinkey;
|
||||
|
||||
@@ -279,7 +280,7 @@ void join_csv(json_object *j) {
|
||||
std::string err = check_utf8(s);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s\n", err.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
|
||||
fields = csv_split(s.c_str());
|
||||
@@ -290,7 +291,7 @@ void join_csv(json_object *j) {
|
||||
|
||||
if (fields.size() > 0 && fields[0] < prevkey) {
|
||||
fprintf(stderr, "CSV file is out of sort: \"%s\" follows \"%s\"\n", fields[0].c_str(), prevkey.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CSV);
|
||||
}
|
||||
|
||||
if (fields.size() > 0 && fields[0] >= joinkey) {
|
||||
@@ -310,7 +311,7 @@ void join_csv(json_object *j) {
|
||||
properties->value.object.values = (json_object **) realloc((void *) properties->value.object.values, (properties->value.object.length + 8 + fields.size()) * sizeof(json_object *));
|
||||
if (properties->value.object.keys == NULL || properties->value.object.values == NULL) {
|
||||
perror("realloc");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < fields.size(); i++) {
|
||||
@@ -335,7 +336,7 @@ void join_csv(json_object *j) {
|
||||
json_object *vo = (json_object *) malloc(sizeof(json_object));
|
||||
if (ko == NULL || vo == NULL) {
|
||||
perror("malloc");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
|
||||
ko->type = JSON_STRING;
|
||||
@@ -345,7 +346,7 @@ void join_csv(json_object *j) {
|
||||
ko->value.string.string = strdup(k.c_str());
|
||||
if (ko->value.string.string == NULL) {
|
||||
perror("strdup");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
|
||||
vo->type = attr_type;
|
||||
@@ -356,7 +357,7 @@ void join_csv(json_object *j) {
|
||||
vo->value.string.string = strdup(v.c_str());
|
||||
if (vo->value.string.string == NULL) {
|
||||
perror("strdup");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
} else if (attr_type == JSON_NUMBER) {
|
||||
vo->value.number.number = atof(v.c_str());
|
||||
@@ -455,26 +456,26 @@ int main(int argc, char **argv) {
|
||||
pe = true;
|
||||
} else {
|
||||
fprintf(stderr, "%s: Unknown option for -p%s\n", argv[0], optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unexpected option -%c\n", i);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
if (extract != NULL && wrap) {
|
||||
fprintf(stderr, "%s: --wrap and --extract not supported together\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
if (csv != NULL) {
|
||||
csvfile = fopen(csv, "r");
|
||||
if (csvfile == NULL) {
|
||||
perror(csv);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +486,7 @@ int main(int argc, char **argv) {
|
||||
FILE *f = fopen(argv[i], "r");
|
||||
if (f == NULL) {
|
||||
perror(argv[i]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
process(f, argv[i]);
|
||||
@@ -502,7 +503,7 @@ int main(int argc, char **argv) {
|
||||
if (csvfile != NULL) {
|
||||
if (fclose(csvfile) != 0) {
|
||||
perror("close");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ extern size_t max_tile_features;
|
||||
extern int cluster_distance;
|
||||
extern std::string attribute_for_id;
|
||||
extern int tiny_polygon_size;
|
||||
extern size_t limit_tile_feature_count;
|
||||
extern size_t limit_tile_feature_count_at_maxzoom;
|
||||
|
||||
struct order_field {
|
||||
std::string name;
|
||||
@@ -66,12 +68,14 @@ struct order_field {
|
||||
|
||||
extern std::vector<order_field> order_by;
|
||||
|
||||
// not legal UTF-8, so can't appear as a real attribute name
|
||||
#define ORDER_BY_SIZE "\200size"
|
||||
extern bool order_by_size;
|
||||
|
||||
int mkstemp_cloexec(char *name);
|
||||
FILE *fopen_oflag(const char *name, const char *mode, int oflag);
|
||||
bool progress_time();
|
||||
|
||||
#define MAX_ZOOM 24
|
||||
|
||||
int pthread_create_wrap(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
|
||||
|
||||
#endif
|
||||
|
||||
+22
-1
@@ -35,7 +35,7 @@ For this fork you will need to build from the source repository:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ git clone https://github.com/protomaps/tippecanoe.git
|
||||
$ git clone https://github.com/felt/tippecanoe.git
|
||||
$ cd tippecanoe
|
||||
$ make \-j
|
||||
$ make install
|
||||
@@ -567,6 +567,9 @@ If you use \fB\fC\-Bg\fR, it will guess a zoom level that will keep at most 50,0
|
||||
You can also specify a marker\-width with \fB\fC\-Bg\fR\fIwidth\fP to allow fewer features in the densest tile to
|
||||
compensate for the larger marker, or \fB\fC\-Bf\fR\fInumber\fP to allow at most \fInumber\fP features in the densest tile.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-drop\-denser=\fR\fIpercentage\fP: When dropping dots at zoom levels below the base zoom, give the specified \fIpercentage\fP
|
||||
preference to retaining points in sparse areas and dropping points in dense areas.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-limit\-base\-zoom\-to\-maximum\-zoom\fR or \fB\fC\-Pb\fR: Limit the guessed base zoom not to exceed the maxzoom, even if this would put more than the requested number of features in a base zoom tile.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-al\fR or \fB\fC\-\-drop\-lines\fR: Let "dot" dropping at lower zooms apply to lines too
|
||||
@@ -611,11 +614,15 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pS\fR or \fB\fC\-\-simplify\-only\-low\-zooms\fR: Don't simplify lines and polygons at maxzoom (but do simplify at lower zooms)
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-simplification\-at\-maximum\-zoom=\fR\fIscale\fP: Use the specified \fIscale\fP at maxzoom instead of the standard simplification scale (which still applies at lower zooms)
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pn\fR or \fB\fC\-\-no\-simplification\-of\-shared\-nodes\fR: Don't simplify away nodes that appear in more than one feature or are used multiple times within the same feature, so that the intersection node will not be lost from intersecting roads. (This will not be effective if you also use \fB\fC\-\-coalesce\fR or \fB\fC\-\-detect\-shared\-borders\fR\&.)
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pt\fR or \fB\fC\-\-no\-tiny\-polygon\-reduction\fR: Don't combine the area of very small polygons into small squares that represent their combined area.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-tiny\-polygon\-size=\fR\fIsize\fP: Use the specified \fIsize\fP for tiny polygons instead of the default 2. Anything above 6 or so will lead to visible artifacts with the default tile detail.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-av\fR or \fB\fC\-\-visvalingam\fR: Use Visvalingam's simplification algorithm rather than Douglas\-Peucker's.
|
||||
.RE
|
||||
.SS Attempts to improve shared polygon boundaries
|
||||
.RS
|
||||
@@ -649,6 +656,10 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
\fB\fC\-\-order\-by=\fR\fIattribute\fP: Order features by the specified \fIattribute\fP, in alphabetical or numerical order. Multiple \fB\fC\-\-order\-by\fR and \fB\fC\-\-order\-descending\-by\fR options may be specified, the first being the primary sort key.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-order\-descending\-by=\fR\fIattribute\fP: Order features by the specified \fIattribute\fP, in reverse alphabetical or numerical order. Multiple \fB\fC\-\-order\-by\fR and \fB\fC\-\-order\-descending\-by\fR options may be specified, the first being the primary sort key.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-order\-smallest\-first\fR: Order features so the smallest geometry comes first in each tile. Multiple \fB\fC\-\-order\-by\fR and \fB\fC\-\-order\-descending\-by\fR options may be specified, the first being the primary sort key.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-order\-largest\-first\fR: Order features so the largest geometry comes first in each tile. Multiple \fB\fC\-\-order\-by\fR and \fB\fC\-\-order\-descending\-by\fR options may be specified, the first being the primary sort key.
|
||||
.RE
|
||||
.SS Adding calculated attributes
|
||||
.RS
|
||||
@@ -667,6 +678,8 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
\fB\fC\-pW\fR or \fB\fC\-\-reverse\-source\-polygon\-winding\fR: Instead of respecting GeoJSON polygon ring order, use the opposite of the original polygon winding in the source data to distinguish inner (counterclockwise) and outer (clockwise) polygon rings.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-clip\-bounding\-box=\fR\fIminlon\fP\fB\fC,\fR\fIminlat\fP\fB\fC,\fR\fImaxlon\fP\fB\fC,\fR\fImaxlat\fP: Clip all features to the specified bounding box.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-aP\fR or \fB\fC\-\-convert\-polygons\-to\-label\-points\fR: Replace polygon geometries with a label point or points for the polygon in each tile it intersects.
|
||||
.RE
|
||||
.SS Setting or disabling tile size limits
|
||||
.RS
|
||||
@@ -675,6 +688,10 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
.IP \(bu 2
|
||||
\fB\fC\-O\fR \fIfeatures\fP or \fB\fC\-\-maximum\-tile\-features=\fR\fIfeatures\fP: Use the specified number of \fIfeatures\fP as the maximum in a tile instead of 200,000.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-limit\-tile\-feature\-count=\fR\fIfeatures\fP: Abruptly limit each tile to the specified number of \fIfeatures\fP, after ordering them if specified.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-limit\-tile\-feature\-count\-at\-maximum\-zoom=\fR\fIfeatures\fP: Abruptly limit each tile at the maximum zoom level to the specified number of \fIfeatures\fP, after ordering them if specified.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pf\fR or \fB\fC\-\-no\-feature\-limit\fR: Don't limit tiles to 200,000 features
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pk\fR or \fB\fC\-\-no\-tile\-size\-limit\fR: Don't limit tiles to 500K bytes
|
||||
@@ -1110,6 +1127,10 @@ resolutions.
|
||||
\fB\fC\-S\fR or \fB\fC\-\-stats\fR: Just report statistics about each tile's size and the number of features in it, as a JSON structure.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-f\fR or \fB\fC\-\-force\fR: Decode tiles even if polygon ring order or closure problems are detected
|
||||
.IP \(bu 2
|
||||
\fB\fC\-I\fR or \fB\fC\-\-integer\fR: Report coordinates in integer tile coordinates
|
||||
.IP \(bu 2
|
||||
\fB\fC\-F\fR or \fB\fC\-\-fraction\fR: Report coordinates as a fraction of the tile extent
|
||||
.RE
|
||||
.SH tippecanoe\-json\-tool
|
||||
.PP
|
||||
|
||||
+292
-146
@@ -18,6 +18,7 @@
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "write_json.hpp"
|
||||
#include "version.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
size_t max_tilestats_attributes = 1000;
|
||||
size_t max_tilestats_sample_values = 1000;
|
||||
@@ -28,45 +29,70 @@ sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
||||
|
||||
if (sqlite3_open(dbname, &outdb) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: %s: %s\n", argv[0], dbname, sqlite3_errmsg(outdb));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
char *err = NULL;
|
||||
if (sqlite3_exec(outdb, "PRAGMA synchronous=0", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: async: %s\n", argv[0], err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_exec(outdb, "PRAGMA locking_mode=EXCLUSIVE", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: async: %s\n", argv[0], err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_exec(outdb, "PRAGMA journal_mode=DELETE", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: async: %s\n", argv[0], err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_exec(outdb, "CREATE TABLE metadata (name text, value text);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: Tileset \"%s\" already exists. You can use --force if you want to delete the old tileset.\n", argv[0], dbname);
|
||||
fprintf(stderr, "%s: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (sqlite3_exec(outdb, "CREATE TABLE tiles (zoom_level integer, tile_column integer, tile_row integer, tile_data blob);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: create tiles table: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
if (sqlite3_exec(outdb, "create unique index name on metadata (name);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: index metadata: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
if (sqlite3_exec(outdb, "create unique index tile_index on tiles (zoom_level, tile_column, tile_row);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: index tiles: %s\n", argv[0], err);
|
||||
|
||||
// "map" maps z/x/y coordinates to a content hash
|
||||
if (sqlite3_exec(outdb, "CREATE TABLE map (zoom_level INTEGER, tile_column INTEGER, tile_row INTEGER, tile_id TEXT);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: create map table: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
if (sqlite3_exec(outdb, "CREATE UNIQUE INDEX map_index ON map (zoom_level, tile_column, tile_row);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: create map index: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// "images" maps a content hash to tile contents, per zoom level
|
||||
if (sqlite3_exec(outdb, "CREATE TABLE images (zoom_level integer, tile_data blob, tile_id text);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: create images table: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
if (sqlite3_exec(outdb, "CREATE UNIQUE INDEX images_id ON images (zoom_level, tile_id);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: create images index: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// "tiles" is a view that retrieves content from "images"
|
||||
// via the content hash looked up from "map".
|
||||
if (sqlite3_exec(outdb, "CREATE VIEW tiles AS SELECT map.zoom_level AS zoom_level, map.tile_column AS tile_column, map.tile_row AS tile_row, images.tile_data AS tile_data FROM map JOIN images ON images.tile_id = map.tile_id and images.zoom_level = map.zoom_level;", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: create tiles view: %s\n", argv[0], err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,23 +100,93 @@ sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
||||
}
|
||||
|
||||
void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, int size) {
|
||||
// Store tiles by a hash of their contents (fnv1a 64-bit)
|
||||
// http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
const unsigned long long fnv_offset_basis = 14695981039346656037u;
|
||||
const unsigned long long fnv_prime = 1099511628211u;
|
||||
unsigned long long h = fnv_offset_basis;
|
||||
for (int i = 0; i < size; i++) {
|
||||
h ^= (unsigned char) data[i];
|
||||
h *= fnv_prime;
|
||||
}
|
||||
std::string hash = std::to_string(h);
|
||||
|
||||
// following https://github.com/mapbox/node-mbtiles/blob/master/lib/mbtiles.js
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
const char *query = "insert into tiles (zoom_level, tile_column, tile_row, tile_data) values (?, ?, ?, ?)";
|
||||
if (sqlite3_prepare_v2(outdb, query, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 insert prep failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
const char *images = "replace into images (zoom_level, tile_id, tile_data) values (?, ?, ?)";
|
||||
if (sqlite3_prepare_v2(outdb, images, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 images prep failed\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, z);
|
||||
sqlite3_bind_text(stmt, 2, hash.c_str(), hash.size(), NULL);
|
||||
sqlite3_bind_blob(stmt, 3, data, size, NULL);
|
||||
|
||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||
fprintf(stderr, "sqlite3 images insert failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_finalize(stmt) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 images finalize failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
const char *map = "insert into map (zoom_level, tile_column, tile_row, tile_id) values (?, ?, ?, ?)";
|
||||
if (sqlite3_prepare_v2(outdb, map, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 map prep failed\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, z);
|
||||
sqlite3_bind_int(stmt, 2, tx);
|
||||
sqlite3_bind_int(stmt, 3, (1 << z) - 1 - ty);
|
||||
sqlite3_bind_blob(stmt, 4, data, size, NULL);
|
||||
sqlite3_bind_text(stmt, 4, hash.c_str(), hash.size(), NULL);
|
||||
|
||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||
fprintf(stderr, "sqlite3 insert failed: %s\n", sqlite3_errmsg(outdb));
|
||||
fprintf(stderr, "sqlite3 map insert failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_finalize(stmt) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 finalize failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
|
||||
void mbtiles_erase_zoom(sqlite3 *outdb, int z) {
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
const char *query = "delete from map where zoom_level = ?";
|
||||
if (sqlite3_prepare_v2(outdb, query, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 delete map prep failed\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, z);
|
||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||
fprintf(stderr, "sqlite3 delete map failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_finalize(stmt) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 delete map finalize failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
query = "delete from images where zoom_level = ?";
|
||||
if (sqlite3_prepare_v2(outdb, query, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 delete images prep failed\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, z);
|
||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||
fprintf(stderr, "sqlite3 delete images failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_finalize(stmt) != SQLITE_OK) {
|
||||
fprintf(stderr, "sqlite3 delete images finalize failed: %s\n", sqlite3_errmsg(outdb));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,14 +216,17 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
lmv.push_back(layermap1);
|
||||
std::map<std::string, layermap_entry> layermap = merge_layermaps(lmv, true);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("layerCount");
|
||||
state.nospace = true;
|
||||
state.json_write_unsigned(layermap.size());
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("layers");
|
||||
state.nospace = true;
|
||||
state.json_write_array();
|
||||
|
||||
for (auto layer : layermap) {
|
||||
@@ -136,10 +235,12 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("layer");
|
||||
state.nospace = true;
|
||||
state.json_write_string(layer.first);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("count");
|
||||
state.nospace = true;
|
||||
state.json_write_unsigned(layer.second.points + layer.second.lines + layer.second.polygons);
|
||||
|
||||
std::string geomtype = "Polygon";
|
||||
@@ -151,6 +252,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("geometry");
|
||||
state.nospace = true;
|
||||
state.json_write_string(geomtype);
|
||||
|
||||
size_t attrib_count = layer.second.file_keys.size();
|
||||
@@ -160,6 +262,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("attributeCount");
|
||||
state.nospace = true;
|
||||
state.json_write_unsigned(attrib_count);
|
||||
|
||||
state.nospace = true;
|
||||
@@ -179,6 +282,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("attribute");
|
||||
state.nospace = true;
|
||||
state.json_write_string(attribute.first);
|
||||
|
||||
size_t val_count = attribute.second.sample_values.size();
|
||||
@@ -188,6 +292,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("count");
|
||||
state.nospace = true;
|
||||
state.json_write_unsigned(val_count);
|
||||
|
||||
int type = 0;
|
||||
@@ -209,10 +314,12 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("type");
|
||||
state.nospace = true;
|
||||
state.json_write_string(type_str);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("values");
|
||||
state.nospace = true;
|
||||
state.json_write_array();
|
||||
|
||||
size_t vals = 0;
|
||||
@@ -221,11 +328,10 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
break;
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
|
||||
if (value.type == mvt_double || value.type == mvt_bool) {
|
||||
vals++;
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_stringified(value.string);
|
||||
} else {
|
||||
std::string trunc = truncate16(value.string, 256);
|
||||
@@ -233,6 +339,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
if (trunc.size() == value.string.size()) {
|
||||
vals++;
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string(value.string);
|
||||
}
|
||||
}
|
||||
@@ -244,10 +351,12 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
if ((type & (1 << mvt_double)) != 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("min");
|
||||
state.nospace = true;
|
||||
state.json_write_number(attribute.second.min);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("max");
|
||||
state.nospace = true;
|
||||
state.json_write_number(attribute.second.max);
|
||||
}
|
||||
|
||||
@@ -272,54 +381,80 @@ std::string stringify_strategies(std::vector<strategy> const &strategies) {
|
||||
json_writer state(&out);
|
||||
bool any = false;
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_array();
|
||||
for (size_t i = 0; i < strategies.size(); i++) {
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
if (strategies[i].dropped_by_rate > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("dropped_by_rate");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].dropped_by_rate);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].dropped_by_gamma > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("dropped_by_gamma");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].dropped_by_gamma);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].dropped_as_needed > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("dropped_as_needed");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].dropped_as_needed);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].coalesced_as_needed > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("coalesced_as_needed");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].coalesced_as_needed);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].detail_reduced > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("detail_reduced");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].detail_reduced);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].tiny_polygons > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("tiny_polygons");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].tiny_polygons);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].tile_size > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("tile_size_desired");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].tile_size);
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].feature_count > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("feature_count_desired");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].feature_count);
|
||||
any = true;
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
}
|
||||
state.nospace = true;
|
||||
state.json_end_array();
|
||||
|
||||
if (any) {
|
||||
@@ -329,155 +464,206 @@ std::string stringify_strategies(std::vector<strategy> const &strategies) {
|
||||
}
|
||||
}
|
||||
|
||||
void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, int forcetable, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies) {
|
||||
void mbtiles_write_metadata(sqlite3 *db, const metadata &m, bool forcetable) {
|
||||
char *sql, *err;
|
||||
|
||||
sqlite3 *db = outdb;
|
||||
if (outdb == NULL) {
|
||||
if (sqlite3_open("", &db) != SQLITE_OK) {
|
||||
fprintf(stderr, "Temporary db: %s\n", sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (sqlite3_exec(db, "CREATE TABLE metadata (name text, value text);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "Create metadata table: %s\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('name', %Q);", fname);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('name', %Q);", m.name.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set name in metadata: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('description', %Q);", description != NULL ? description : fname);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('description', %Q);", m.description.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set description in metadata: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('version', %d);", 2);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('version', %d);", m.version);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set version : %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('minzoom', %d);", minzoom);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('minzoom', %d);", m.minzoom);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set minzoom: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('maxzoom', %d);", maxzoom);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('maxzoom', %d);", m.maxzoom);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set maxzoom: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('center', '%f,%f,%d');", midlon, midlat, maxzoom);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('center', '%f,%f,%d');", m.center_lon, m.center_lat, m.center_z);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set center: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('bounds', '%f,%f,%f,%f');", minlon, minlat, maxlon, maxlat);
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('bounds', '%f,%f,%f,%f');", m.minlon, m.minlat, m.maxlon, m.maxlat);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set bounds: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('type', %Q);", "overlay");
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('type', %Q);", m.type.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set type: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
if (attribution != NULL) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('attribution', %Q);", attribution);
|
||||
if (m.attribution.size() > 0) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('attribution', %Q);", m.attribution.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set type: %s\n", err);
|
||||
fprintf(stderr, "set attribution: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('format', %Q);", vector ? "pbf" : "png");
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('format', %Q);", m.format.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set format: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
std::string version = program + " " + VERSION;
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('generator', %Q);", version.c_str());
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('generator', %Q);", m.generator.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set version: %s\n", err);
|
||||
fprintf(stderr, "set generator: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('generator_options', %Q);", commandline.c_str());
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('generator_options', %Q);", m.generator_options.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set commandline: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
std::string strat = stringify_strategies(strategies);
|
||||
if (strat.size() > 0) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('strategies', %Q);", strat.c_str());
|
||||
if (m.strategies_json.size() > 0) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('strategies', %Q);", m.strategies_json.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set strategies: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
if (vector) {
|
||||
size_t elements = max_tilestats_values;
|
||||
std::string buf;
|
||||
if (m.vector_layers_json.size() > 0 || m.tilestats_json.size() > 0) {
|
||||
std::string json;
|
||||
json_writer state(&json);
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
{
|
||||
json_writer state(&buf);
|
||||
|
||||
state.json_write_hash();
|
||||
if (m.vector_layers_json.size() > 0) {
|
||||
state.nospace = true;
|
||||
|
||||
state.json_write_string("vector_layers");
|
||||
state.nospace = true;
|
||||
state.json_write_json(m.vector_layers_json);
|
||||
|
||||
if (m.tilestats_json.size() > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("tilestats");
|
||||
state.nospace = true;
|
||||
state.json_write_json(m.tilestats_json);
|
||||
}
|
||||
} else {
|
||||
if (m.tilestats_json.size() > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("tilestats");
|
||||
state.nospace = true;
|
||||
state.json_write_json(m.tilestats_json);
|
||||
}
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('json', %Q);", json.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set json: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
}
|
||||
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies) {
|
||||
metadata m;
|
||||
|
||||
m.name = fname;
|
||||
m.description = description != NULL ? description : fname;
|
||||
m.version = 2;
|
||||
m.type = "overlay";
|
||||
m.format = vector ? "pbf" : "png";
|
||||
|
||||
m.minzoom = minzoom;
|
||||
m.maxzoom = maxzoom;
|
||||
|
||||
m.minlat = minlat;
|
||||
m.minlon = minlon;
|
||||
m.maxlat = maxlat;
|
||||
m.maxlon = maxlon;
|
||||
|
||||
m.center_lat = midlat;
|
||||
m.center_lon = midlon;
|
||||
m.center_z = maxzoom;
|
||||
|
||||
if (attribution != NULL) {
|
||||
m.attribution = attribution;
|
||||
}
|
||||
|
||||
m.generator = program + " " + VERSION;
|
||||
m.generator_options = commandline;
|
||||
|
||||
m.strategies_json = stringify_strategies(strategies);
|
||||
|
||||
if (vector) {
|
||||
{
|
||||
json_writer state(&m.vector_layers_json);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_array();
|
||||
|
||||
std::vector<std::string> lnames;
|
||||
@@ -487,23 +673,33 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fnam
|
||||
|
||||
for (size_t i = 0; i < lnames.size(); i++) {
|
||||
auto fk = layermap.find(lnames[i]);
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("id");
|
||||
state.nospace = true;
|
||||
state.json_write_string(lnames[i]);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("description");
|
||||
state.nospace = true;
|
||||
state.json_write_string(fk->second.description);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("minzoom");
|
||||
state.nospace = true;
|
||||
state.json_write_signed(fk->second.minzoom);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("maxzoom");
|
||||
state.nospace = true;
|
||||
state.json_write_signed(fk->second.maxzoom);
|
||||
|
||||
state.json_write_string("fields");
|
||||
state.json_write_hash();
|
||||
state.nospace = true;
|
||||
state.json_write_string("fields");
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
bool first = true;
|
||||
size_t attribute_count = 0;
|
||||
@@ -512,6 +708,7 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fnam
|
||||
first = false;
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string(j->first);
|
||||
|
||||
auto f = attribute_descriptions.find(j->first);
|
||||
@@ -522,15 +719,20 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fnam
|
||||
}
|
||||
|
||||
if (type == (1 << mvt_double)) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("Number");
|
||||
} else if (type == (1 << mvt_bool)) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("Boolean");
|
||||
} else if (type == (1 << mvt_string)) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("String");
|
||||
} else {
|
||||
state.nospace = true;
|
||||
state.json_write_string("Mixed");
|
||||
}
|
||||
} else {
|
||||
state.nospace = true;
|
||||
state.json_write_string(f->second);
|
||||
}
|
||||
|
||||
@@ -542,81 +744,25 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fnam
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_array();
|
||||
}
|
||||
|
||||
{
|
||||
size_t elements = max_tilestats_values;
|
||||
json_writer state(&m.tilestats_json);
|
||||
|
||||
if (do_tilestats && elements > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("tilestats");
|
||||
tilestats(layermap, elements, state);
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
}
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('json', %Q);", buf.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set json: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
if (outdir != NULL) {
|
||||
std::string metadata = std::string(outdir) + "/metadata.json";
|
||||
|
||||
struct stat st;
|
||||
if (stat(metadata.c_str(), &st) == 0) {
|
||||
// Leave existing metadata in place with --allow-existing
|
||||
} else {
|
||||
FILE *fp = fopen(metadata.c_str(), "w");
|
||||
if (fp == NULL) {
|
||||
perror(metadata.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
json_writer state(fp);
|
||||
|
||||
state.json_write_hash();
|
||||
state.json_write_newline();
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
if (sqlite3_prepare_v2(db, "SELECT name, value from metadata;", -1, &stmt, NULL) == SQLITE_OK) {
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
std::string key, value;
|
||||
|
||||
const char *k = (const char *) sqlite3_column_text(stmt, 0);
|
||||
const char *v = (const char *) sqlite3_column_text(stmt, 1);
|
||||
if (k == NULL || v == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null metadata\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
state.json_comma_newline();
|
||||
state.json_write_string(k);
|
||||
state.json_write_string(v);
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
state.json_write_newline();
|
||||
state.json_end_hash();
|
||||
state.json_write_newline();
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
if (outdb == NULL) {
|
||||
if (sqlite3_close(db) != SQLITE_OK) {
|
||||
fprintf(stderr, "Could not close temp database: %s\n", sqlite3_errmsg(db));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
void mbtiles_close(sqlite3 *outdb, const char *pgm) {
|
||||
@@ -624,11 +770,11 @@ void mbtiles_close(sqlite3 *outdb, const char *pgm) {
|
||||
|
||||
if (sqlite3_exec(outdb, "ANALYZE;", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: ANALYZE failed: %s\n", pgm, err);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_close(outdb) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: could not close database: %s\n", pgm, sqlite3_errmsg(outdb));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +807,7 @@ std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::
|
||||
auto out_entry = out.find(layername);
|
||||
if (out_entry == out.end()) {
|
||||
fprintf(stderr, "Internal error merging layers\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
for (auto fk = map->second.file_keys.begin(); fk != map->second.file_keys.end(); ++fk) {
|
||||
@@ -726,7 +872,7 @@ void add_to_file_keys(std::map<std::string, type_and_string_stats> &file_keys, s
|
||||
|
||||
if (fka == file_keys.end()) {
|
||||
fprintf(stderr, "Can't happen (tilestats)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (val.type == mvt_double) {
|
||||
|
||||
+29
-1
@@ -41,13 +41,41 @@ struct layermap_entry {
|
||||
}
|
||||
};
|
||||
|
||||
struct metadata {
|
||||
std::string name;
|
||||
std::string description;
|
||||
int version;
|
||||
std::string type;
|
||||
std::string format;
|
||||
|
||||
int minzoom;
|
||||
int maxzoom;
|
||||
|
||||
double minlat, minlon, maxlat, maxlon;
|
||||
|
||||
double center_lon, center_lat;
|
||||
int center_z;
|
||||
|
||||
std::string attribution; // not written if empty
|
||||
|
||||
std::string generator;
|
||||
std::string generator_options;
|
||||
|
||||
std::string strategies_json; // not written if empty
|
||||
|
||||
std::string vector_layers_json;
|
||||
std::string tilestats_json;
|
||||
};
|
||||
|
||||
#include "tile.hpp"
|
||||
|
||||
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable);
|
||||
|
||||
void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, int size);
|
||||
void mbtiles_erase_zoom(sqlite3 *outdb, int z);
|
||||
|
||||
void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, int forcetable, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies);
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies);
|
||||
void mbtiles_write_metadata(sqlite3 *db, const metadata &m, bool forcetable);
|
||||
|
||||
void mbtiles_close(sqlite3 *outdb, const char *pgm);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "protozero/pbf_reader.hpp"
|
||||
#include "protozero/pbf_writer.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "errors.hpp"
|
||||
|
||||
mvt_geometry::mvt_geometry(int nop, long long nx, long long ny) {
|
||||
this->op = nop;
|
||||
@@ -115,7 +116,7 @@ bool mvt_tile::decode(std::string &message, bool &was_compressed) {
|
||||
if (is_compressed(message)) {
|
||||
std::string uncompressed;
|
||||
if (decompress(message, uncompressed) == 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_MVT);
|
||||
}
|
||||
src = uncompressed;
|
||||
was_compressed = true;
|
||||
@@ -349,10 +350,10 @@ std::string mvt_tile::encode() {
|
||||
value_writer.add_bool(7, pbv.numeric_value.bool_value);
|
||||
} else if (pbv.type == mvt_null) {
|
||||
fprintf(stderr, "Internal error: trying to write null attribute to tile\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
} else {
|
||||
fprintf(stderr, "Internal error: trying to write undefined attribute type to tile\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
sorted_value sv;
|
||||
@@ -418,7 +419,7 @@ std::string mvt_tile::encode() {
|
||||
|
||||
if (dx < INT_MIN || dx > INT_MAX || dy < INT_MIN || dy > INT_MAX) {
|
||||
fprintf(stderr, "Internal error: Geometry delta is too big: %lld,%lld\n", dx, dy);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
geometry.push_back(protozero::encode_zigzag32(dx));
|
||||
@@ -431,7 +432,7 @@ std::string mvt_tile::encode() {
|
||||
length++;
|
||||
} else {
|
||||
fprintf(stderr, "\nInternal error: corrupted geometry\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -11,7 +11,6 @@
|
||||
#define A_PREFER_RADIX_SORT ((int) 'R')
|
||||
#define A_CALCULATE_FEATURE_DENSITY ((int) 'g')
|
||||
#define A_INCREASE_GAMMA_AS_NEEDED ((int) 'G')
|
||||
#define A_MERGE_POLYGONS_AS_NEEDED ((int) 'm')
|
||||
#define A_DROP_DENSEST_AS_NEEDED ((int) 's')
|
||||
#define A_DROP_FRACTION_AS_NEEDED ((int) 'd')
|
||||
#define A_DROP_SMALLEST_AS_NEEDED ((int) 'n')
|
||||
@@ -25,6 +24,8 @@
|
||||
#define A_GENERATE_IDS ((int) 'i')
|
||||
#define A_CONVERT_NUMERIC_IDS ((int) 'I')
|
||||
#define A_HILBERT ((int) 'h')
|
||||
#define A_VISVALINGAM ((int) 'v')
|
||||
#define A_GENERATE_POLYGON_LABEL_POINTS ((int) 'P')
|
||||
|
||||
#define P_SIMPLIFY ((int) 's')
|
||||
#define P_SIMPLIFY_LOW ((int) 'S')
|
||||
@@ -44,7 +45,6 @@
|
||||
#define P_REVERSE_SOURCE_POLYGON_WINDING ((int) 'W')
|
||||
#define P_EMPTY_CSV_COLUMNS ((int) 'e')
|
||||
#define P_BASEZOOM_ABOVE_MAXZOOM ((int) 'b')
|
||||
#define P_THREADS ((int) 'T')
|
||||
|
||||
extern int prevent[256];
|
||||
extern int additional[256];
|
||||
|
||||
+59
-54
@@ -24,6 +24,7 @@
|
||||
#include "projection.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "jsonpull/jsonpull.h"
|
||||
@@ -48,12 +49,12 @@ void *run_writer(void *a) {
|
||||
FILE *fp = fdopen(wa->write_to, "w");
|
||||
if (fp == NULL) {
|
||||
perror("fdopen (pipe writer)");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
json_writer state(fp);
|
||||
for (size_t i = 0; i < wa->layers->size(); i++) {
|
||||
layer_to_geojson((*(wa->layers))[i], wa->z, wa->x, wa->y, false, true, false, true, 0, 0, 0, true, state);
|
||||
layer_to_geojson((*(wa->layers))[i], wa->z, wa->x, wa->y, false, true, false, true, 0, 0, 0, true, state, 0);
|
||||
}
|
||||
|
||||
if (fclose(fp) != 0) {
|
||||
@@ -65,7 +66,7 @@ void *run_writer(void *a) {
|
||||
}
|
||||
} else {
|
||||
perror("fclose output to filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
FILE *f = fdopen(fd, "r");
|
||||
if (f == NULL) {
|
||||
perror("fdopen filter output");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
json_pull *jp = json_begin_file(f);
|
||||
|
||||
@@ -98,11 +99,13 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
json_object *j = json_read(jp);
|
||||
if (j == NULL) {
|
||||
if (jp->error != NULL) {
|
||||
fprintf(stderr, "Filter output:%d: %s\n", jp->line, jp->error);
|
||||
fprintf(stderr, "Filter output:%d: %s: ", jp->line, jp->error);
|
||||
if (jp->root != NULL) {
|
||||
json_context(jp->root);
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_free(jp->root);
|
||||
@@ -119,38 +122,38 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
|
||||
json_object *geometry = json_hash_get(j, "geometry");
|
||||
if (geometry == NULL) {
|
||||
fprintf(stderr, "Filter output:%d: filtered feature with no geometry\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: filtered feature with no geometry: ", jp->line);
|
||||
json_context(j);
|
||||
json_free(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_object *properties = json_hash_get(j, "properties");
|
||||
if (properties == NULL || (properties->type != JSON_HASH && properties->type != JSON_NULL)) {
|
||||
fprintf(stderr, "Filter output:%d: feature without properties hash\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: feature without properties hash: ", jp->line);
|
||||
json_context(j);
|
||||
json_free(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_object *geometry_type = json_hash_get(geometry, "type");
|
||||
if (geometry_type == NULL) {
|
||||
fprintf(stderr, "Filter output:%d: null geometry (additional not reported)\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: null geometry (additional not reported): ", jp->line);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
if (geometry_type->type != JSON_STRING) {
|
||||
fprintf(stderr, "Filter output:%d: geometry type is not a string\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: geometry type is not a string: ", jp->line);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_object *coordinates = json_hash_get(geometry, "coordinates");
|
||||
if (coordinates == NULL || coordinates->type != JSON_ARRAY) {
|
||||
fprintf(stderr, "Filter output:%d: feature without coordinates array\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: feature without coordinates array: ", jp->line);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
int t;
|
||||
@@ -160,9 +163,9 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
}
|
||||
}
|
||||
if (t >= GEOM_TYPES) {
|
||||
fprintf(stderr, "Filter output:%d: Can't handle geometry type %s\n", jp->line, geometry_type->value.string.string);
|
||||
fprintf(stderr, "Filter output:%d: Can't handle geometry type %s: ", jp->line, geometry_type->value.string.string);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
std::string layername = "unknown";
|
||||
@@ -240,7 +243,7 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
auto fk = layermap.find(layername);
|
||||
if (fk == layermap.end()) {
|
||||
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
if (z < fk->second.minzoom) {
|
||||
fk->second.minzoom = z;
|
||||
@@ -287,7 +290,7 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
json_end(jp);
|
||||
if (fclose(f) != 0) {
|
||||
perror("fclose postfilter output");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
|
||||
std::vector<mvt_layer> final;
|
||||
@@ -305,11 +308,13 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
json_object *j = json_read(jp);
|
||||
if (j == NULL) {
|
||||
if (jp->error != NULL) {
|
||||
fprintf(stderr, "Filter output:%d: %s\n", jp->line, jp->error);
|
||||
fprintf(stderr, "Filter output:%d: %s: ", jp->line, jp->error);
|
||||
if (jp->root != NULL) {
|
||||
json_context(jp->root);
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_free(jp->root);
|
||||
@@ -327,38 +332,38 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
|
||||
json_object *geometry = json_hash_get(j, "geometry");
|
||||
if (geometry == NULL) {
|
||||
fprintf(stderr, "Filter output:%d: filtered feature with no geometry\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: filtered feature with no geometry: ", jp->line);
|
||||
json_context(j);
|
||||
json_free(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_object *properties = json_hash_get(j, "properties");
|
||||
if (properties == NULL || (properties->type != JSON_HASH && properties->type != JSON_NULL)) {
|
||||
fprintf(stderr, "Filter output:%d: feature without properties hash\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: feature without properties hash: ", jp->line);
|
||||
json_context(j);
|
||||
json_free(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_object *geometry_type = json_hash_get(geometry, "type");
|
||||
if (geometry_type == NULL) {
|
||||
fprintf(stderr, "Filter output:%d: null geometry (additional not reported)\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: null geometry (additional not reported): ", jp->line);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
if (geometry_type->type != JSON_STRING) {
|
||||
fprintf(stderr, "Filter output:%d: geometry type is not a string\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: geometry type is not a string: ", jp->line);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
json_object *coordinates = json_hash_get(geometry, "coordinates");
|
||||
if (coordinates == NULL || coordinates->type != JSON_ARRAY) {
|
||||
fprintf(stderr, "Filter output:%d: feature without coordinates array\n", jp->line);
|
||||
fprintf(stderr, "Filter output:%d: feature without coordinates array: ", jp->line);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
int t;
|
||||
@@ -368,9 +373,9 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
}
|
||||
}
|
||||
if (t >= GEOM_TYPES) {
|
||||
fprintf(stderr, "Filter output:%d: Can't handle geometry type %s\n", jp->line, geometry_type->value.string.string);
|
||||
fprintf(stderr, "Filter output:%d: Can't handle geometry type %s: ", jp->line, geometry_type->value.string.string);
|
||||
json_context(j);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
drawvec dv;
|
||||
@@ -476,7 +481,7 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
auto fk = layermap.find(layername);
|
||||
if (fk == layermap.end()) {
|
||||
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
sf.layer = fk->second.id;
|
||||
|
||||
@@ -539,17 +544,17 @@ void setup_filter(const char *filter, int *write_to, int *read_from, pid_t *pid,
|
||||
|
||||
if (pthread_mutex_lock(&pipe_lock) != 0) {
|
||||
perror("pthread_mutex_lock (pipe)");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
int pipe_orig[2], pipe_filtered[2];
|
||||
if (pipe(pipe_orig) < 0) {
|
||||
perror("pipe (original features)");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
if (pipe(pipe_filtered) < 0) {
|
||||
perror("pipe (filtered features)");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
std::string z_str = std::to_string(z);
|
||||
@@ -559,64 +564,64 @@ void setup_filter(const char *filter, int *write_to, int *read_from, pid_t *pid,
|
||||
*pid = fork();
|
||||
if (*pid < 0) {
|
||||
perror("fork");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
} else if (*pid == 0) {
|
||||
// child
|
||||
|
||||
if (dup2(pipe_orig[0], 0) < 0) {
|
||||
perror("dup child stdin");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
if (dup2(pipe_filtered[1], 1) < 0) {
|
||||
perror("dup child stdout");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
if (close(pipe_orig[1]) != 0) {
|
||||
perror("close output to filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (close(pipe_filtered[0]) != 0) {
|
||||
perror("close input from filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (close(pipe_orig[0]) != 0) {
|
||||
perror("close dup input of filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (close(pipe_filtered[1]) != 0) {
|
||||
perror("close dup output of filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
|
||||
// XXX close other fds?
|
||||
|
||||
if (execlp("sh", "sh", "-c", filter, "sh", z_str.c_str(), x_str.c_str(), y_str.c_str(), NULL) != 0) {
|
||||
perror("exec");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
} else {
|
||||
// parent
|
||||
|
||||
if (close(pipe_orig[0]) != 0) {
|
||||
perror("close filter-side reader");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (close(pipe_filtered[1]) != 0) {
|
||||
perror("close filter-side writer");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (fcntl(pipe_orig[1], F_SETFD, FD_CLOEXEC) != 0) {
|
||||
perror("cloxec output to filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (fcntl(pipe_filtered[0], F_SETFD, FD_CLOEXEC) != 0) {
|
||||
perror("cloxec input from filter");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(&pipe_lock) != 0) {
|
||||
perror("pthread_mutex_unlock (pipe_lock)");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
*write_to = pipe_orig[1];
|
||||
@@ -640,7 +645,7 @@ std::vector<mvt_layer> filter_layers(const char *filter, std::vector<mvt_layer>
|
||||
pthread_t writer;
|
||||
if (pthread_create(&writer, NULL, run_writer, &wa) != 0) {
|
||||
perror("pthread_create (filter writer)");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
std::vector<mvt_layer> nlayers = parse_layers(read_from, z, x, y, layermaps, tiling_seg, layer_unmaps, extent);
|
||||
@@ -649,7 +654,7 @@ std::vector<mvt_layer> filter_layers(const char *filter, std::vector<mvt_layer>
|
||||
int stat_loc;
|
||||
if (waitpid(pid, &stat_loc, 0) < 0) {
|
||||
perror("waitpid for filter\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
if (WIFEXITED(stat_loc) || WIFSIGNALED(stat_loc)) {
|
||||
break;
|
||||
@@ -659,7 +664,7 @@ std::vector<mvt_layer> filter_layers(const char *filter, std::vector<mvt_layer>
|
||||
void *ret;
|
||||
if (pthread_join(writer, &ret) != 0) {
|
||||
perror("pthread_join filter writer");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
return nlayers;
|
||||
|
||||
@@ -0,0 +1,588 @@
|
||||
#ifndef PMTILES_HPP
|
||||
#define PMTILES_HPP
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
namespace pmtiles {
|
||||
|
||||
const uint8_t TILETYPE_UNKNOWN = 0x0;
|
||||
const uint8_t TILETYPE_MVT = 0x1;
|
||||
const uint8_t TILETYPE_PNG = 0x2;
|
||||
const uint8_t TILETYPE_JPEG = 0x3;
|
||||
const uint8_t TILETYPE_WEBP = 0x4;
|
||||
|
||||
const uint8_t COMPRESSION_UNKNOWN = 0x0;
|
||||
const uint8_t COMPRESSION_NONE = 0x1;
|
||||
const uint8_t COMPRESSION_GZIP = 0x2;
|
||||
const uint8_t COMPRESSION_BROTLI = 0x3;
|
||||
const uint8_t COMPRESSION_ZSTD = 0x4;
|
||||
|
||||
struct headerv3 {
|
||||
uint64_t root_dir_offset;
|
||||
uint64_t root_dir_bytes;
|
||||
uint64_t json_metadata_offset;
|
||||
uint64_t json_metadata_bytes;
|
||||
uint64_t leaf_dirs_offset;
|
||||
uint64_t leaf_dirs_bytes;
|
||||
uint64_t tile_data_offset;
|
||||
uint64_t tile_data_bytes;
|
||||
uint64_t addressed_tiles_count;
|
||||
uint64_t tile_entries_count;
|
||||
uint64_t tile_contents_count;
|
||||
bool clustered;
|
||||
uint8_t internal_compression;
|
||||
uint8_t tile_compression;
|
||||
uint8_t tile_type;
|
||||
uint8_t min_zoom;
|
||||
uint8_t max_zoom;
|
||||
int32_t min_lon_e7;
|
||||
int32_t min_lat_e7;
|
||||
int32_t max_lon_e7;
|
||||
int32_t max_lat_e7;
|
||||
uint8_t center_zoom;
|
||||
int32_t center_lon_e7;
|
||||
int32_t center_lat_e7;
|
||||
|
||||
// WARNING: this is limited to little-endian
|
||||
std::string serialize() {
|
||||
std::stringstream ss;
|
||||
ss << "PMTiles";
|
||||
uint8_t version = 3;
|
||||
ss.write((char *) &version, 1);
|
||||
ss.write((char *) &root_dir_offset, 8);
|
||||
ss.write((char *) &root_dir_bytes, 8);
|
||||
ss.write((char *) &json_metadata_offset, 8);
|
||||
ss.write((char *) &json_metadata_bytes, 8);
|
||||
ss.write((char *) &leaf_dirs_offset, 8);
|
||||
ss.write((char *) &leaf_dirs_bytes, 8);
|
||||
ss.write((char *) &tile_data_offset, 8);
|
||||
ss.write((char *) &tile_data_bytes, 8);
|
||||
ss.write((char *) &addressed_tiles_count, 8);
|
||||
ss.write((char *) &tile_entries_count, 8);
|
||||
ss.write((char *) &tile_contents_count, 8);
|
||||
|
||||
uint8_t clustered_val = 0x0;
|
||||
if (clustered) {
|
||||
clustered_val = 0x1;
|
||||
}
|
||||
|
||||
ss.write((char *) &clustered_val, 1);
|
||||
ss.write((char *) &internal_compression, 1);
|
||||
ss.write((char *) &tile_compression, 1);
|
||||
ss.write((char *) &tile_type, 1);
|
||||
ss.write((char *) &min_zoom, 1);
|
||||
ss.write((char *) &max_zoom, 1);
|
||||
ss.write((char *) &min_lon_e7, 4);
|
||||
ss.write((char *) &min_lat_e7, 4);
|
||||
ss.write((char *) &max_lon_e7, 4);
|
||||
ss.write((char *) &max_lat_e7, 4);
|
||||
ss.write((char *) ¢er_zoom, 1);
|
||||
ss.write((char *) ¢er_lon_e7, 4);
|
||||
ss.write((char *) ¢er_lat_e7, 4);
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
struct pmtiles_magic_number_exception : std::exception {
|
||||
const char *what() const noexcept override {
|
||||
return "pmtiles magic number exception";
|
||||
}
|
||||
};
|
||||
|
||||
struct pmtiles_version_exception : std::exception {
|
||||
const char *what() const noexcept override {
|
||||
return "pmtiles version: must be 3";
|
||||
}
|
||||
};
|
||||
|
||||
inline headerv3 deserialize_header(const std::string &s) {
|
||||
if (s.substr(0, 7) != "PMTiles") {
|
||||
throw pmtiles_magic_number_exception{};
|
||||
}
|
||||
if (s.size() != 127 || s[7] != 0x3) {
|
||||
throw pmtiles_version_exception{};
|
||||
}
|
||||
headerv3 h;
|
||||
s.copy((char *) &h.root_dir_offset, 8, 8);
|
||||
s.copy((char *) &h.root_dir_bytes, 8, 16);
|
||||
s.copy((char *) &h.json_metadata_offset, 8, 24);
|
||||
s.copy((char *) &h.json_metadata_bytes, 8, 32);
|
||||
s.copy((char *) &h.leaf_dirs_offset, 8, 40);
|
||||
s.copy((char *) &h.leaf_dirs_bytes, 8, 48);
|
||||
s.copy((char *) &h.tile_data_offset, 8, 56);
|
||||
s.copy((char *) &h.tile_data_bytes, 8, 64);
|
||||
s.copy((char *) &h.addressed_tiles_count, 8, 72);
|
||||
s.copy((char *) &h.tile_entries_count, 8, 80);
|
||||
s.copy((char *) &h.tile_contents_count, 8, 88);
|
||||
if (s[96] == 0x1) {
|
||||
h.clustered = true;
|
||||
} else {
|
||||
h.clustered = false;
|
||||
}
|
||||
h.internal_compression = s[97];
|
||||
h.tile_compression = s[98];
|
||||
h.tile_type = s[99];
|
||||
h.min_zoom = s[100];
|
||||
h.max_zoom = s[101];
|
||||
s.copy((char *) &h.min_lon_e7, 4, 102);
|
||||
s.copy((char *) &h.min_lat_e7, 4, 106);
|
||||
s.copy((char *) &h.max_lon_e7, 4, 110);
|
||||
s.copy((char *) &h.max_lat_e7, 4, 114);
|
||||
h.center_zoom = s[118];
|
||||
s.copy((char *) &h.center_lon_e7, 4, 119);
|
||||
s.copy((char *) &h.center_lat_e7, 4, 123);
|
||||
return h;
|
||||
}
|
||||
|
||||
struct zxy {
|
||||
uint8_t z;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
zxy(int _z, int _x, int _y)
|
||||
: z(_z), x(_x), y(_y) {
|
||||
}
|
||||
};
|
||||
|
||||
struct entryv3 {
|
||||
uint64_t tile_id;
|
||||
uint64_t offset;
|
||||
uint32_t length;
|
||||
uint32_t run_length;
|
||||
|
||||
entryv3()
|
||||
: tile_id(0), offset(0), length(0), run_length(0) {
|
||||
}
|
||||
|
||||
entryv3(uint64_t _tile_id, uint64_t _offset, uint32_t _length, uint32_t _run_length)
|
||||
: tile_id(_tile_id), offset(_offset), length(_length), run_length(_run_length) {
|
||||
}
|
||||
};
|
||||
|
||||
struct {
|
||||
bool operator()(entryv3 a, entryv3 b) const {
|
||||
return a.tile_id < b.tile_id;
|
||||
}
|
||||
} entryv3_cmp;
|
||||
|
||||
struct entry_zxy {
|
||||
uint8_t z;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint64_t offset;
|
||||
uint32_t length;
|
||||
|
||||
entry_zxy(uint8_t _z, uint32_t _x, uint32_t _y, uint64_t _offset, uint32_t _length)
|
||||
: z(_z), x(_x), y(_y), offset(_offset), length(_length) {
|
||||
}
|
||||
};
|
||||
|
||||
struct {
|
||||
bool operator()(entry_zxy a, entry_zxy b) const {
|
||||
if (a.z != b.z) {
|
||||
return a.z < b.z;
|
||||
}
|
||||
if (a.x != b.x) {
|
||||
return a.x < b.x;
|
||||
}
|
||||
return a.y < b.y;
|
||||
}
|
||||
} entry_zxy_cmp;
|
||||
|
||||
struct varint_too_long_exception : std::exception {
|
||||
const char *what() const noexcept override {
|
||||
return "varint too long exception";
|
||||
}
|
||||
};
|
||||
|
||||
struct end_of_buffer_exception : std::exception {
|
||||
const char *what() const noexcept override {
|
||||
return "end of buffer exception";
|
||||
}
|
||||
};
|
||||
|
||||
namespace {
|
||||
constexpr const int8_t max_varint_length = sizeof(uint64_t) * 8 / 7 + 1;
|
||||
|
||||
// from https://github.com/mapbox/protozero/blob/master/include/protozero/varint.hpp
|
||||
uint64_t decode_varint_impl(const char **data, const char *end) {
|
||||
const auto *begin = reinterpret_cast<const int8_t *>(*data);
|
||||
const auto *iend = reinterpret_cast<const int8_t *>(end);
|
||||
const int8_t *p = begin;
|
||||
uint64_t val = 0;
|
||||
|
||||
if (iend - begin >= max_varint_length) { // fast path
|
||||
do {
|
||||
int64_t b = *p++;
|
||||
val = ((uint64_t(b) & 0x7fU));
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 7U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 14U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 21U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 28U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 35U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 42U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 49U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x7fU) << 56U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
b = *p++;
|
||||
val |= ((uint64_t(b) & 0x01U) << 63U);
|
||||
if (b >= 0) {
|
||||
break;
|
||||
}
|
||||
throw varint_too_long_exception{};
|
||||
} while (false);
|
||||
} else {
|
||||
unsigned int shift = 0;
|
||||
while (p != iend && *p < 0) {
|
||||
val |= (uint64_t(*p++) & 0x7fU) << shift;
|
||||
shift += 7;
|
||||
}
|
||||
if (p == iend) {
|
||||
throw end_of_buffer_exception{};
|
||||
}
|
||||
val |= uint64_t(*p++) << shift;
|
||||
}
|
||||
|
||||
*data = reinterpret_cast<const char *>(p);
|
||||
return val;
|
||||
}
|
||||
|
||||
uint64_t decode_varint(const char **data, const char *end) {
|
||||
// If this is a one-byte varint, decode it here.
|
||||
if (end != *data && ((static_cast<uint64_t>(**data) & 0x80U) == 0)) {
|
||||
const auto val = static_cast<uint64_t>(**data);
|
||||
++(*data);
|
||||
return val;
|
||||
}
|
||||
// If this varint is more than one byte, defer to complete implementation.
|
||||
return decode_varint_impl(data, end);
|
||||
}
|
||||
|
||||
void rotate(int64_t n, int64_t &x, int64_t &y, int64_t rx, int64_t ry) {
|
||||
if (ry == 0) {
|
||||
if (rx == 1) {
|
||||
x = n - 1 - x;
|
||||
y = n - 1 - y;
|
||||
}
|
||||
int64_t t = x;
|
||||
x = y;
|
||||
y = t;
|
||||
}
|
||||
}
|
||||
|
||||
zxy t_on_level(uint8_t z, uint64_t pos) {
|
||||
int64_t n = 1 << z;
|
||||
int64_t rx, ry, s, t = pos;
|
||||
int64_t tx = 0;
|
||||
int64_t ty = 0;
|
||||
|
||||
for (s = 1; s < n; s *= 2) {
|
||||
rx = 1 & (t / 2);
|
||||
ry = 1 & (t ^ rx);
|
||||
rotate(s, tx, ty, rx, ry);
|
||||
tx += s * rx;
|
||||
ty += s * ry;
|
||||
t /= 4;
|
||||
}
|
||||
return zxy(z, tx, ty);
|
||||
}
|
||||
|
||||
int write_varint(std::back_insert_iterator<std::string> data, uint64_t value) {
|
||||
int n = 1;
|
||||
|
||||
while (value >= 0x80U) {
|
||||
*data++ = char((value & 0x7fU) | 0x80U);
|
||||
value >>= 7U;
|
||||
++n;
|
||||
}
|
||||
*data = char(value);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// TMS order
|
||||
struct {
|
||||
bool operator()(entry_zxy a, entry_zxy b) const {
|
||||
if (a.z != b.z) {
|
||||
return a.z < b.z;
|
||||
}
|
||||
if (a.x != b.x) {
|
||||
return a.x < b.x;
|
||||
}
|
||||
return a.y > b.y;
|
||||
}
|
||||
} colmajor_cmp;
|
||||
|
||||
// use a 0 length entry as a null value.
|
||||
entryv3 find_tile(const std::vector<entryv3> &entries, uint64_t tile_id) {
|
||||
int m = 0;
|
||||
int n = entries.size() - 1;
|
||||
while (m <= n) {
|
||||
int k = (n + m) >> 1;
|
||||
int cmp = tile_id - entries[k].tile_id;
|
||||
if (cmp > 0) {
|
||||
m = k + 1;
|
||||
} else if (cmp < 0) {
|
||||
n = k - 1;
|
||||
} else {
|
||||
return entries[k];
|
||||
}
|
||||
}
|
||||
|
||||
if (n >= 0) {
|
||||
if (entries[n].run_length == 0) {
|
||||
return entries[n];
|
||||
}
|
||||
if (tile_id - entries[n].tile_id < entries[n].run_length) {
|
||||
return entries[n];
|
||||
}
|
||||
}
|
||||
|
||||
return entryv3{0, 0, 0, 0};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
inline zxy tileid_to_zxy(uint64_t tileid) {
|
||||
uint64_t acc = 0;
|
||||
uint8_t t_z = 0;
|
||||
while (true) {
|
||||
uint64_t num_tiles = (1LL << t_z) * (1LL << t_z);
|
||||
if (acc + num_tiles > tileid) {
|
||||
return t_on_level(t_z, tileid - acc);
|
||||
}
|
||||
acc += num_tiles;
|
||||
t_z++;
|
||||
}
|
||||
}
|
||||
|
||||
inline uint64_t zxy_to_tileid(uint8_t z, uint32_t x, uint32_t y) {
|
||||
uint64_t acc = 0;
|
||||
for (uint8_t t_z = 0; t_z < z; t_z++) acc += (1LL << t_z) * (1LL << t_z);
|
||||
int64_t n = 1 << z;
|
||||
int64_t rx, ry, s, d = 0;
|
||||
int64_t tx = x;
|
||||
int64_t ty = y;
|
||||
for (s = n / 2; s > 0; s /= 2) {
|
||||
rx = (tx & s) > 0;
|
||||
ry = (ty & s) > 0;
|
||||
d += s * s * ((3 * rx) ^ ry);
|
||||
rotate(s, tx, ty, rx, ry);
|
||||
}
|
||||
return acc + d;
|
||||
}
|
||||
|
||||
// returns an uncompressed byte buffer
|
||||
inline std::string serialize_directory(const std::vector<entryv3> &entries) {
|
||||
std::string data;
|
||||
|
||||
write_varint(std::back_inserter(data), entries.size());
|
||||
|
||||
uint64_t last_id = 0;
|
||||
for (auto const &entry : entries) {
|
||||
write_varint(std::back_inserter(data), entry.tile_id - last_id);
|
||||
last_id = entry.tile_id;
|
||||
}
|
||||
|
||||
for (auto const &entry : entries) {
|
||||
write_varint(std::back_inserter(data), entry.run_length);
|
||||
}
|
||||
|
||||
for (auto const &entry : entries) {
|
||||
write_varint(std::back_inserter(data), entry.length);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (i > 0 && entries[i].offset == entries[i - 1].offset + entries[i - 1].length) {
|
||||
write_varint(std::back_inserter(data), 0);
|
||||
} else {
|
||||
write_varint(std::back_inserter(data), entries[i].offset + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// takes an uncompressed byte buffer
|
||||
inline std::vector<entryv3> deserialize_directory(const std::string &decompressed) {
|
||||
const char *t = decompressed.data();
|
||||
const char *end = t + decompressed.size();
|
||||
|
||||
uint64_t num_entries = decode_varint(&t, end);
|
||||
|
||||
std::vector<entryv3> result;
|
||||
result.resize(num_entries);
|
||||
|
||||
uint64_t last_id = 0;
|
||||
for (size_t i = 0; i < num_entries; i++) {
|
||||
uint64_t tile_id = last_id + decode_varint(&t, end);
|
||||
result[i].tile_id = tile_id;
|
||||
last_id = tile_id;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_entries; i++) {
|
||||
result[i].run_length = decode_varint(&t, end);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_entries; i++) {
|
||||
result[i].length = decode_varint(&t, end);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_entries; i++) {
|
||||
uint64_t tmp = decode_varint(&t, end);
|
||||
|
||||
if (i > 0 && tmp == 0) {
|
||||
result[i].offset = result[i - 1].offset + result[i - 1].length;
|
||||
} else {
|
||||
result[i].offset = tmp - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// assert the directory has been fully consumed
|
||||
if (t != end) {
|
||||
fprintf(stderr, "Error: malformed pmtiles directory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::tuple<std::string, std::string, int> build_root_leaves(const std::function<std::string(const std::string &, uint8_t)> mycompress, uint8_t compression, const std::vector<pmtiles::entryv3> &entries, int leaf_size) {
|
||||
std::vector<pmtiles::entryv3> root_entries;
|
||||
std::string leaves_bytes;
|
||||
int num_leaves = 0;
|
||||
for (size_t i = 0; i <= entries.size(); i += leaf_size) {
|
||||
num_leaves++;
|
||||
int end = i + leaf_size;
|
||||
if (i + leaf_size > entries.size()) {
|
||||
end = entries.size();
|
||||
}
|
||||
std::vector<pmtiles::entryv3> subentries = {entries.begin() + i, entries.begin() + end};
|
||||
auto uncompressed_leaf = pmtiles::serialize_directory(subentries);
|
||||
auto compressed_leaf = mycompress(uncompressed_leaf, compression);
|
||||
root_entries.emplace_back(entries[i].tile_id, leaves_bytes.size(), compressed_leaf.size(), 0);
|
||||
leaves_bytes += compressed_leaf;
|
||||
}
|
||||
auto uncompressed_root = pmtiles::serialize_directory(root_entries);
|
||||
auto compressed_root = mycompress(uncompressed_root, compression);
|
||||
return std::make_tuple(compressed_root, leaves_bytes, num_leaves);
|
||||
}
|
||||
|
||||
inline std::tuple<std::string, std::string, int> make_root_leaves(const std::function<std::string(const std::string &, uint8_t)> mycompress, uint8_t compression, const std::vector<pmtiles::entryv3> &entries) {
|
||||
auto test_bytes = pmtiles::serialize_directory(entries);
|
||||
auto compressed = mycompress(test_bytes, compression);
|
||||
if (compressed.size() <= 16384 - 127) {
|
||||
return std::make_tuple(compressed, "", 0);
|
||||
}
|
||||
int leaf_size = 4096;
|
||||
while (true) {
|
||||
std::string root_bytes;
|
||||
std::string leaves_bytes;
|
||||
int num_leaves;
|
||||
std::tie(root_bytes, leaves_bytes, num_leaves) = build_root_leaves(mycompress, compression, entries, leaf_size);
|
||||
if (root_bytes.length() < 16384 - 127) {
|
||||
return std::make_tuple(root_bytes, leaves_bytes, num_leaves);
|
||||
}
|
||||
leaf_size *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
inline void collect_entries(const std::function<std::string(const std::string &, uint8_t)> decompress, std::vector<entry_zxy> &tile_entries, const char *pmtiles_map, const headerv3 &h, uint64_t dir_offset, uint64_t dir_len) {
|
||||
std::string dir_s{pmtiles_map + dir_offset, dir_len};
|
||||
std::string decompressed_dir = decompress(dir_s, h.internal_compression);
|
||||
|
||||
auto dir_entries = pmtiles::deserialize_directory(decompressed_dir);
|
||||
for (auto const &entry : dir_entries) {
|
||||
if (entry.run_length == 0) {
|
||||
collect_entries(decompress, tile_entries, pmtiles_map, h, h.leaf_dirs_offset + entry.offset, entry.length);
|
||||
} else {
|
||||
for (uint64_t i = entry.tile_id; i < entry.tile_id + entry.run_length; i++) {
|
||||
pmtiles::zxy zxy = pmtiles::tileid_to_zxy(i);
|
||||
tile_entries.emplace_back(zxy.z, zxy.x, zxy.y, h.tile_data_offset + entry.offset, entry.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline std::vector<entry_zxy> entries_tms(const std::function<std::string(const std::string &, uint8_t)> decompress, const char *pmtiles_map) {
|
||||
std::string header_s{pmtiles_map, 127};
|
||||
auto header = pmtiles::deserialize_header(header_s);
|
||||
|
||||
std::vector<entry_zxy> tile_entries;
|
||||
|
||||
collect_entries(decompress, tile_entries, pmtiles_map, header, header.root_dir_offset, header.root_dir_bytes);
|
||||
std::sort(tile_entries.begin(), tile_entries.end(), colmajor_cmp);
|
||||
return tile_entries;
|
||||
}
|
||||
|
||||
inline std::pair<uint64_t, uint32_t> get_tile(const std::function<std::string(const std::string &, uint8_t)> decompress, const char *pmtiles_map, uint8_t z, uint32_t x, uint32_t y) {
|
||||
uint64_t tile_id = pmtiles::zxy_to_tileid(z, x, y);
|
||||
|
||||
std::string header_s{pmtiles_map, 127};
|
||||
auto h = pmtiles::deserialize_header(header_s);
|
||||
|
||||
uint64_t dir_offset = h.root_dir_offset;
|
||||
uint32_t dir_length = h.root_dir_bytes;
|
||||
for (int depth = 0; depth <= 3; depth++) {
|
||||
std::string dir_s{pmtiles_map + dir_offset, dir_length};
|
||||
std::string decompressed_dir = decompress(dir_s, h.internal_compression);
|
||||
auto dir_entries = pmtiles::deserialize_directory(decompressed_dir);
|
||||
auto entry = find_tile(dir_entries, tile_id);
|
||||
|
||||
if (entry.length > 0) {
|
||||
if (entry.run_length > 0) {
|
||||
return std::make_pair(h.tile_data_offset + entry.offset, entry.length);
|
||||
} else {
|
||||
dir_offset = h.leaf_dirs_offset + entry.offset;
|
||||
dir_length = entry.length;
|
||||
}
|
||||
} else {
|
||||
return std::make_pair(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair(0, 0);
|
||||
}
|
||||
|
||||
} // namespace pmtiles
|
||||
#endif
|
||||
@@ -0,0 +1,449 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sqlite3.h>
|
||||
#include "errors.hpp"
|
||||
#include "pmtiles_file.hpp"
|
||||
#include "mvt.hpp"
|
||||
#include "write_json.hpp"
|
||||
|
||||
bool pmtiles_has_suffix(const char *filename) {
|
||||
if (filename == nullptr) {
|
||||
return false;
|
||||
}
|
||||
size_t lenstr = strlen(filename);
|
||||
if (lenstr < 8) {
|
||||
return false;
|
||||
}
|
||||
if (strncmp(filename + (lenstr - 8), ".pmtiles", 8) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void check_pmtiles(const char *filename, char **argv, bool forcetable) {
|
||||
struct stat st;
|
||||
if (stat(filename, &st) == 0) {
|
||||
fprintf(stderr, "%s: Tileset \"%s\" already exists. You can use --force if you want to delete the old tileset.\n", argv[0], filename);
|
||||
fprintf(stderr, "%s: %s: file exists\n", argv[0], filename);
|
||||
|
||||
if (forcetable) {
|
||||
fprintf(stderr, "%s: --allow-existing is not supported for pmtiles\n", argv[0]);
|
||||
}
|
||||
|
||||
exit(EXIT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
std::string decompress_fn(const std::string &input, uint8_t compression) {
|
||||
std::string output;
|
||||
if (compression == pmtiles::COMPRESSION_NONE) {
|
||||
output = input;
|
||||
} else if (compression == pmtiles::COMPRESSION_GZIP) {
|
||||
decompress(input, output);
|
||||
} else {
|
||||
throw std::runtime_error("Unknown or unsupported compression.");
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string compress_fn(const std::string &input, uint8_t compression) {
|
||||
std::string output;
|
||||
if (compression == pmtiles::COMPRESSION_NONE) {
|
||||
output = input;
|
||||
} else if (compression == pmtiles::COMPRESSION_GZIP) {
|
||||
compress(input, output);
|
||||
} else {
|
||||
throw std::runtime_error("Unknown or unsupported compression.");
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<pmtiles::entry_zxy> pmtiles_entries_tms(const char *pmtiles_map, int minzoom, int maxzoom) {
|
||||
std::vector<pmtiles::entry_zxy> filtered;
|
||||
auto all_entries = pmtiles::entries_tms(&decompress_fn, pmtiles_map);
|
||||
std::copy_if(all_entries.begin(), all_entries.end(), std::back_inserter(filtered), [minzoom, maxzoom](pmtiles::entry_zxy e) { return e.z >= minzoom && e.z <= maxzoom; });
|
||||
return filtered;
|
||||
}
|
||||
|
||||
std::pair<uint64_t, uint32_t> pmtiles_get_tile(const char *pmtiles_map, int z, int x, int y) {
|
||||
return pmtiles::get_tile(&decompress_fn, pmtiles_map, z, x, y);
|
||||
}
|
||||
|
||||
static void out(json_writer &state, std::string k, std::string v) {
|
||||
state.json_comma_newline();
|
||||
state.json_write_string(k);
|
||||
state.json_write_string(v);
|
||||
}
|
||||
|
||||
std::string metadata_to_pmtiles_json(metadata m) {
|
||||
std::string buf;
|
||||
json_writer state(&buf);
|
||||
|
||||
state.json_write_hash();
|
||||
state.json_write_newline();
|
||||
|
||||
out(state, "name", m.name);
|
||||
out(state, "format", m.format);
|
||||
out(state, "type", m.type);
|
||||
out(state, "description", m.description);
|
||||
out(state, "version", std::to_string(m.version));
|
||||
if (m.attribution.size() > 0) {
|
||||
out(state, "attribution", m.attribution);
|
||||
}
|
||||
if (m.strategies_json.size() > 0) {
|
||||
state.json_comma_newline();
|
||||
state.json_write_string("strategies");
|
||||
state.json_write_json(m.strategies_json);
|
||||
}
|
||||
out(state, "generator", m.generator);
|
||||
out(state, "generator_options", m.generator_options);
|
||||
|
||||
if (m.vector_layers_json.size() > 0) {
|
||||
state.json_comma_newline();
|
||||
state.json_write_string("vector_layers");
|
||||
state.json_write_json(m.vector_layers_json);
|
||||
}
|
||||
|
||||
if (m.tilestats_json.size() > 0) {
|
||||
state.json_comma_newline();
|
||||
state.json_write_string("tilestats");
|
||||
state.json_write_json(m.tilestats_json);
|
||||
}
|
||||
|
||||
state.json_write_newline();
|
||||
state.json_end_hash();
|
||||
state.json_write_newline();
|
||||
std::string compressed;
|
||||
compress(buf, compressed);
|
||||
return compressed;
|
||||
}
|
||||
|
||||
void mbtiles_map_image_to_pmtiles(char *fname, metadata m, bool tile_compression, bool quiet, bool quiet_progress) {
|
||||
sqlite3 *db;
|
||||
|
||||
if (sqlite3_open(fname, &db) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
char *err = NULL;
|
||||
if (sqlite3_exec(db, "PRAGMA integrity_check;", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: integrity_check: %s\n", fname, err);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
// materialize list of all tile IDs
|
||||
std::vector<uint64_t> tile_ids;
|
||||
|
||||
{
|
||||
const char *sql = "SELECT zoom_level, tile_column, tile_row FROM map";
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
int zoom = sqlite3_column_int(stmt, 0);
|
||||
int x = sqlite3_column_int(stmt, 1);
|
||||
int sorty = sqlite3_column_int(stmt, 2);
|
||||
int y = (1LL << zoom) - 1 - sorty;
|
||||
uint64_t res = pmtiles::zxy_to_tileid(zoom, x, y);
|
||||
tile_ids.push_back(res);
|
||||
}
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
std::sort(tile_ids.begin(), tile_ids.end());
|
||||
|
||||
std::unordered_map<std::string, std::pair<unsigned long long, unsigned long>> hash_to_offset_len;
|
||||
std::vector<pmtiles::entryv3> entries;
|
||||
unsigned long long offset = 0;
|
||||
|
||||
std::string tmpname = (std::string(fname) + ".tmp");
|
||||
|
||||
// write tile data to tempfile in clustered order
|
||||
{
|
||||
const char *map_sql = "SELECT tile_id FROM map WHERE zoom_level = ? AND tile_column = ? AND tile_row = ?";
|
||||
sqlite3_stmt *map_stmt;
|
||||
|
||||
if (sqlite3_prepare_v2(db, map_sql, -1, &map_stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
const char *image_sql = "SELECT tile_data FROM images WHERE tile_id = ?";
|
||||
sqlite3_stmt *image_stmt;
|
||||
|
||||
if (sqlite3_prepare_v2(db, image_sql, -1, &image_stmt, NULL) != SQLITE_OK) {
|
||||
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
std::ofstream tmp_ostream;
|
||||
|
||||
tmp_ostream.open(tmpname.c_str(), std::ios::out | std::ios::binary);
|
||||
|
||||
int idx = 0;
|
||||
for (auto const &tile_id : tile_ids) {
|
||||
idx = idx + 1;
|
||||
double progress = ((double) idx / tile_ids.size()) * 100;
|
||||
pmtiles::zxy zxy = pmtiles::tileid_to_zxy(tile_id);
|
||||
if (!quiet && !quiet_progress) {
|
||||
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, zxy.z, zxy.x, zxy.y);
|
||||
}
|
||||
sqlite3_bind_int(map_stmt, 1, zxy.z);
|
||||
sqlite3_bind_int(map_stmt, 2, zxy.x);
|
||||
sqlite3_bind_int(map_stmt, 3, (1LL << zxy.z) - 1 - zxy.y);
|
||||
|
||||
if (sqlite3_step(map_stmt) != SQLITE_ROW) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in map table\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
std::string hsh{reinterpret_cast<const char *>(sqlite3_column_text(map_stmt, 0))};
|
||||
|
||||
if (hash_to_offset_len.count(hsh) > 0) {
|
||||
auto offset_len = hash_to_offset_len.at(hsh);
|
||||
if (entries.size() > 0 && tile_id == entries[entries.size() - 1].tile_id + 1 && entries[entries.size() - 1].offset == std::get<0>(offset_len)) {
|
||||
entries[entries.size() - 1].run_length++;
|
||||
} else {
|
||||
entries.emplace_back(tile_id, std::get<0>(offset_len), std::get<1>(offset_len), 1);
|
||||
}
|
||||
} else {
|
||||
sqlite3_bind_text(image_stmt, 1, hsh.data(), hsh.size(), SQLITE_STATIC);
|
||||
if (sqlite3_step(image_stmt) != SQLITE_ROW) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in image table\n");
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
int len = sqlite3_column_bytes(image_stmt, 0);
|
||||
const char *blob = (const char *) sqlite3_column_blob(image_stmt, 0);
|
||||
|
||||
tmp_ostream.write(blob, len);
|
||||
|
||||
entries.emplace_back(tile_id, offset, len, 1);
|
||||
hash_to_offset_len.emplace(hsh, std::make_pair(offset, len));
|
||||
offset += len;
|
||||
|
||||
sqlite3_reset(image_stmt);
|
||||
sqlite3_clear_bindings(image_stmt);
|
||||
}
|
||||
|
||||
sqlite3_reset(map_stmt);
|
||||
sqlite3_clear_bindings(map_stmt);
|
||||
}
|
||||
tmp_ostream.close();
|
||||
sqlite3_finalize(map_stmt);
|
||||
sqlite3_finalize(image_stmt);
|
||||
}
|
||||
|
||||
// finalize PMTiles archive.
|
||||
{
|
||||
std::sort(entries.begin(), entries.end(), pmtiles::entryv3_cmp);
|
||||
|
||||
std::string root_bytes;
|
||||
std::string leaves_bytes;
|
||||
int num_leaves;
|
||||
std::tie(root_bytes, leaves_bytes, num_leaves) = make_root_leaves(&compress_fn, pmtiles::COMPRESSION_GZIP, entries);
|
||||
|
||||
pmtiles::headerv3 header;
|
||||
|
||||
header.min_zoom = m.minzoom;
|
||||
header.max_zoom = m.maxzoom;
|
||||
header.min_lon_e7 = m.minlon * 10000000;
|
||||
header.min_lat_e7 = m.minlat * 10000000;
|
||||
header.max_lon_e7 = m.maxlon * 10000000;
|
||||
header.max_lat_e7 = m.maxlat * 10000000;
|
||||
header.center_zoom = m.center_z;
|
||||
header.center_lon_e7 = m.center_lon * 10000000;
|
||||
header.center_lat_e7 = m.center_lat * 10000000;
|
||||
|
||||
std::string json_metadata = metadata_to_pmtiles_json(m);
|
||||
|
||||
sqlite3_close(db);
|
||||
|
||||
header.clustered = 0x1;
|
||||
header.internal_compression = pmtiles::COMPRESSION_GZIP;
|
||||
|
||||
if (tile_compression) {
|
||||
header.tile_compression = pmtiles::COMPRESSION_GZIP;
|
||||
} else {
|
||||
header.tile_compression = pmtiles::COMPRESSION_NONE;
|
||||
}
|
||||
|
||||
if (m.format == "pbf") {
|
||||
header.tile_type = pmtiles::TILETYPE_MVT;
|
||||
} else if (m.format == "png") {
|
||||
header.tile_type = pmtiles::TILETYPE_PNG;
|
||||
} else {
|
||||
header.tile_type = pmtiles::TILETYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
header.root_dir_offset = 127;
|
||||
header.root_dir_bytes = root_bytes.size();
|
||||
|
||||
header.json_metadata_offset = header.root_dir_offset + header.root_dir_bytes;
|
||||
header.json_metadata_bytes = json_metadata.size();
|
||||
header.leaf_dirs_offset = header.json_metadata_offset + header.json_metadata_bytes;
|
||||
header.leaf_dirs_bytes = leaves_bytes.size();
|
||||
header.tile_data_offset = header.leaf_dirs_offset + header.leaf_dirs_bytes;
|
||||
header.tile_data_bytes = offset;
|
||||
|
||||
header.addressed_tiles_count = tile_ids.size();
|
||||
header.tile_entries_count = entries.size();
|
||||
header.tile_contents_count = hash_to_offset_len.size();
|
||||
|
||||
std::ifstream tmp_istream(tmpname.c_str(), std::ios::in | std::ios_base::binary);
|
||||
|
||||
std::ofstream ostream;
|
||||
ostream.open(fname, std::ios::out | std::ios::binary);
|
||||
|
||||
auto header_str = header.serialize();
|
||||
ostream.write(header_str.data(), header_str.length());
|
||||
ostream.write(root_bytes.data(), root_bytes.length());
|
||||
ostream.write(json_metadata.data(), json_metadata.size());
|
||||
ostream.write(leaves_bytes.data(), leaves_bytes.length());
|
||||
ostream << tmp_istream.rdbuf();
|
||||
|
||||
tmp_istream.close();
|
||||
unlink(tmpname.c_str());
|
||||
ostream.close();
|
||||
}
|
||||
}
|
||||
|
||||
// this should go away if we get rid of temporary metadata DBs.
|
||||
// it transforms the PMTiles header + json into string keys/string values
|
||||
// consistent with mbtiles and dirtiles, for the test suite
|
||||
sqlite3 *pmtilesmeta2tmp(const char *fname, const char *pmtiles_map) {
|
||||
sqlite3 *db;
|
||||
char *sql;
|
||||
char *err;
|
||||
|
||||
if (sqlite3_open("", &db) != SQLITE_OK) {
|
||||
fprintf(stderr, "Temporary db: %s\n", sqlite3_errmsg(db));
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
if (sqlite3_exec(db, "CREATE TABLE metadata (name text, value text);", NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "Create metadata table: %s\n", err);
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
|
||||
std::string header_s{pmtiles_map, 127};
|
||||
auto header = pmtiles::deserialize_header(header_s);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('minzoom', %d);", header.min_zoom);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set minzoom: %s\n", err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('maxzoom', %d);", header.max_zoom);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set maxzoom: %s\n", err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
double center_lon = double(header.center_lon_e7) / 10000000.0;
|
||||
double center_lat = double(header.center_lat_e7) / 10000000.0;
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('center', '%f,%f,%d');", center_lon, center_lat, header.center_zoom);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set center: %s\n", err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
double minlon = double(header.min_lon_e7) / 10000000.0;
|
||||
double minlat = double(header.min_lat_e7) / 10000000.0;
|
||||
double maxlon = double(header.max_lon_e7) / 10000000.0;
|
||||
double maxlat = double(header.max_lat_e7) / 10000000.0;
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('bounds', '%f,%f,%f,%f');", minlon, minlat, maxlon, maxlat);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set bounds: %s\n", err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
|
||||
std::string json_s{pmtiles_map + header.json_metadata_offset, header.json_metadata_bytes};
|
||||
std::string decompressed_json;
|
||||
|
||||
if (header.internal_compression == pmtiles::COMPRESSION_NONE) {
|
||||
decompressed_json = json_s;
|
||||
} else if (header.internal_compression == pmtiles::COMPRESSION_GZIP) {
|
||||
decompress(json_s, decompressed_json);
|
||||
} else {
|
||||
fprintf(stderr, "Unknown or unsupported pmtiles compression: %d\n", header.internal_compression);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
json_pull *jp = json_begin_string(decompressed_json.c_str());
|
||||
json_object *o = json_read_tree(jp);
|
||||
if (o == NULL) {
|
||||
fprintf(stderr, "%s: metadata parsing error: %s\n", fname, jp->error);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
if (o->type != JSON_HASH) {
|
||||
fprintf(stderr, "%s: bad metadata format\n", fname);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
bool has_json = false;
|
||||
std::string buf;
|
||||
json_writer state(&buf);
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
for (size_t i = 0; i < o->value.object.length; i++) {
|
||||
const char *key = o->value.object.keys[i]->value.string.string;
|
||||
if (strcmp(key, "vector_layers") == 0 && o->value.object.values[i]->type == JSON_ARRAY) {
|
||||
has_json = true;
|
||||
state.nospace = true;
|
||||
state.json_write_string("vector_layers");
|
||||
state.nospace = true;
|
||||
state.json_write_json(json_stringify(o->value.object.values[i]));
|
||||
} else if (strcmp(key, "tilestats") == 0 && o->value.object.values[i]->type == JSON_HASH) {
|
||||
has_json = true;
|
||||
state.nospace = true;
|
||||
state.json_write_string("tilestats");
|
||||
state.nospace = true;
|
||||
state.json_write_json(json_stringify(o->value.object.values[i]));
|
||||
} else if (strcmp(key, "strategies") == 0 && o->value.object.values[i]->type == JSON_ARRAY) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('strategies', %Q);", json_stringify(o->value.object.values[i]));
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set %s in metadata: %s\n", key, err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
} else if (o->value.object.keys[i]->type != JSON_STRING || o->value.object.values[i]->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s\n", key);
|
||||
fprintf(stderr, "%s: non-string in metadata\n", fname);
|
||||
} else {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES (%Q, %Q);", key, o->value.object.values[i]->value.string.string);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set %s in metadata: %s\n", key, err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
}
|
||||
|
||||
json_end(jp);
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
|
||||
if (has_json) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('json', %Q);", buf.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set json in metadata: %s\n", err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
return db;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef PMTILES_FILE_HPP
|
||||
#define PMTILES_FILE_HPP
|
||||
|
||||
#include "pmtiles/pmtiles.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
|
||||
bool pmtiles_has_suffix(const char *filename);
|
||||
void check_pmtiles(const char *filename, char **argv, bool forcetable);
|
||||
|
||||
void mbtiles_map_image_to_pmtiles(char *dbname, metadata m, bool tile_compression, bool quiet, bool quiet_progress);
|
||||
|
||||
std::vector<pmtiles::entry_zxy> pmtiles_entries_tms(const char *pmtiles_map, int minzoom, int maxzoom);
|
||||
std::pair<uint64_t, uint32_t> pmtiles_get_tile(const char *pmtiles_map, int z, int x, int y);
|
||||
sqlite3 *pmtilesmeta2tmp(const char *fname, const char *pmtiles_map);
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <math.h>
|
||||
#include "memfile.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
int swizzlecmp(const char *a, const char *b) {
|
||||
ssize_t alen = strlen(a);
|
||||
@@ -63,11 +64,11 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
long long off = poolfile->off;
|
||||
if (memfile_write(poolfile, &type, 1) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
if (memfile_write(poolfile, (void *) s, strlen(s) + 1) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
return off;
|
||||
}
|
||||
@@ -84,11 +85,11 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
long long off = poolfile->off;
|
||||
if (memfile_write(poolfile, &type, 1) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
if (memfile_write(poolfile, (void *) s, strlen(s) + 1) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
|
||||
if (off >= LONG_MAX || treefile->off >= LONG_MAX) {
|
||||
@@ -109,7 +110,7 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
long long p = treefile->off;
|
||||
if (memfile_write(treefile, &tsp, sizeof(struct stringpool)) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
|
||||
if (ssp == -1) {
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
#include <math.h>
|
||||
#include <atomic>
|
||||
#include "projection.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
unsigned long long (*encode_index)(unsigned int wx, unsigned int wy) = NULL;
|
||||
void (*decode_index)(unsigned long long index, unsigned *wx, unsigned *wy) = NULL;
|
||||
@@ -212,6 +213,6 @@ void set_projection_or_exit(const char *optarg) {
|
||||
}
|
||||
if (p->name == NULL) {
|
||||
fprintf(stderr, "Unknown projection (-s): %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-7
@@ -12,6 +12,7 @@
|
||||
#include "text.hpp"
|
||||
#include "mvt.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "errors.hpp"
|
||||
|
||||
const char *geometry_names[GEOM_TYPES] = {
|
||||
"Point",
|
||||
@@ -47,13 +48,13 @@ void json_context(json_object *j) {
|
||||
sprintf(s + 497, "...");
|
||||
}
|
||||
|
||||
fprintf(stderr, "In JSON object %s\n", s);
|
||||
fprintf(stderr, "in JSON object %s\n", s);
|
||||
free(s); // stringify
|
||||
}
|
||||
|
||||
void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fname, int line, json_object *feature) {
|
||||
if (j == NULL || j->type != JSON_ARRAY) {
|
||||
fprintf(stderr, "%s:%d: expected array for type %d\n", fname, line, t);
|
||||
fprintf(stderr, "%s:%d: expected array for geometry type %d: ", fname, line, t);
|
||||
json_context(feature);
|
||||
return;
|
||||
}
|
||||
@@ -83,8 +84,9 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
|
||||
static int warned = 0;
|
||||
|
||||
if (!warned) {
|
||||
fprintf(stderr, "%s:%d: ignoring dimensions beyond two\n", fname, line);
|
||||
fprintf(stderr, "%s:%d: ignoring dimensions beyond two: ", fname, line);
|
||||
json_context(j);
|
||||
fprintf(stderr, "%s:%d: ignoring dimensions beyond two: ", fname, line);
|
||||
json_context(feature);
|
||||
warned = 1;
|
||||
}
|
||||
@@ -92,10 +94,11 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
|
||||
|
||||
out.push_back(draw(op, x, y));
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d: malformed point\n", fname, line);
|
||||
fprintf(stderr, "%s:%d: malformed point: ", fname, line);
|
||||
json_context(j);
|
||||
fprintf(stderr, "%s:%d: malformed point: ", fname, line);
|
||||
json_context(feature);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,9 +148,9 @@ void stringify_value(json_object *value, int &type, std::string &stringified, co
|
||||
stringified = val;
|
||||
std::string err = check_utf8(val);
|
||||
if (err != "") {
|
||||
fprintf(stderr, "%s:%d: %s\n", reading, line, err.c_str());
|
||||
fprintf(stderr, "%s:%d: %s: ", reading, line, err.c_str());
|
||||
json_context(feature);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_UTF8);
|
||||
}
|
||||
} else if (vt == JSON_NUMBER) {
|
||||
type = mvt_double;
|
||||
|
||||
+85
-48
@@ -20,6 +20,7 @@
|
||||
#include "projection.hpp"
|
||||
#include "evaluator.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "errors.hpp"
|
||||
|
||||
// Offset coordinates to keep them positive
|
||||
#define COORD_OFFSET (4LL << 32)
|
||||
@@ -30,7 +31,7 @@ size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, c
|
||||
size_t w = fwrite(ptr, size, nitems, stream);
|
||||
if (w != nitems) {
|
||||
fprintf(stderr, "%s: Write to temporary file failed: %s\n", fname, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
@@ -52,14 +53,14 @@ void serialize_ulong_long(FILE *out, unsigned long long zigzag, std::atomic<long
|
||||
b |= 0x80;
|
||||
if (putc(b, out) == EOF) {
|
||||
fprintf(stderr, "%s: Write to temporary file failed: %s\n", fname, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
*fpos += 1;
|
||||
zigzag >>= 7;
|
||||
} else {
|
||||
if (putc(b, out) == EOF) {
|
||||
fprintf(stderr, "%s: Write to temporary file failed: %s\n", fname, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
*fpos += 1;
|
||||
break;
|
||||
@@ -191,14 +192,25 @@ static void write_geometry(drawvec const &dv, std::atomic<long long> *fpos, FILE
|
||||
void serialize_feature(FILE *geomfile, serial_feature *sf, std::atomic<long long> *geompos, const char *fname, long long wx, long long wy, bool include_minzoom) {
|
||||
serialize_byte(geomfile, sf->t, geompos, fname);
|
||||
|
||||
#define FLAG_LAYER 7
|
||||
|
||||
#define FLAG_LABEL_POINT 6
|
||||
#define FLAG_SEQ 5
|
||||
#define FLAG_INDEX 4
|
||||
#define FLAG_EXTENT 3
|
||||
#define FLAG_ID 2
|
||||
#define FLAG_MINZOOM 1
|
||||
#define FLAG_MAXZOOM 0
|
||||
|
||||
long long layer = 0;
|
||||
layer |= sf->layer << 6;
|
||||
layer |= (sf->seq != 0) << 5;
|
||||
layer |= (sf->index != 0) << 4;
|
||||
layer |= (sf->extent != 0) << 3;
|
||||
layer |= sf->has_id << 2;
|
||||
layer |= sf->has_tippecanoe_minzoom << 1;
|
||||
layer |= sf->has_tippecanoe_maxzoom << 0;
|
||||
layer |= sf->layer << FLAG_LAYER;
|
||||
layer |= (sf->label_point != 0) << FLAG_LABEL_POINT;
|
||||
layer |= (sf->seq != 0) << FLAG_SEQ;
|
||||
layer |= (sf->index != 0) << FLAG_INDEX;
|
||||
layer |= (sf->extent != 0) << FLAG_EXTENT;
|
||||
layer |= sf->has_id << FLAG_ID;
|
||||
layer |= sf->has_tippecanoe_minzoom << FLAG_MINZOOM;
|
||||
layer |= sf->has_tippecanoe_maxzoom << FLAG_MAXZOOM;
|
||||
|
||||
serialize_long_long(geomfile, layer, geompos, fname);
|
||||
if (sf->seq != 0) {
|
||||
@@ -221,6 +233,9 @@ void serialize_feature(FILE *geomfile, serial_feature *sf, std::atomic<long long
|
||||
if (sf->index != 0) {
|
||||
serialize_ulong_long(geomfile, sf->index, geompos, fname);
|
||||
}
|
||||
if (sf->label_point != 0) {
|
||||
serialize_ulong_long(geomfile, sf->label_point, geompos, fname);
|
||||
}
|
||||
if (sf->extent != 0) {
|
||||
serialize_long_long(geomfile, sf->extent, geompos, fname);
|
||||
}
|
||||
@@ -252,7 +267,7 @@ serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_
|
||||
deserialize_long_long_io(geoms, &sf.layer, geompos_in);
|
||||
|
||||
sf.seq = 0;
|
||||
if (sf.layer & (1 << 5)) {
|
||||
if (sf.layer & (1 << FLAG_SEQ)) {
|
||||
deserialize_long_long_io(geoms, &sf.seq, geompos_in);
|
||||
}
|
||||
|
||||
@@ -260,13 +275,13 @@ serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_
|
||||
sf.tippecanoe_maxzoom = -1;
|
||||
sf.id = 0;
|
||||
sf.has_id = false;
|
||||
if (sf.layer & (1 << 1)) {
|
||||
if (sf.layer & (1 << FLAG_MINZOOM)) {
|
||||
deserialize_int_io(geoms, &sf.tippecanoe_minzoom, geompos_in);
|
||||
}
|
||||
if (sf.layer & (1 << 0)) {
|
||||
if (sf.layer & (1 << FLAG_MAXZOOM)) {
|
||||
deserialize_int_io(geoms, &sf.tippecanoe_maxzoom, geompos_in);
|
||||
}
|
||||
if (sf.layer & (1 << 2)) {
|
||||
if (sf.layer & (1 << FLAG_ID)) {
|
||||
sf.has_id = true;
|
||||
deserialize_ulong_long_io(geoms, &sf.id, geompos_in);
|
||||
}
|
||||
@@ -274,17 +289,21 @@ serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_
|
||||
deserialize_int_io(geoms, &sf.segment, geompos_in);
|
||||
|
||||
sf.index = 0;
|
||||
sf.label_point = 0;
|
||||
sf.extent = 0;
|
||||
|
||||
sf.geometry = decode_geometry(geoms, geompos_in, z, tx, ty, sf.bbox, initial_x[sf.segment], initial_y[sf.segment]);
|
||||
if (sf.layer & (1 << 4)) {
|
||||
if (sf.layer & (1 << FLAG_INDEX)) {
|
||||
deserialize_ulong_long_io(geoms, &sf.index, geompos_in);
|
||||
}
|
||||
if (sf.layer & (1 << 3)) {
|
||||
if (sf.layer & (1 << FLAG_LABEL_POINT)) {
|
||||
deserialize_ulong_long_io(geoms, &sf.label_point, geompos_in);
|
||||
}
|
||||
if (sf.layer & (1 << FLAG_EXTENT)) {
|
||||
deserialize_long_long_io(geoms, &sf.extent, geompos_in);
|
||||
}
|
||||
|
||||
sf.layer >>= 6;
|
||||
sf.layer >>= FLAG_LAYER;
|
||||
|
||||
sf.metapos = 0;
|
||||
deserialize_long_long_io(geoms, &sf.metapos, geompos_in);
|
||||
@@ -407,22 +426,26 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
sf.bbox[1] = LLONG_MAX;
|
||||
sf.bbox[2] = LLONG_MIN;
|
||||
sf.bbox[3] = LLONG_MIN;
|
||||
scale_geometry(sst, sf.bbox, sf.geometry);
|
||||
|
||||
// try to remind myself that the geometry in this function is in SCALED COORDINATES
|
||||
drawvec scaled_geometry = sf.geometry;
|
||||
sf.geometry.clear();
|
||||
scale_geometry(sst, sf.bbox, scaled_geometry);
|
||||
|
||||
// This has to happen after scaling so that the wraparound detection has happened first.
|
||||
// Otherwise the inner/outer calculation will be confused by bad geometries.
|
||||
if (sf.t == VT_POLYGON) {
|
||||
sf.geometry = fix_polygon(sf.geometry);
|
||||
scaled_geometry = fix_polygon(scaled_geometry);
|
||||
}
|
||||
|
||||
for (auto &c : clipbboxes) {
|
||||
if (sf.t == VT_POLYGON) {
|
||||
sf.geometry = simple_clip_poly(sf.geometry, SHIFT_RIGHT(c.minx), SHIFT_RIGHT(c.miny), SHIFT_RIGHT(c.maxx), SHIFT_RIGHT(c.maxy));
|
||||
scaled_geometry = simple_clip_poly(scaled_geometry, SHIFT_RIGHT(c.minx), SHIFT_RIGHT(c.miny), SHIFT_RIGHT(c.maxx), SHIFT_RIGHT(c.maxy));
|
||||
} else if (sf.t == VT_LINE) {
|
||||
sf.geometry = clip_lines(sf.geometry, SHIFT_RIGHT(c.minx), SHIFT_RIGHT(c.miny), SHIFT_RIGHT(c.maxx), SHIFT_RIGHT(c.maxy));
|
||||
sf.geometry = remove_noop(sf.geometry, sf.t, 0);
|
||||
scaled_geometry = clip_lines(scaled_geometry, SHIFT_RIGHT(c.minx), SHIFT_RIGHT(c.miny), SHIFT_RIGHT(c.maxx), SHIFT_RIGHT(c.maxy));
|
||||
scaled_geometry = remove_noop(scaled_geometry, sf.t, 0);
|
||||
} else if (sf.t == VT_POINT) {
|
||||
sf.geometry = clip_point(sf.geometry, SHIFT_RIGHT(c.minx), SHIFT_RIGHT(c.miny), SHIFT_RIGHT(c.maxx), SHIFT_RIGHT(c.maxy));
|
||||
scaled_geometry = clip_point(scaled_geometry, SHIFT_RIGHT(c.minx), SHIFT_RIGHT(c.miny), SHIFT_RIGHT(c.maxx), SHIFT_RIGHT(c.maxy));
|
||||
}
|
||||
|
||||
sf.bbox[0] = LLONG_MAX;
|
||||
@@ -430,7 +453,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
sf.bbox[2] = LLONG_MIN;
|
||||
sf.bbox[3] = LLONG_MIN;
|
||||
|
||||
for (auto &g : sf.geometry) {
|
||||
for (auto &g : scaled_geometry) {
|
||||
long long x = SHIFT_LEFT(g.x);
|
||||
long long y = SHIFT_LEFT(g.y);
|
||||
|
||||
@@ -449,7 +472,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
}
|
||||
}
|
||||
|
||||
if (sf.geometry.size() == 0) {
|
||||
if (scaled_geometry.size() == 0) {
|
||||
// Feature was clipped away
|
||||
return 1;
|
||||
}
|
||||
@@ -463,9 +486,9 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
|
||||
if (sst->want_dist) {
|
||||
std::vector<unsigned long long> locs;
|
||||
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
||||
if (sf.geometry[i].op == VT_MOVETO || sf.geometry[i].op == VT_LINETO) {
|
||||
locs.push_back(encode_index(SHIFT_LEFT(sf.geometry[i].x), SHIFT_LEFT(sf.geometry[i].y)));
|
||||
for (size_t i = 0; i < scaled_geometry.size(); i++) {
|
||||
if (scaled_geometry[i].op == VT_MOVETO || scaled_geometry[i].op == VT_LINETO) {
|
||||
locs.push_back(encode_index(SHIFT_LEFT(scaled_geometry[i].x), SHIFT_LEFT(scaled_geometry[i].y)));
|
||||
}
|
||||
}
|
||||
std::sort(locs.begin(), locs.end());
|
||||
@@ -491,7 +514,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
|
||||
bool inline_meta = true;
|
||||
// Don't inline metadata for features that will span several tiles at maxzoom
|
||||
if (sf.geometry.size() > 0 && (sf.bbox[2] < sf.bbox[0] || sf.bbox[3] < sf.bbox[1])) {
|
||||
if (scaled_geometry.size() > 0 && (sf.bbox[2] < sf.bbox[0] || sf.bbox[3] < sf.bbox[1])) {
|
||||
fprintf(stderr, "Internal error: impossible feature bounding box %llx,%llx,%llx,%llx\n", sf.bbox[0], sf.bbox[1], sf.bbox[2], sf.bbox[3]);
|
||||
}
|
||||
if (sf.bbox[0] == LLONG_MAX) {
|
||||
@@ -509,34 +532,34 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
|
||||
if (extent > 10000) {
|
||||
fprintf(stderr, "Exiting because this can't be right.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double extent = 0;
|
||||
if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||
if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED] || order_by_size || sst->want_dist) {
|
||||
if (sf.t == VT_POLYGON) {
|
||||
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
||||
if (sf.geometry[i].op == VT_MOVETO) {
|
||||
for (size_t i = 0; i < scaled_geometry.size(); i++) {
|
||||
if (scaled_geometry[i].op == VT_MOVETO) {
|
||||
size_t j;
|
||||
for (j = i + 1; j < sf.geometry.size(); j++) {
|
||||
if (sf.geometry[j].op != VT_LINETO) {
|
||||
for (j = i + 1; j < scaled_geometry.size(); j++) {
|
||||
if (scaled_geometry[j].op != VT_LINETO) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extent += get_area(sf.geometry, i, j);
|
||||
extent += SHIFT_LEFT(SHIFT_LEFT(1LL)) * get_area(scaled_geometry, i, j);
|
||||
i = j - 1;
|
||||
}
|
||||
}
|
||||
} else if (sf.t == VT_LINE) {
|
||||
double dist = 0;
|
||||
for (size_t i = 1; i < sf.geometry.size(); i++) {
|
||||
if (sf.geometry[i].op == VT_LINETO) {
|
||||
double xd = sf.geometry[i].x - sf.geometry[i - 1].x;
|
||||
double yd = sf.geometry[i].y - sf.geometry[i - 1].y;
|
||||
for (size_t i = 1; i < scaled_geometry.size(); i++) {
|
||||
if (scaled_geometry[i].op == VT_LINETO) {
|
||||
double xd = SHIFT_LEFT(scaled_geometry[i].x - scaled_geometry[i - 1].x);
|
||||
double yd = SHIFT_LEFT(scaled_geometry[i].y - scaled_geometry[i - 1].y);
|
||||
dist += sqrt(xd * xd + yd * yd);
|
||||
}
|
||||
}
|
||||
@@ -553,6 +576,10 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
sf.extent = LLONG_MAX;
|
||||
}
|
||||
|
||||
if (sst->want_dist && sf.t == VT_POLYGON) {
|
||||
*(sst->area_sum) += extent;
|
||||
}
|
||||
|
||||
if (!prevent[P_INPUT_ORDER]) {
|
||||
sf.seq = 0;
|
||||
}
|
||||
@@ -576,19 +603,28 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
// jitter between them, even though the geometries themselves are
|
||||
// not very detailed.
|
||||
size_t ix = 0;
|
||||
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
||||
ix += sf.geometry[i].x + sf.geometry[i].y;
|
||||
for (size_t i = 0; i < scaled_geometry.size(); i++) {
|
||||
ix += scaled_geometry[i].x + scaled_geometry[i].y;
|
||||
}
|
||||
ix = ix % sf.geometry.size();
|
||||
ix = ix % scaled_geometry.size();
|
||||
|
||||
// If off the edge of the plane, mask to bring it back into the addressable area
|
||||
midx = sf.geometry[ix].x & ((1LL << 32) - 1);
|
||||
midy = sf.geometry[ix].y & ((1LL << 32) - 1);
|
||||
midx = SHIFT_LEFT(scaled_geometry[ix].x) & ((1LL << 32) - 1);
|
||||
midy = SHIFT_LEFT(scaled_geometry[ix].y) & ((1LL << 32) - 1);
|
||||
}
|
||||
|
||||
bbox_index = encode_index(midx, midy);
|
||||
|
||||
if (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED] || additional[A_CALCULATE_FEATURE_DENSITY] || additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED] || additional[A_INCREASE_GAMMA_AS_NEEDED] || sst->uses_gamma || cluster_distance != 0) {
|
||||
if (sf.t == VT_POLYGON && additional[A_GENERATE_POLYGON_LABEL_POINTS]) {
|
||||
drawvec dv = polygon_to_anchor(scaled_geometry);
|
||||
if (dv.size() > 0) {
|
||||
dv[0].x = SHIFT_LEFT(dv[0].x) & ((1LL << 32) - 1);
|
||||
dv[0].y = SHIFT_LEFT(dv[0].y) & ((1LL << 32) - 1);
|
||||
sf.label_point = encode_index(dv[0].x, dv[0].y);
|
||||
}
|
||||
}
|
||||
|
||||
if (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED] || additional[A_CALCULATE_FEATURE_DENSITY] || additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED] || additional[A_INCREASE_GAMMA_AS_NEEDED] || additional[A_GENERATE_POLYGON_LABEL_POINTS] || sst->uses_gamma || cluster_distance != 0) {
|
||||
sf.index = bbox_index;
|
||||
} else {
|
||||
sf.index = 0;
|
||||
@@ -613,7 +649,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Internal error: can't find layer name %s\n", sf.layername.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
for (ssize_t i = (ssize_t) sf.full_keys.size() - 1; i >= 0; i--) {
|
||||
@@ -705,6 +741,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
}
|
||||
|
||||
long long geomstart = r->geompos;
|
||||
sf.geometry = scaled_geometry;
|
||||
serialize_feature(r->geomfile, &sf, &r->geompos, sst->fname, SHIFT_RIGHT(*(sst->initial_x)), SHIFT_RIGHT(*(sst->initial_y)), false);
|
||||
|
||||
struct index index;
|
||||
@@ -772,7 +809,7 @@ void coerce_value(std::string const &key, int &vt, std::string &val, std::map<st
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Can't happen: attribute type %d\n", a->second);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ struct serial_feature {
|
||||
|
||||
drawvec geometry = drawvec();
|
||||
unsigned long long index = 0;
|
||||
unsigned long long label_point = 0;
|
||||
long long extent = 0;
|
||||
|
||||
std::vector<long long> keys{};
|
||||
@@ -149,6 +150,7 @@ struct serialization_state {
|
||||
|
||||
double *dist_sum = NULL; // running tally for calculation of resolution within features
|
||||
size_t *dist_count = NULL;
|
||||
double *area_sum = NULL;
|
||||
bool want_dist = false;
|
||||
|
||||
int maxzoom = 0;
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -4,7 +4,7 @@
|
||||
"description": "tests/attribute-type/out/-z0_-Tinttype@int_-Tfloattype@float_-Tbooltype@bool_-Tstringtype@string.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/attribute-type/out/-z0_-Tinttype@int_-Tfloattype@float_-Tbooltype@bool_-Tstringtype@string.json.check.mbtiles -z0 -Tinttype:int -Tfloattype:float -Tbooltype:bool -Tstringtype:string tests/attribute-type/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"booltype\": \"Boolean\", \"expect\": \"Mixed\", \"floattype\": \"Number\", \"inttype\": \"Number\", \"stringtype\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 39,\"geometry\": \"Point\",\"attributeCount\": 5,\"attributes\": [{\"attribute\": \"booltype\",\"count\": 2,\"type\": \"boolean\",\"values\": [false,true]},{\"attribute\": \"expect\",\"count\": 14,\"type\": \"mixed\",\"values\": [0,\"2\",\"2.5\",3,5,5.6,6,\"[2,3]\",\"false\",false,\"null\",\"something\",\"true\",true],\"min\": 0,\"max\": 6},{\"attribute\": \"floattype\",\"count\": 4,\"type\": \"number\",\"values\": [0,3,5,5.6],\"min\": 0,\"max\": 5.6},{\"attribute\": \"inttype\",\"count\": 5,\"type\": \"number\",\"values\": [0,0.000000,3.000000,5,6.000000],\"min\": 0,\"max\": 6},{\"attribute\": \"stringtype\",\"count\": 7,\"type\": \"string\",\"values\": [\"2\",\"2.5\",\"[2,3]\",\"false\",\"null\",\"something\",\"true\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"booltype\":\"Boolean\",\"expect\":\"Mixed\",\"floattype\":\"Number\",\"inttype\":\"Number\",\"stringtype\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":39,\"geometry\":\"Point\",\"attributeCount\":5,\"attributes\":[{\"attribute\":\"booltype\",\"count\":2,\"type\":\"boolean\",\"values\":[false,true]},{\"attribute\":\"expect\",\"count\":14,\"type\":\"mixed\",\"values\":[0,\"2\",\"2.5\",3,5,5.6,6,\"[2,3]\",\"false\",false,\"null\",\"something\",\"true\",true],\"min\":0,\"max\":6},{\"attribute\":\"floattype\",\"count\":4,\"type\":\"number\",\"values\":[0,3,5,5.6],\"min\":0,\"max\":5.6},{\"attribute\":\"inttype\",\"count\":5,\"type\":\"number\",\"values\":[0,0.000000,3.000000,5,6.000000],\"min\":0,\"max\":6},{\"attribute\":\"stringtype\",\"count\":7,\"type\":\"string\",\"values\":[\"2\",\"2.5\",\"[2,3]\",\"false\",\"null\",\"something\",\"true\"]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/attribute-type/out/-z0_-Tinttype@int_-Tfloattype@float_-Tbooltype@bool_-Tstringtype@string.json.check.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/attribute-type/out/-z0_-pN.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/attribute-type/out/-z0_-pN.json.check.mbtiles -z0 -pN tests/attribute-type/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"booltype\": \"Mixed\", \"expect\": \"Mixed\", \"floattype\": \"Mixed\", \"inttype\": \"Mixed\", \"stringtype\": \"Mixed\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 39,\"geometry\": \"Point\",\"attributeCount\": 5,\"attributes\": [{\"attribute\": \"booltype\",\"count\": 10,\"type\": \"mixed\",\"values\": [\"\",\"0\",0,1,\"[2,3]\",\"false\",false,\"null\",true,\"yes\"],\"min\": 0,\"max\": 1},{\"attribute\": \"expect\",\"count\": 14,\"type\": \"mixed\",\"values\": [0,\"2\",\"2.5\",3,5,5.599999904632568,6,\"[2,3]\",\"false\",false,\"null\",\"something\",\"true\",true],\"min\": 0,\"max\": 6},{\"attribute\": \"floattype\",\"count\": 9,\"type\": \"mixed\",\"values\": [\"\",\" 3\",\"5\",5.599999904632568,\"5.6\",\"[2,3]\",false,true,\"yes\"],\"min\": 5.599999904632568,\"max\": 5.599999904632568},{\"attribute\": \"inttype\",\"count\": 9,\"type\": \"mixed\",\"values\": [\"\",\" 3\",\"5\",5.599999904632568,\"5.6\",\"[2,3]\",false,true,\"yes\"],\"min\": 5.599999904632568,\"max\": 5.599999904632568},{\"attribute\": \"stringtype\",\"count\": 6,\"type\": \"mixed\",\"values\": [2,2.5,\"[2,3]\",false,\"something\",true],\"min\": 2,\"max\": 2.5}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"booltype\":\"Mixed\",\"expect\":\"Mixed\",\"floattype\":\"Mixed\",\"inttype\":\"Mixed\",\"stringtype\":\"Mixed\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":39,\"geometry\":\"Point\",\"attributeCount\":5,\"attributes\":[{\"attribute\":\"booltype\",\"count\":10,\"type\":\"mixed\",\"values\":[\"\",\"0\",0,1,\"[2,3]\",\"false\",false,\"null\",true,\"yes\"],\"min\":0,\"max\":1},{\"attribute\":\"expect\",\"count\":14,\"type\":\"mixed\",\"values\":[0,\"2\",\"2.5\",3,5,5.599999904632568,6,\"[2,3]\",\"false\",false,\"null\",\"something\",\"true\",true],\"min\":0,\"max\":6},{\"attribute\":\"floattype\",\"count\":9,\"type\":\"mixed\",\"values\":[\"\",\" 3\",\"5\",5.599999904632568,\"5.6\",\"[2,3]\",false,true,\"yes\"],\"min\":5.599999904632568,\"max\":5.599999904632568},{\"attribute\":\"inttype\",\"count\":9,\"type\":\"mixed\",\"values\":[\"\",\" 3\",\"5\",5.599999904632568,\"5.6\",\"[2,3]\",false,true,\"yes\"],\"min\":5.599999904632568,\"max\":5.599999904632568},{\"attribute\":\"stringtype\",\"count\":6,\"type\":\"mixed\",\"values\":[2,2.5,\"[2,3]\",false,\"something\",true],\"min\":2,\"max\":2.5}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/attribute-type/out/-z0_-pN.json.check.mbtiles",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,11 +4,11 @@
|
||||
"description": "tests/coalesce-id/out/-z1_--coalesce_--reorder.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/coalesce-id/out/-z1_--coalesce_--reorder.json.check.mbtiles -z1 --coalesce --reorder tests/coalesce-id/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 1, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 177,\"geometry\": \"Polygon\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":1,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":177,\"geometry\":\"Polygon\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "1",
|
||||
"minzoom": "0",
|
||||
"name": "tests/coalesce-id/out/-z1_--coalesce_--reorder.json.check.mbtiles",
|
||||
"strategies": "[ { }, { \"tiny_polygons\": 2 } ]",
|
||||
"strategies": "[{},{\"tiny_polygons\":2}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@
|
||||
"description": "tests/coalesce-tract/out/-P_--coalesce_--reorder_-z11_-Z11_-y_STATEFP10_-y_COUNTYFP10_-l_merged.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/coalesce-tract/out/-P_--coalesce_--reorder_-z11_-Z11_-y_STATEFP10_-y_COUNTYFP10_-l_merged.json.check.mbtiles -P --coalesce --reorder -z11 -Z11 -y STATEFP10 -y COUNTYFP10 -l merged tests/coalesce-tract/tl_2010_06001_tract10.json tests/coalesce-tract/tl_2010_06075_tract10.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"merged\", \"description\": \"\", \"minzoom\": 11, \"maxzoom\": 11, \"fields\": {\"COUNTYFP10\": \"String\", \"STATEFP10\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"merged\",\"count\": 558,\"geometry\": \"Polygon\",\"attributeCount\": 2,\"attributes\": [{\"attribute\": \"COUNTYFP10\",\"count\": 2,\"type\": \"string\",\"values\": [\"001\",\"075\"]},{\"attribute\": \"STATEFP10\",\"count\": 1,\"type\": \"string\",\"values\": [\"06\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"merged\",\"description\":\"\",\"minzoom\":11,\"maxzoom\":11,\"fields\":{\"COUNTYFP10\":\"String\",\"STATEFP10\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"merged\",\"count\":558,\"geometry\":\"Polygon\",\"attributeCount\":2,\"attributes\":[{\"attribute\":\"COUNTYFP10\",\"count\":2,\"type\":\"string\",\"values\":[\"001\",\"075\"]},{\"attribute\":\"STATEFP10\",\"count\":1,\"type\":\"string\",\"values\":[\"06\"]}]}]}}",
|
||||
"maxzoom": "11",
|
||||
"minzoom": "11",
|
||||
"name": "tests/coalesce-tract/out/-P_--coalesce_--reorder_-z11_-Z11_-y_STATEFP10_-y_COUNTYFP10_-l_merged.json.check.mbtiles",
|
||||
"strategies": "[ { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { \"tiny_polygons\": 6 } ]",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"tiny_polygons\":6}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,11 +4,11 @@
|
||||
"description": "tests/curve/out/-z2.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/curve/out/-z2.json.check.mbtiles -z2 tests/curve/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 2, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 2,\"geometry\": \"Polygon\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":2,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":2,\"geometry\":\"Polygon\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "2",
|
||||
"minzoom": "0",
|
||||
"name": "tests/curve/out/-z2.json.check.mbtiles",
|
||||
"strategies": "[ { }, { \"tiny_polygons\": 1 }, { \"tiny_polygons\": 4 } ]",
|
||||
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":4}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/curve/out/-z2_--no-clipping.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/curve/out/-z2_--no-clipping.json.check.mbtiles -z2 --no-clipping tests/curve/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 2, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 2,\"geometry\": \"Polygon\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":2,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":2,\"geometry\":\"Polygon\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "2",
|
||||
"minzoom": "0",
|
||||
"name": "tests/curve/out/-z2_--no-clipping.json.check.mbtiles",
|
||||
"strategies": "[ { }, { \"tiny_polygons\": 1 }, { \"tiny_polygons\": 10 } ]",
|
||||
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":10}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/curve/out/-z2_--no-duplication.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/curve/out/-z2_--no-duplication.json.check.mbtiles -z2 --no-duplication tests/curve/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 2, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 2,\"geometry\": \"Polygon\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":2,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":2,\"geometry\":\"Polygon\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "2",
|
||||
"minzoom": "0",
|
||||
"name": "tests/curve/out/-z2_--no-duplication.json.check.mbtiles",
|
||||
"strategies": "[ { }, { \"tiny_polygons\": 6 }, { \"tiny_polygons\": 6 } ]",
|
||||
"strategies": "[{},{\"tiny_polygons\":6},{\"tiny_polygons\":6}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+36
-36
@@ -4,11 +4,11 @@
|
||||
"description": "tests/dateline/out/-z5.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/dateline/out/-z5.json.check.mbtiles -z5 tests/dateline/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 5, \"fields\": {\"\": \"String\", \"boolean\": \"Boolean\", \"escape\": \"String\", \"otherboolean\": \"Boolean\", \"prêt\": \"String\", \"stringify\": \"String\", \"where\": \"String\", \"zoom\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 11,\"geometry\": \"LineString\",\"attributeCount\": 8,\"attributes\": [{\"attribute\": \"\",\"count\": 1,\"type\": \"string\",\"values\": [\"something for nothing\"]},{\"attribute\": \"boolean\",\"count\": 1,\"type\": \"boolean\",\"values\": [true]},{\"attribute\": \"escape\",\"count\": 1,\"type\": \"string\",\"values\": [\"foo\\u0001bar,ü\\\"\\\\/\\u0008\\u000c\\u000a\\u000d\\u0009→🐂🐳\"]},{\"attribute\": \"otherboolean\",\"count\": 1,\"type\": \"boolean\",\"values\": [false]},{\"attribute\": \"prêt\",\"count\": 1,\"type\": \"string\",\"values\": [\"ready\"]},{\"attribute\": \"stringify\",\"count\": 1,\"type\": \"string\",\"values\": [\"[\\\"yes\\\",27,27,1.4e+27,{\\\"foo\\\":\\\"bar\\\"}]\"]},{\"attribute\": \"where\",\"count\": 6,\"type\": \"string\",\"values\": [\"-172, not duplicated\",\"-173, duplicated\",\"-180\",\"172, not duplicated\",\"173, duplicated\",\"180\"]},{\"attribute\": \"zoom\",\"count\": 4,\"type\": \"string\",\"values\": [\"0-5, since 10 > 5\",\"3-5\",\"nothing, since 10 > 5\",\"z0-2\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":5,\"fields\":{\"\":\"String\",\"boolean\":\"Boolean\",\"escape\":\"String\",\"otherboolean\":\"Boolean\",\"prêt\":\"String\",\"stringify\":\"String\",\"where\":\"String\",\"zoom\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":11,\"geometry\":\"LineString\",\"attributeCount\":8,\"attributes\":[{\"attribute\":\"\",\"count\":1,\"type\":\"string\",\"values\":[\"something for nothing\"]},{\"attribute\":\"boolean\",\"count\":1,\"type\":\"boolean\",\"values\":[true]},{\"attribute\":\"escape\",\"count\":1,\"type\":\"string\",\"values\":[\"foo\\u0001bar,ü\\\"\\\\/\\u0008\\u000c\\u000a\\u000d\\u0009→🐂🐳\"]},{\"attribute\":\"otherboolean\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"prêt\",\"count\":1,\"type\":\"string\",\"values\":[\"ready\"]},{\"attribute\":\"stringify\",\"count\":1,\"type\":\"string\",\"values\":[\"[\\\"yes\\\",27,27,1.4e+27,{\\\"foo\\\":\\\"bar\\\"}]\"]},{\"attribute\":\"where\",\"count\":6,\"type\":\"string\",\"values\":[\"-172, not duplicated\",\"-173, duplicated\",\"-180\",\"172, not duplicated\",\"173, duplicated\",\"180\"]},{\"attribute\":\"zoom\",\"count\":4,\"type\":\"string\",\"values\":[\"0-5, since 10 > 5\",\"3-5\",\"nothing, since 10 > 5\",\"z0-2\"]}]}]}}",
|
||||
"maxzoom": "5",
|
||||
"minzoom": "0",
|
||||
"name": "tests/dateline/out/-z5.json.check.mbtiles",
|
||||
"strategies": "[ { }, { }, { }, { \"tiny_polygons\": 1 }, { }, { \"tiny_polygons\": 1 } ]",
|
||||
"strategies": "[{},{},{},{\"tiny_polygons\":1},{},{\"tiny_polygons\":1}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
@@ -18,6 +18,8 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -187.031250, 56.992883 ], [ -187.031250, 65.730626 ], [ -182.460938, 67.339861 ], [ -180.000000, 67.542167 ], [ -169.101562, 68.269387 ], [ -156.093750, 68.138852 ], [ -144.492188, 66.089364 ], [ -134.648438, 62.431074 ], [ -131.835938, 55.379110 ], [ -133.593750, 48.690960 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.527295 ], [ -184.218750, 37.160317 ], [ -187.031250, 38.891033 ], [ -187.031250, 50.457504 ], [ -185.976562, 47.279229 ], [ -177.539062, 44.339565 ], [ -164.882812, 43.325178 ], [ -153.281250, 46.558860 ], [ -144.492188, 51.179343 ], [ -143.789062, 57.136239 ], [ -148.007812, 61.100789 ], [ -158.554688, 63.860036 ], [ -169.453125, 64.472794 ], [ -177.890625, 62.593341 ], [ -180.000000, 61.689872 ], [ -185.976562, 58.813742 ], [ -187.031250, 56.992883 ] ] ], [ [ [ 187.031250, 44.024422 ], [ 187.031250, 35.460670 ], [ 175.781250, 37.160317 ], [ 161.718750, 45.336702 ], [ 156.796875, 54.977614 ], [ 163.476562, 62.431074 ], [ 170.507812, 64.774125 ], [ 177.539062, 67.339861 ], [ 180.000000, 67.542167 ], [ 187.031250, 68.007571 ], [ 187.031250, 63.704722 ], [ 182.109375, 62.593341 ], [ 180.000000, 61.689872 ], [ 174.023438, 58.813742 ], [ 171.562500, 54.367759 ], [ 174.023438, 47.279229 ], [ 182.460938, 44.339565 ], [ 187.031250, 44.024422 ] ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 180.000000, 10.055403 ], [ 180.000000, 30.069094 ] ], [ [ -180.000000, 10.055403 ], [ -180.000000, 30.069094 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -173.056641, 10.055403 ], [ -173.056641, 30.069094 ] ], [ [ 186.943359, 10.055403 ], [ 186.943359, 30.069094 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.055403 ], [ -172.001953, 30.069094 ] ] } }
|
||||
@@ -29,8 +31,6 @@
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.914062, 10.055403 ], [ 171.914062, 30.069094 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 172.968750, 10.055403 ], [ 172.968750, 30.069094 ] ], [ [ -187.031250, 10.055403 ], [ -187.031250, 30.069094 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 180.000000, 10.055403 ], [ 180.000000, 30.069094 ] ], [ [ -180.000000, 10.055403 ], [ -180.000000, 30.069094 ] ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -46,6 +46,8 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -183.515625, 60.020952 ], [ -183.515625, 66.981666 ], [ -182.460938, 67.339861 ], [ -180.000000, 67.525373 ], [ -169.101562, 68.269387 ], [ -156.093750, 68.138852 ], [ -144.492188, 66.089364 ], [ -134.648438, 62.431074 ], [ -131.835938, 55.379110 ], [ -133.593750, 48.690960 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.527295 ], [ -183.515625, 37.055177 ], [ -183.515625, 46.437857 ], [ -177.539062, 44.339565 ], [ -164.882812, 43.325178 ], [ -153.281250, 46.558860 ], [ -144.492188, 51.179343 ], [ -143.789062, 57.136239 ], [ -148.007812, 61.100789 ], [ -158.554688, 63.860036 ], [ -169.453125, 64.472794 ], [ -177.890625, 62.593341 ], [ -180.000000, 61.669024 ], [ -183.515625, 60.020952 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.012695, 10.012130 ], [ -173.012695, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.012130 ], [ -172.001953, 30.031055 ] ] } }
|
||||
@@ -53,8 +55,6 @@
|
||||
{ "type": "Feature", "properties": { "zoom": "z0-2" }, "geometry": { "type": "LineString", "coordinates": [ [ -112.851562, 55.178868 ], [ -117.773438, 44.590467 ], [ -104.414062, 51.179343 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "zoom": "0-5, since 10 > 5" }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.966797, 1.010690 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.031055 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -70,13 +70,13 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 183.515625, 44.276671 ], [ 183.515625, 35.995785 ], [ 175.781250, 37.160317 ], [ 161.718750, 45.336702 ], [ 156.796875, 54.977614 ], [ 163.476562, 62.431074 ], [ 170.507812, 64.774125 ], [ 177.539062, 67.339861 ], [ 180.000000, 67.525373 ], [ 183.515625, 67.776025 ], [ 183.515625, 62.915233 ], [ 182.109375, 62.593341 ], [ 180.000000, 61.669024 ], [ 174.023438, 58.813742 ], [ 171.562500, 54.367759 ], [ 174.023438, 47.279229 ], [ 182.460938, 44.339565 ], [ 183.515625, 44.276671 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "zoom": "0-5, since 10 > 5" }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.966797, 1.010690 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.958008, 10.012130 ], [ 171.958008, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.968750, 10.012130 ], [ 172.968750, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.031055 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -86,13 +86,13 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -181.757812, 60.844911 ], [ -181.757812, 67.204032 ], [ -150.688477, 67.204032 ], [ -146.821289, 66.513260 ], [ -144.492188, 66.089364 ], [ -134.648438, 62.431074 ], [ -131.835938, 55.379110 ], [ -133.593750, 48.690960 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.527295 ], [ -181.757812, 36.791691 ], [ -181.757812, 45.828799 ], [ -177.539062, 44.339565 ], [ -164.882812, 43.325178 ], [ -153.281250, 46.558860 ], [ -144.492188, 51.179343 ], [ -143.789062, 57.136239 ], [ -148.007812, 61.100789 ], [ -158.554688, 63.860036 ], [ -169.453125, 64.472794 ], [ -177.890625, 62.593341 ], [ -180.000000, 61.658595 ], [ -181.757812, 60.844911 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.012695, 10.012130 ], [ -173.012695, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.012130 ], [ -172.001953, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "zoom": "z0-2" }, "geometry": { "type": "LineString", "coordinates": [ [ -112.851562, 55.178868 ], [ -117.773438, 44.590467 ], [ -104.414062, 51.179343 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.012031 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -132,11 +132,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 181.757812, 44.590467 ], [ 181.757812, 36.261992 ], [ 175.781250, 37.160317 ], [ 161.718750, 45.336702 ], [ 156.796875, 54.977614 ], [ 163.476562, 62.431074 ], [ 170.507812, 64.774125 ], [ 175.187988, 66.513260 ], [ 177.143555, 67.204032 ], [ 181.757812, 67.204032 ], [ 181.757812, 62.441242 ], [ 180.000000, 61.658595 ], [ 174.023438, 58.813742 ], [ 171.562500, 54.367759 ], [ 174.023438, 47.279229 ], [ 181.757812, 44.590467 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.979980, 10.012130 ], [ 171.979980, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.990723, 10.012130 ], [ 172.990723, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.012031 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -152,11 +152,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -142.613525, 41.640078 ], [ -143.404541, 40.979898 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.518466 ], [ -180.878906, 36.659606 ], [ -180.878906, 41.640078 ], [ -142.613525, 41.640078 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.001310 ], [ -173.001709, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.001310 ], [ -172.001953, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -222,11 +222,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 180.878906, 41.640078 ], [ 180.878906, 36.385913 ], [ 180.000000, 36.518466 ], [ 175.781250, 37.160317 ], [ 169.420166, 40.979898 ], [ 168.288574, 41.640078 ], [ 180.878906, 41.640078 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.990967, 10.001310 ], [ 171.990967, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.990723, 10.001310 ], [ 172.990723, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -248,11 +248,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 20.004322 ], [ -180.000000, 21.943046 ], [ -180.000000, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 21.943046 ], [ -180.000000, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.001310 ], [ -173.001709, 21.943046 ], [ -173.001709, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.001310 ], [ -172.001953, 21.943046 ], [ -172.001953, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 21.943046 ], [ -180.000000, 22.350076 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -262,11 +262,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -157.060547, 41.310824 ], [ -157.060547, 36.866438 ], [ -157.500000, 36.796090 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.518466 ], [ -180.439453, 36.589068 ], [ -180.439453, 41.310824 ], [ -157.060547, 41.310824 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.534847 ], [ -180.000000, 21.943046 ], [ -180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 21.534847 ], [ -173.001709, 21.943046 ], [ -173.001709, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 21.534847 ], [ -172.001953, 21.943046 ], [ -172.001953, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.534847 ], [ -180.000000, 21.943046 ], [ -180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -378,11 +378,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 20.004322 ], [ 180.000000, 21.943046 ], [ 180.000000, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 21.943046 ], [ 180.000000, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.996460, 10.001310 ], [ 171.996460, 21.943046 ], [ 171.996460, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.996216, 10.001310 ], [ 172.996216, 21.943046 ], [ 172.996216, 22.350076 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 21.943046 ], [ 180.000000, 22.350076 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -392,11 +392,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 180.439453, 41.310824 ], [ 180.439453, 36.452218 ], [ 180.000000, 36.518466 ], [ 175.781250, 37.160317 ], [ 169.425659, 40.979898 ], [ 168.859863, 41.310824 ], [ 180.439453, 41.310824 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.534847 ], [ 180.000000, 21.943046 ], [ 180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.996460, 21.534847 ], [ 171.996460, 21.943046 ], [ 171.996460, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.996216, 21.534847 ], [ 172.996216, 21.943046 ], [ 172.996216, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.534847 ], [ 180.000000, 21.943046 ], [ 180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -422,11 +422,11 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 0, "y": 15 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 11.178402 ], [ -180.000000, 11.393879 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.001310 ], [ -173.001709, 11.178402 ], [ -173.001709, 11.393879 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.001310 ], [ -172.001953, 11.178402 ], [ -172.001953, 11.393879 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 11.178402 ], [ -180.000000, 11.393879 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -434,11 +434,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 20.001741 ], [ -180.000000, 21.943046 ], [ -180.000000, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.962764 ], [ -180.000000, 11.178402 ], [ -180.000000, 21.943046 ], [ -180.000000, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.962764 ], [ -173.001709, 11.178402 ], [ -173.001709, 21.943046 ], [ -173.001709, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.962764 ], [ -172.001953, 11.178402 ], [ -172.001953, 21.943046 ], [ -172.001953, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.962764 ], [ -180.000000, 11.178402 ], [ -180.000000, 21.943046 ], [ -180.000000, 22.146708 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -446,11 +446,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.739091 ], [ -180.000000, 21.943046 ], [ -180.000000, 31.952162 ], [ -180.000000, 32.138409 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.739091 ], [ -180.000000, 21.943046 ], [ -180.000000, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 21.739091 ], [ -173.001709, 21.943046 ], [ -173.001709, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 21.739091 ], [ -172.001953, 21.943046 ], [ -172.001953, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.739091 ], [ -180.000000, 21.943046 ], [ -180.000000, 30.000138 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -700,11 +700,11 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 31, "y": 15 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 11.178402 ], [ 180.000000, 11.393879 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.999207, 10.001310 ], [ 171.999207, 11.178402 ], [ 171.999207, 11.393879 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.998962, 10.001310 ], [ 172.998962, 11.178402 ], [ 172.998962, 11.393879 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 11.178402 ], [ 180.000000, 11.393879 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -712,11 +712,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 20.001741 ], [ 180.000000, 21.943046 ], [ 180.000000, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.962764 ], [ 180.000000, 11.178402 ], [ 180.000000, 21.943046 ], [ 180.000000, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.999207, 10.962764 ], [ 171.999207, 11.178402 ], [ 171.999207, 21.943046 ], [ 171.999207, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.998962, 10.962764 ], [ 172.998962, 11.178402 ], [ 172.998962, 21.943046 ], [ 172.998962, 22.146708 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.962764 ], [ 180.000000, 11.178402 ], [ 180.000000, 21.943046 ], [ 180.000000, 22.146708 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -724,11 +724,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.739091 ], [ 180.000000, 21.943046 ], [ 180.000000, 31.952162 ], [ 180.000000, 32.138409 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.739091 ], [ 180.000000, 21.943046 ], [ 180.000000, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.999207, 21.739091 ], [ 171.999207, 21.943046 ], [ 171.999207, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.998962, 21.739091 ], [ 172.998962, 21.943046 ], [ 172.998962, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.739091 ], [ 180.000000, 21.943046 ], [ 180.000000, 30.000138 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/dateline/out/-z5_-b0.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/dateline/out/-z5_-b0.json.check.mbtiles -z5 -b0 tests/dateline/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 5, \"fields\": {\"\": \"String\", \"boolean\": \"Boolean\", \"escape\": \"String\", \"otherboolean\": \"Boolean\", \"prêt\": \"String\", \"stringify\": \"String\", \"where\": \"String\", \"zoom\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 11,\"geometry\": \"LineString\",\"attributeCount\": 8,\"attributes\": [{\"attribute\": \"\",\"count\": 1,\"type\": \"string\",\"values\": [\"something for nothing\"]},{\"attribute\": \"boolean\",\"count\": 1,\"type\": \"boolean\",\"values\": [true]},{\"attribute\": \"escape\",\"count\": 1,\"type\": \"string\",\"values\": [\"foo\\u0001bar,ü\\\"\\\\/\\u0008\\u000c\\u000a\\u000d\\u0009→🐂🐳\"]},{\"attribute\": \"otherboolean\",\"count\": 1,\"type\": \"boolean\",\"values\": [false]},{\"attribute\": \"prêt\",\"count\": 1,\"type\": \"string\",\"values\": [\"ready\"]},{\"attribute\": \"stringify\",\"count\": 1,\"type\": \"string\",\"values\": [\"[\\\"yes\\\",27,27,1.4e+27,{\\\"foo\\\":\\\"bar\\\"}]\"]},{\"attribute\": \"where\",\"count\": 6,\"type\": \"string\",\"values\": [\"-172, not duplicated\",\"-173, duplicated\",\"-180\",\"172, not duplicated\",\"173, duplicated\",\"180\"]},{\"attribute\": \"zoom\",\"count\": 4,\"type\": \"string\",\"values\": [\"0-5, since 10 > 5\",\"3-5\",\"nothing, since 10 > 5\",\"z0-2\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":5,\"fields\":{\"\":\"String\",\"boolean\":\"Boolean\",\"escape\":\"String\",\"otherboolean\":\"Boolean\",\"prêt\":\"String\",\"stringify\":\"String\",\"where\":\"String\",\"zoom\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":11,\"geometry\":\"LineString\",\"attributeCount\":8,\"attributes\":[{\"attribute\":\"\",\"count\":1,\"type\":\"string\",\"values\":[\"something for nothing\"]},{\"attribute\":\"boolean\",\"count\":1,\"type\":\"boolean\",\"values\":[true]},{\"attribute\":\"escape\",\"count\":1,\"type\":\"string\",\"values\":[\"foo\\u0001bar,ü\\\"\\\\/\\u0008\\u000c\\u000a\\u000d\\u0009→🐂🐳\"]},{\"attribute\":\"otherboolean\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"prêt\",\"count\":1,\"type\":\"string\",\"values\":[\"ready\"]},{\"attribute\":\"stringify\",\"count\":1,\"type\":\"string\",\"values\":[\"[\\\"yes\\\",27,27,1.4e+27,{\\\"foo\\\":\\\"bar\\\"}]\"]},{\"attribute\":\"where\",\"count\":6,\"type\":\"string\",\"values\":[\"-172, not duplicated\",\"-173, duplicated\",\"-180\",\"172, not duplicated\",\"173, duplicated\",\"180\"]},{\"attribute\":\"zoom\",\"count\":4,\"type\":\"string\",\"values\":[\"0-5, since 10 > 5\",\"3-5\",\"nothing, since 10 > 5\",\"z0-2\"]}]}]}}",
|
||||
"maxzoom": "5",
|
||||
"minzoom": "0",
|
||||
"name": "tests/dateline/out/-z5_-b0.json.check.mbtiles",
|
||||
"strategies": "[ { }, { }, { }, { \"tiny_polygons\": 1 }, { }, { } ]",
|
||||
"strategies": "[{},{},{},{\"tiny_polygons\":1},{},{}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
@@ -18,6 +18,8 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -180.000000, 61.689872 ], [ -180.000000, 67.542167 ], [ -169.101562, 68.269387 ], [ -156.093750, 68.138852 ], [ -144.492188, 66.089364 ], [ -134.648438, 62.431074 ], [ -131.835938, 55.379110 ], [ -133.593750, 48.690960 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.527295 ], [ -180.000000, 45.213004 ], [ -177.539062, 44.339565 ], [ -164.882812, 43.325178 ], [ -153.281250, 46.558860 ], [ -144.492188, 51.179343 ], [ -143.789062, 57.136239 ], [ -148.007812, 61.100789 ], [ -158.554688, 63.860036 ], [ -169.453125, 64.472794 ], [ -177.890625, 62.593341 ], [ -180.000000, 61.689872 ] ] ], [ [ [ 180.000000, 45.213004 ], [ 180.000000, 36.527295 ], [ 175.781250, 37.160317 ], [ 161.718750, 45.336702 ], [ 156.796875, 54.977614 ], [ 163.476562, 62.431074 ], [ 170.507812, 64.774125 ], [ 177.539062, 67.339861 ], [ 180.000000, 67.542167 ], [ 180.000000, 61.689872 ], [ 174.023438, 58.813742 ], [ 171.562500, 54.367759 ], [ 174.023438, 47.279229 ], [ 180.000000, 45.213004 ] ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 180.000000, 10.055403 ], [ 180.000000, 30.069094 ] ], [ [ -180.000000, 10.055403 ], [ -180.000000, 30.069094 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.056641, 10.055403 ], [ -173.056641, 30.069094 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.055403 ], [ -172.001953, 30.069094 ] ] } }
|
||||
@@ -29,8 +31,6 @@
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.914062, 10.055403 ], [ 171.914062, 30.069094 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.968750, 10.055403 ], [ 172.968750, 30.069094 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 180.000000, 10.055403 ], [ 180.000000, 30.069094 ] ], [ [ -180.000000, 10.055403 ], [ -180.000000, 30.069094 ] ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -40,13 +40,13 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -180.000000, 61.669024 ], [ -180.000000, 67.525373 ], [ -169.101562, 68.269387 ], [ -156.093750, 68.138852 ], [ -144.492188, 66.089364 ], [ -134.648438, 62.431074 ], [ -131.835938, 55.379110 ], [ -133.593750, 48.690960 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.527295 ], [ -180.000000, 45.213004 ], [ -177.539062, 44.339565 ], [ -164.882812, 43.325178 ], [ -153.281250, 46.558860 ], [ -144.492188, 51.179343 ], [ -143.789062, 57.136239 ], [ -148.007812, 61.100789 ], [ -158.554688, 63.860036 ], [ -169.453125, 64.472794 ], [ -177.890625, 62.593341 ], [ -180.000000, 61.669024 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.012695, 10.012130 ], [ -173.012695, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.012130 ], [ -172.001953, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "zoom": "z0-2" }, "geometry": { "type": "LineString", "coordinates": [ [ -112.851562, 55.178868 ], [ -117.773438, 44.590467 ], [ -104.414062, 51.179343 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.031055 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -56,13 +56,13 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 180.000000, 45.213004 ], [ 180.000000, 36.527295 ], [ 175.781250, 37.160317 ], [ 161.718750, 45.336702 ], [ 156.796875, 54.977614 ], [ 163.476562, 62.431074 ], [ 170.507812, 64.774125 ], [ 177.539062, 67.339861 ], [ 180.000000, 67.525373 ], [ 180.000000, 61.669024 ], [ 174.023438, 58.813742 ], [ 171.562500, 54.367759 ], [ 174.023438, 47.279229 ], [ 180.000000, 45.213004 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "zoom": "0-5, since 10 > 5" }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.966797, 1.010690 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.958008, 10.012130 ], [ 171.958008, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.968750, 10.012130 ], [ 172.968750, 30.031055 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.031055 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -72,13 +72,13 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -180.000000, 61.658595 ], [ -180.000000, 66.513260 ], [ -146.821289, 66.513260 ], [ -144.492188, 66.089364 ], [ -134.648438, 62.431074 ], [ -131.835938, 55.379110 ], [ -133.593750, 48.690960 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.527295 ], [ -180.000000, 45.213004 ], [ -177.539062, 44.339565 ], [ -164.882812, 43.325178 ], [ -153.281250, 46.558860 ], [ -144.492188, 51.179343 ], [ -143.789062, 57.136239 ], [ -148.007812, 61.100789 ], [ -158.554688, 63.860036 ], [ -169.453125, 64.472794 ], [ -177.890625, 62.593341 ], [ -180.000000, 61.658595 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.012695, 10.012130 ], [ -173.012695, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.012130 ], [ -172.001953, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "zoom": "z0-2" }, "geometry": { "type": "LineString", "coordinates": [ [ -112.851562, 55.178868 ], [ -117.773438, 44.590467 ], [ -104.414062, 51.179343 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.012130 ], [ -180.000000, 30.012031 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -100,11 +100,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 180.000000, 45.213004 ], [ 180.000000, 36.527295 ], [ 175.781250, 37.160317 ], [ 161.718750, 45.336702 ], [ 156.796875, 54.977614 ], [ 163.476562, 62.431074 ], [ 170.507812, 64.774125 ], [ 175.187988, 66.513260 ], [ 180.000000, 66.513260 ], [ 180.000000, 61.658595 ], [ 174.023438, 58.813742 ], [ 171.562500, 54.367759 ], [ 174.023438, 47.279229 ], [ 180.000000, 45.213004 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.979980, 10.012130 ], [ 171.979980, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.990723, 10.012130 ], [ 172.990723, 30.012031 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.012130 ], [ 180.000000, 30.012031 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -120,11 +120,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -143.404541, 40.979898 ], [ -146.250000, 38.548165 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.518466 ], [ -180.000000, 40.979898 ], [ -143.404541, 40.979898 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.001310 ], [ -173.001709, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.001310 ], [ -172.001953, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -172,11 +172,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 180.000000, 40.979898 ], [ 180.000000, 36.518466 ], [ 175.781250, 37.160317 ], [ 169.420166, 40.979898 ], [ 180.000000, 40.979898 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.990967, 10.001310 ], [ 171.990967, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.990723, 10.001310 ], [ 172.990723, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -198,11 +198,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 20.004322 ], [ -180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.001310 ], [ -173.001709, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.001310 ], [ -172.001953, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 21.943046 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -212,11 +212,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -157.500000, 40.979898 ], [ -157.500000, 36.796090 ], [ -169.453125, 34.885931 ], [ -180.000000, 36.518466 ], [ -180.000000, 40.979898 ], [ -157.500000, 40.979898 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.943046 ], [ -180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 21.943046 ], [ -173.001709, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 21.943046 ], [ -172.001953, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.943046 ], [ -180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -310,11 +310,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 20.004322 ], [ 180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.996460, 10.001310 ], [ 171.996460, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.996216, 10.001310 ], [ 172.996216, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 21.943046 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -324,11 +324,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "boolean": true, "otherboolean": false, "stringify": "[\"yes\",27,27,1.4e+27,{\"foo\":\"bar\"}]", "": "something for nothing", "escape": "foo\u0001bar,ü\"\\/\u0008\u000c\u000a\u000d\u0009→🐂🐳", "prêt": "ready" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 180.000000, 40.979898 ], [ 180.000000, 36.518466 ], [ 175.781250, 37.160317 ], [ 169.425659, 40.979898 ], [ 180.000000, 40.979898 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.943046 ], [ 180.000000, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.996460, 21.943046 ], [ 171.996460, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.996216, 21.943046 ], [ 172.996216, 30.002517 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.943046 ], [ 180.000000, 30.002517 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -354,11 +354,11 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 0, "y": 15 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 11.178402 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 10.001310 ], [ -173.001709, 11.178402 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 10.001310 ], [ -172.001953, 11.178402 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 10.001310 ], [ -180.000000, 11.178402 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -366,11 +366,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 20.001741 ], [ -180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 11.178402 ], [ -180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 11.178402 ], [ -173.001709, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 11.178402 ], [ -172.001953, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 11.178402 ], [ -180.000000, 21.943046 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -378,11 +378,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.943046 ], [ -180.000000, 31.952162 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.943046 ], [ -180.000000, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -173.001709, 21.943046 ], [ -173.001709, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "-172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ -172.001953, 21.943046 ], [ -172.001953, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ -180.000000, 21.943046 ], [ -180.000000, 30.000138 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -602,11 +602,11 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 31, "y": 15 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 11.178402 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.999207, 10.001310 ], [ 171.999207, 11.178402 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.998962, 10.001310 ], [ 172.998962, 11.178402 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 10.001310 ], [ 180.000000, 11.178402 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -614,11 +614,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 20.001741 ], [ 180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 11.178402 ], [ 180.000000, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.999207, 11.178402 ], [ 171.999207, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.998962, 11.178402 ], [ 172.998962, 21.943046 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 11.178402 ], [ 180.000000, 21.943046 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -626,11 +626,11 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "where": "-180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.943046 ], [ 180.000000, 31.952162 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.943046 ], [ 180.000000, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "172, not duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 171.999207, 21.943046 ], [ 171.999207, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "173, duplicated" }, "geometry": { "type": "LineString", "coordinates": [ [ 172.998962, 21.943046 ], [ 172.998962, 30.000138 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "where": "180" }, "geometry": { "type": "LineString", "coordinates": [ [ 180.000000, 21.943046 ], [ 180.000000, 30.000138 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/empty-linestring/out/-ac.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/empty-linestring/out/-ac.json.check.mbtiles -ac tests/empty-linestring/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 14, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 5,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":14,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":5,\"geometry\":\"LineString\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "14",
|
||||
"minzoom": "0",
|
||||
"name": "tests/empty-linestring/out/-ac.json.check.mbtiles",
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/epsg-3857/out/-yNAME_-z5_-sEPSG@3857.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/epsg-3857/out/-yNAME_-z5_-sEPSG@3857.json.check.mbtiles -yNAME -z5 -sEPSG:3857 tests/epsg-3857/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 5, \"fields\": {\"NAME\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 243,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"NAME\",\"count\": 243,\"type\": \"string\",\"values\": [\"Abidjan\",\"Abu Dhabi\",\"Abuja\",\"Accra\",\"Addis Ababa\",\"Algiers\",\"Amman\",\"Amsterdam\",\"Andorra\",\"Ankara\",\"Antananarivo\",\"Apia\",\"Ashgabat\",\"Asmara\",\"Astana\",\"Asuncion\",\"Athens\",\"Atlanta\",\"Auckland\",\"Baghdad\",\"Baguio City\",\"Baku\",\"Bamako\",\"Bandar Seri Begawan\",\"Bangalore\",\"Bangkok\",\"Bangui\",\"Banjul\",\"Basseterre\",\"Beijing\",\"Beirut\",\"Belgrade\",\"Belmopan\",\"Berlin\",\"Bern\",\"Bir Lehlou\",\"Bishkek\",\"Bissau\",\"Bloemfontein\",\"Bogota\",\"Brasilia\",\"Bratislava\",\"Brazzaville\",\"Bridgetown\",\"Brussels\",\"Bucharest\",\"Budapest\",\"Buenos Aires\",\"Bujumbura\",\"Cairo\",\"Canberra\",\"Cape Town\",\"Caracas\",\"Casablanca\",\"Castries\",\"Chengdu\",\"Chicago\",\"Chisinau\",\"Colombo\",\"Conakry\",\"Cotonou\",\"Dakar\",\"Damascus\",\"Dar es Salaam\",\"Denver\",\"Dhaka\",\"Dili\",\"Djibouti\",\"Dodoma\",\"Doha\",\"Dubai\",\"Dublin\",\"Dushanbe\",\"Freetown\",\"Funafuti\",\"Gaborone\",\"Geneva\",\"Georgetown\",\"Guatemala\",\"Hanoi\",\"Harare\",\"Hargeysa\",\"Havana\",\"Helsinki\",\"Hong Kong\",\"Honiara\",\"Houston\",\"Islamabad\",\"Istanbul\",\"Jakarta\",\"Jerusalem\",\"Johannesburg\",\"Juba\",\"Kabul\",\"Kampala\",\"Kathmandu\",\"Khartoum\",\"Kiev\",\"Kigali\",\"Kingston\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":5,\"fields\":{\"NAME\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":243,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"NAME\",\"count\":243,\"type\":\"string\",\"values\":[\"Abidjan\",\"Abu Dhabi\",\"Abuja\",\"Accra\",\"Addis Ababa\",\"Algiers\",\"Amman\",\"Amsterdam\",\"Andorra\",\"Ankara\",\"Antananarivo\",\"Apia\",\"Ashgabat\",\"Asmara\",\"Astana\",\"Asuncion\",\"Athens\",\"Atlanta\",\"Auckland\",\"Baghdad\",\"Baguio City\",\"Baku\",\"Bamako\",\"Bandar Seri Begawan\",\"Bangalore\",\"Bangkok\",\"Bangui\",\"Banjul\",\"Basseterre\",\"Beijing\",\"Beirut\",\"Belgrade\",\"Belmopan\",\"Berlin\",\"Bern\",\"Bir Lehlou\",\"Bishkek\",\"Bissau\",\"Bloemfontein\",\"Bogota\",\"Brasilia\",\"Bratislava\",\"Brazzaville\",\"Bridgetown\",\"Brussels\",\"Bucharest\",\"Budapest\",\"Buenos Aires\",\"Bujumbura\",\"Cairo\",\"Canberra\",\"Cape Town\",\"Caracas\",\"Casablanca\",\"Castries\",\"Chengdu\",\"Chicago\",\"Chisinau\",\"Colombo\",\"Conakry\",\"Cotonou\",\"Dakar\",\"Damascus\",\"Dar es Salaam\",\"Denver\",\"Dhaka\",\"Dili\",\"Djibouti\",\"Dodoma\",\"Doha\",\"Dubai\",\"Dublin\",\"Dushanbe\",\"Freetown\",\"Funafuti\",\"Gaborone\",\"Geneva\",\"Georgetown\",\"Guatemala\",\"Hanoi\",\"Harare\",\"Hargeysa\",\"Havana\",\"Helsinki\",\"Hong Kong\",\"Honiara\",\"Houston\",\"Islamabad\",\"Istanbul\",\"Jakarta\",\"Jerusalem\",\"Johannesburg\",\"Juba\",\"Kabul\",\"Kampala\",\"Kathmandu\",\"Khartoum\",\"Kiev\",\"Kigali\",\"Kingston\"]}]}]}}",
|
||||
"maxzoom": "5",
|
||||
"minzoom": "0",
|
||||
"name": "tests/epsg-3857/out/-yNAME_-z5_-sEPSG@3857.json.check.mbtiles",
|
||||
"strategies": "[ { \"dropped_by_rate\": 240 }, { \"dropped_by_rate\": 262 }, { \"dropped_by_rate\": 239 }, { \"dropped_by_rate\": 208 }, { \"dropped_by_rate\": 121 }, { } ]",
|
||||
"strategies": "[{\"dropped_by_rate\":240},{\"dropped_by_rate\":262},{\"dropped_by_rate\":239},{\"dropped_by_rate\":208},{\"dropped_by_rate\":121},{}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
"description": "tests/geometry/out/-z3.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/geometry/out/-z3.json.check.mbtiles -z3 tests/geometry/bare.json tests/geometry/geometrycollection.json tests/geometry/multipoint.json tests/geometry/onebare.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"bare\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {} }, { \"id\": \"geometrycollection\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"collection\": \"Boolean\"} }, { \"id\": \"multipoint\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"point\": \"String\"} }, { \"id\": \"onebare\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 4,\"layers\": [{\"layer\": \"bare\",\"count\": 4,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []},{\"layer\": \"geometrycollection\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"collection\",\"count\": 1,\"type\": \"boolean\",\"values\": [true]}]},{\"layer\": \"multipoint\",\"count\": 1,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"point\",\"count\": 1,\"type\": \"string\",\"values\": [\"multi\"]}]},{\"layer\": \"onebare\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"bare\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":3,\"fields\":{}},{\"id\":\"geometrycollection\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":3,\"fields\":{\"collection\":\"Boolean\"}},{\"id\":\"multipoint\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":3,\"fields\":{\"point\":\"String\"}},{\"id\":\"onebare\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":3,\"fields\":{}}],\"tilestats\":{\"layerCount\":4,\"layers\":[{\"layer\":\"bare\",\"count\":4,\"geometry\":\"LineString\",\"attributeCount\":0,\"attributes\":[]},{\"layer\":\"geometrycollection\",\"count\":2,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"collection\",\"count\":1,\"type\":\"boolean\",\"values\":[true]}]},{\"layer\":\"multipoint\",\"count\":1,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"point\",\"count\":1,\"type\":\"string\",\"values\":[\"multi\"]}]},{\"layer\":\"onebare\",\"count\":1,\"geometry\":\"LineString\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/geometry/out/-z3.json.check.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/grid-aligned/out/-z11_-D7_--grid-low-zooms.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/grid-aligned/out/-z11_-D7_--grid-low-zooms.json.check.mbtiles -z11 -D7 --grid-low-zooms tests/grid-aligned/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 11, \"fields\": {\"x\": \"Number\", \"y\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1024,\"geometry\": \"Polygon\",\"attributeCount\": 2,\"attributes\": [{\"attribute\": \"x\",\"count\": 32,\"type\": \"number\",\"values\": [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],\"min\": 16,\"max\": 47},{\"attribute\": \"y\",\"count\": 32,\"type\": \"number\",\"values\": [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],\"min\": 16,\"max\": 47}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":11,\"fields\":{\"x\":\"Number\",\"y\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1024,\"geometry\":\"Polygon\",\"attributeCount\":2,\"attributes\":[{\"attribute\":\"x\",\"count\":32,\"type\":\"number\",\"values\":[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],\"min\":16,\"max\":47},{\"attribute\":\"y\",\"count\":32,\"type\":\"number\",\"values\":[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],\"min\":16,\"max\":47}]}]}}",
|
||||
"maxzoom": "11",
|
||||
"minzoom": "0",
|
||||
"name": "tests/grid-aligned/out/-z11_-D7_--grid-low-zooms.json.check.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/grid-unaligned/out/-z11_-D7_--grid-low-zooms.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/grid-unaligned/out/-z11_-D7_--grid-low-zooms.json.check.mbtiles -z11 -D7 --grid-low-zooms tests/grid-unaligned/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 11, \"fields\": {\"KPI\": \"Number\", \"Lat\": \"String\", \"Long\": \"String\", \"Tile\": \"Number\", \"fill\": \"String\", \"fill-opacity\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1024,\"geometry\": \"Polygon\",\"attributeCount\": 6,\"attributes\": [{\"attribute\": \"KPI\",\"count\": 651,\"type\": \"number\",\"values\": [0,1,101,102,107,11,110,111,112,113,114,118,119,120,121,122,123,124,125,126,128,129,13,131,132,134,136,138,139,14,140,141,143,145,146,147,148,149,15,150,152,153,155,156,157,158,16,160,163,165,166,168,17,170,172,174,176,177,178,179,180,181,182,186,187,189,19,191,193,194,196,197,198,199,2,200,201,203,204,205,206,208,209,21,210,211,212,213,216,217,219,220,221,223,224,225,226,227,228,229],\"min\": 0,\"max\": 999},{\"attribute\": \"Lat\",\"count\": 32,\"type\": \"string\",\"values\": [\"0.0000000\",\"0.0018000\",\"0.0036000\",\"0.0054000\",\"0.0072000\",\"0.0090000\",\"0.0108000\",\"0.0126000\",\"0.0144000\",\"0.0162000\",\"0.0180000\",\"0.0198000\",\"0.0216000\",\"0.0234000\",\"0.0252000\",\"0.0270000\",\"0.0288000\",\"0.0306000\",\"0.0324000\",\"0.0342000\",\"0.0360000\",\"0.0378000\",\"0.0396000\",\"0.0414000\",\"0.0432000\",\"0.0450000\",\"0.0468000\",\"0.0486000\",\"0.0504000\",\"0.0522000\",\"0.0540000\",\"0.0558000\"]},{\"attribute\": \"Long\",\"count\": 32,\"type\": \"string\",\"values\": [\"0.0000000\",\"0.0026300\",\"0.0052500\",\"0.0078800\",\"0.0105100\",\"0.0131400\",\"0.0157600\",\"0.0183900\",\"0.0210200\",\"0.0236400\",\"0.0262700\",\"0.0289000\",\"0.0315200\",\"0.0341500\",\"0.0367800\",\"0.0394100\",\"0.0420300\",\"0.0446600\",\"0.0472900\",\"0.0499100\",\"0.0525400\",\"0.0551700\",\"0.0577900\",\"0.0604200\",\"0.0630500\",\"0.0656800\",\"0.0683000\",\"0.0709300\",\"0.0735600\",\"0.0761800\",\"0.0788100\",\"0.0814400\"]},{\"attribute\": \"Tile\",\"count\": 100,\"type\": \"number\",\"values\": [0,1,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23,24,25,26,27,28,29,3,30,31,32,33,34,35,36,37,38,39,4,40,41,42,43,44,45,46,47,48,49,5,50,51,52,53,54,55,56,57,58,59,6,60,61,62,63,64,65,66,67,68,69,7,70,71,72,73,74,75,76,77,78,79,8,80,81,82,83,84,85,86,87,88,89,9,90,91,92,93,94,95,96,97,98,99],\"min\": 0,\"max\": 99},{\"attribute\": \"fill\",\"count\": 1,\"type\": \"string\",\"values\": [\"#000066\"]},{\"attribute\": \"fill-opacity\",\"count\": 1,\"type\": \"number\",\"values\": [0.5],\"min\": 0.5,\"max\": 0.5}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":11,\"fields\":{\"KPI\":\"Number\",\"Lat\":\"String\",\"Long\":\"String\",\"Tile\":\"Number\",\"fill\":\"String\",\"fill-opacity\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1024,\"geometry\":\"Polygon\",\"attributeCount\":6,\"attributes\":[{\"attribute\":\"KPI\",\"count\":651,\"type\":\"number\",\"values\":[0,1,101,102,107,11,110,111,112,113,114,118,119,120,121,122,123,124,125,126,128,129,13,131,132,134,136,138,139,14,140,141,143,145,146,147,148,149,15,150,152,153,155,156,157,158,16,160,163,165,166,168,17,170,172,174,176,177,178,179,180,181,182,186,187,189,19,191,193,194,196,197,198,199,2,200,201,203,204,205,206,208,209,21,210,211,212,213,216,217,219,220,221,223,224,225,226,227,228,229],\"min\":0,\"max\":999},{\"attribute\":\"Lat\",\"count\":32,\"type\":\"string\",\"values\":[\"0.0000000\",\"0.0018000\",\"0.0036000\",\"0.0054000\",\"0.0072000\",\"0.0090000\",\"0.0108000\",\"0.0126000\",\"0.0144000\",\"0.0162000\",\"0.0180000\",\"0.0198000\",\"0.0216000\",\"0.0234000\",\"0.0252000\",\"0.0270000\",\"0.0288000\",\"0.0306000\",\"0.0324000\",\"0.0342000\",\"0.0360000\",\"0.0378000\",\"0.0396000\",\"0.0414000\",\"0.0432000\",\"0.0450000\",\"0.0468000\",\"0.0486000\",\"0.0504000\",\"0.0522000\",\"0.0540000\",\"0.0558000\"]},{\"attribute\":\"Long\",\"count\":32,\"type\":\"string\",\"values\":[\"0.0000000\",\"0.0026300\",\"0.0052500\",\"0.0078800\",\"0.0105100\",\"0.0131400\",\"0.0157600\",\"0.0183900\",\"0.0210200\",\"0.0236400\",\"0.0262700\",\"0.0289000\",\"0.0315200\",\"0.0341500\",\"0.0367800\",\"0.0394100\",\"0.0420300\",\"0.0446600\",\"0.0472900\",\"0.0499100\",\"0.0525400\",\"0.0551700\",\"0.0577900\",\"0.0604200\",\"0.0630500\",\"0.0656800\",\"0.0683000\",\"0.0709300\",\"0.0735600\",\"0.0761800\",\"0.0788100\",\"0.0814400\"]},{\"attribute\":\"Tile\",\"count\":100,\"type\":\"number\",\"values\":[0,1,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23,24,25,26,27,28,29,3,30,31,32,33,34,35,36,37,38,39,4,40,41,42,43,44,45,46,47,48,49,5,50,51,52,53,54,55,56,57,58,59,6,60,61,62,63,64,65,66,67,68,69,7,70,71,72,73,74,75,76,77,78,79,8,80,81,82,83,84,85,86,87,88,89,9,90,91,92,93,94,95,96,97,98,99],\"min\":0,\"max\":99},{\"attribute\":\"fill\",\"count\":1,\"type\":\"string\",\"values\":[\"#000066\"]},{\"attribute\":\"fill-opacity\",\"count\":1,\"type\":\"number\",\"values\":[0.5],\"min\":0.5,\"max\":0.5}]}]}}",
|
||||
"maxzoom": "11",
|
||||
"minzoom": "0",
|
||||
"name": "tests/grid-unaligned/out/-z11_-D7_--grid-low-zooms.json.check.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/high-longitude/out/-z1.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/high-longitude/out/-z1.json.check.mbtiles -z1 tests/high-longitude/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 1, \"fields\": {\"hpa\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"hpa\",\"count\": 1,\"type\": \"number\",\"values\": [103200],\"min\": 103200,\"max\": 103200}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":1,\"fields\":{\"hpa\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1,\"geometry\":\"LineString\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"hpa\",\"count\":1,\"type\":\"number\",\"values\":[103200],\"min\":103200,\"max\":103200}]}]}}",
|
||||
"maxzoom": "1",
|
||||
"minzoom": "0",
|
||||
"name": "tests/high-longitude/out/-z1.json.check.mbtiles",
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/highzoom/out/-z30.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/highzoom/out/-z30.json.check.mbtiles -z30 tests/highzoom/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 24, \"fields\": {\"name\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"name\",\"count\": 2,\"type\": \"string\",\"values\": [\"London\",\"Santa Cruz\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":24,\"fields\":{\"name\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":2,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"name\",\"count\":2,\"type\":\"string\",\"values\":[\"London\",\"Santa Cruz\"]}]}]}}",
|
||||
"maxzoom": "24",
|
||||
"minzoom": "0",
|
||||
"name": "tests/highzoom/out/-z30.json.check.mbtiles",
|
||||
"strategies": "[ { \"dropped_by_rate\": 1 }, { \"dropped_by_rate\": 1 }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { } ]",
|
||||
"strategies": "[{\"dropped_by_rate\":1},{\"dropped_by_rate\":1},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/id/out/-Z11.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/id/out/-Z11.json.check.mbtiles -Z11 tests/id/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 11, \"maxzoom\": 14, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 8,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 3,\"type\": \"string\",\"values\": [\"Macarthur\",\"Macarthur Blvd\",\"Macarthur Fwy\"]},{\"attribute\": \"LINEARID\",\"count\": 8,\"type\": \"string\",\"values\": [\"1102406970092\",\"1102638069562\",\"1102954918511\",\"1103690483032\",\"1104469713187\",\"1104469713198\",\"1104486090991\",\"1105089465114\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1100\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":11,\"maxzoom\":14,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":8,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":3,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Blvd\",\"Macarthur Fwy\"]},{\"attribute\":\"LINEARID\",\"count\":8,\"type\":\"string\",\"values\":[\"1102406970092\",\"1102638069562\",\"1102954918511\",\"1103690483032\",\"1104469713187\",\"1104469713198\",\"1104486090991\",\"1105089465114\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "14",
|
||||
"minzoom": "11",
|
||||
"name": "tests/id/out/-Z11.json.check.mbtiles",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
"description": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -z0 -n abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -o tests/join-population/macarthur.mbtiles tests/join-population/macarthur.json; ./tippecanoe -q -f -z0 -n abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -o tests/join-population/macarthur.mbtiles tests/join-population/macarthur.json; ./tippecanoe -q -f -z0 -n abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -o tests/join-population/macarthur.mbtiles tests/join-population/macarthur.json; ./tippecanoe -q -f -z0 -n abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -o tests/join-population/macarthur.mbtiles tests/join-population/macarthur.json; ./tippecanoe -q -f -z0 -n abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -o tests/join-population/macarthur.mbtiles tests/join-population/macarthur.json; ./tippecanoe -q -f -z0 -n abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -o tests/join-population/macarthur.mbtiles tests/join-population/macarthur.json; ./tile-join -f -o tests/join-population/concat.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"macarthur\",\"count\": 24,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 3,\"type\": \"string\",\"values\": [\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\": \"LINEARID\",\"count\": 4,\"type\": \"string\",\"values\": [\"1102954918511\",\"1104474748623\",\"1104486090991\",\"1104486392881\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1100\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"macarthur\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"macarthur\",\"count\":24,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":3,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\":\"LINEARID\",\"count\":4,\"type\":\"string\",\"values\":[\"1102954918511\",\"1104474748623\",\"1104486090991\",\"1104486392881\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,10 +4,11 @@
|
||||
"description": "tests/join-population/tabblock_06001420.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join --quiet --force --no-tile-stats -o tests/join-population/joined-no-tile-stats.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"tabblock_06001420\", \"description\": \"population\", \"minzoom\": 3, \"maxzoom\": 12, \"fields\": {\"ALAND10\": \"Land area\", \"AWATER10\": \"Number\", \"BLOCKCE10\": \"String\", \"COUNTYFP10\": \"String\", \"FUNCSTAT10\": \"String\", \"INTPTLAT10\": \"String\", \"INTPTLON10\": \"String\", \"MTFCC10\": \"String\", \"NAME10\": \"String\", \"STATEFP10\": \"String\", \"TRACTCE10\": \"String\", \"UACE10\": \"String\", \"UATYP10\": \"String\", \"UR10\": \"String\", \"population\": \"Mixed\"} } ]}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"tabblock_06001420\",\"description\":\"population\",\"minzoom\":3,\"maxzoom\":12,\"fields\":{\"ALAND10\":\"Land area\",\"AWATER10\":\"Number\",\"BLOCKCE10\":\"String\",\"COUNTYFP10\":\"String\",\"FUNCSTAT10\":\"String\",\"INTPTLAT10\":\"String\",\"INTPTLON10\":\"String\",\"MTFCC10\":\"String\",\"NAME10\":\"String\",\"STATEFP10\":\"String\",\"TRACTCE10\":\"String\",\"UACE10\":\"String\",\"UATYP10\":\"String\",\"UR10\":\"String\",\"population\":\"Mixed\"}}]}",
|
||||
"maxzoom": "12",
|
||||
"minzoom": "0",
|
||||
"name": "tests/join-population/tabblock_06001420.mbtiles",
|
||||
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":152},{\"tiny_polygons\":76},{\"tiny_polygons\":46}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,10 +4,11 @@
|
||||
"description": "tests/join-population/tabblock_06001420.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join --quiet --force '--tile-stats-sample-values-limit=1' -o tests/join-population/joined-tile-stats-sample-values-limit.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"tabblock_06001420\", \"description\": \"population\", \"minzoom\": 3, \"maxzoom\": 12, \"fields\": {\"ALAND10\": \"Land area\", \"AWATER10\": \"Number\", \"BLOCKCE10\": \"String\", \"COUNTYFP10\": \"String\", \"FUNCSTAT10\": \"String\", \"INTPTLAT10\": \"String\", \"INTPTLON10\": \"String\", \"MTFCC10\": \"String\", \"NAME10\": \"String\", \"STATEFP10\": \"String\", \"TRACTCE10\": \"String\", \"UACE10\": \"String\", \"UATYP10\": \"String\", \"UR10\": \"String\", \"population\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"tabblock_06001420\",\"count\": 1484,\"geometry\": \"Polygon\",\"attributeCount\": 15,\"attributes\": [{\"attribute\": \"ALAND10\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 542505},{\"attribute\": \"AWATER10\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 1632801},{\"attribute\": \"BLOCKCE10\",\"count\": 1,\"type\": \"string\",\"values\": [\"1000\"]},{\"attribute\": \"COUNTYFP10\",\"count\": 1,\"type\": \"string\",\"values\": [\"001\"]},{\"attribute\": \"FUNCSTAT10\",\"count\": 1,\"type\": \"string\",\"values\": [\"S\"]},{\"attribute\": \"INTPTLAT10\",\"count\": 1,\"type\": \"string\",\"values\": [\"+37.882724\"]},{\"attribute\": \"INTPTLON10\",\"count\": 1,\"type\": \"string\",\"values\": [\"-122.282320\"]},{\"attribute\": \"MTFCC10\",\"count\": 1,\"type\": \"string\",\"values\": [\"G5040\"]},{\"attribute\": \"NAME10\",\"count\": 1,\"type\": \"string\",\"values\": [\"Block 1000\"]},{\"attribute\": \"STATEFP10\",\"count\": 1,\"type\": \"string\",\"values\": [\"06\"]},{\"attribute\": \"TRACTCE10\",\"count\": 1,\"type\": \"string\",\"values\": [\"420100\"]},{\"attribute\": \"UACE10\",\"count\": 1,\"type\": \"string\",\"values\": [\"78904\"]},{\"attribute\": \"UATYP10\",\"count\": 1,\"type\": \"string\",\"values\": [\"U\"]},{\"attribute\": \"UR10\",\"count\": 1,\"type\": \"string\",\"values\": [\"R\"]},{\"attribute\": \"population\",\"count\": 1,\"type\": \"string\",\"values\": [\"\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"tabblock_06001420\",\"description\":\"population\",\"minzoom\":3,\"maxzoom\":12,\"fields\":{\"ALAND10\":\"Land area\",\"AWATER10\":\"Number\",\"BLOCKCE10\":\"String\",\"COUNTYFP10\":\"String\",\"FUNCSTAT10\":\"String\",\"INTPTLAT10\":\"String\",\"INTPTLON10\":\"String\",\"MTFCC10\":\"String\",\"NAME10\":\"String\",\"STATEFP10\":\"String\",\"TRACTCE10\":\"String\",\"UACE10\":\"String\",\"UATYP10\":\"String\",\"UR10\":\"String\",\"population\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"tabblock_06001420\",\"count\":1484,\"geometry\":\"Polygon\",\"attributeCount\":15,\"attributes\":[{\"attribute\":\"ALAND10\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":542505},{\"attribute\":\"AWATER10\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":1632801},{\"attribute\":\"BLOCKCE10\",\"count\":1,\"type\":\"string\",\"values\":[\"1000\"]},{\"attribute\":\"COUNTYFP10\",\"count\":1,\"type\":\"string\",\"values\":[\"001\"]},{\"attribute\":\"FUNCSTAT10\",\"count\":1,\"type\":\"string\",\"values\":[\"S\"]},{\"attribute\":\"INTPTLAT10\",\"count\":1,\"type\":\"string\",\"values\":[\"+37.882724\"]},{\"attribute\":\"INTPTLON10\",\"count\":1,\"type\":\"string\",\"values\":[\"-122.282320\"]},{\"attribute\":\"MTFCC10\",\"count\":1,\"type\":\"string\",\"values\":[\"G5040\"]},{\"attribute\":\"NAME10\",\"count\":1,\"type\":\"string\",\"values\":[\"Block 1000\"]},{\"attribute\":\"STATEFP10\",\"count\":1,\"type\":\"string\",\"values\":[\"06\"]},{\"attribute\":\"TRACTCE10\",\"count\":1,\"type\":\"string\",\"values\":[\"420100\"]},{\"attribute\":\"UACE10\",\"count\":1,\"type\":\"string\",\"values\":[\"78904\"]},{\"attribute\":\"UATYP10\",\"count\":1,\"type\":\"string\",\"values\":[\"U\"]},{\"attribute\":\"UR10\",\"count\":1,\"type\":\"string\",\"values\":[\"R\"]},{\"attribute\":\"population\",\"count\":1,\"type\":\"string\",\"values\":[\"\"]}]}]}}",
|
||||
"maxzoom": "12",
|
||||
"minzoom": "0",
|
||||
"name": "tests/join-population/tabblock_06001420.mbtiles",
|
||||
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":152},{\"tiny_polygons\":76},{\"tiny_polygons\":46}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
"description": "tests/join-population/tabblock_06001420.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join --quiet --force '--tile-stats-values-limit=1' -o tests/join-population/joined-tile-stats-values-limit.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"tabblock_06001420\", \"description\": \"population\", \"minzoom\": 3, \"maxzoom\": 12, \"fields\": {\"ALAND10\": \"Land area\", \"AWATER10\": \"Number\", \"BLOCKCE10\": \"String\", \"COUNTYFP10\": \"String\", \"FUNCSTAT10\": \"String\", \"INTPTLAT10\": \"String\", \"INTPTLON10\": \"String\", \"MTFCC10\": \"String\", \"NAME10\": \"String\", \"STATEFP10\": \"String\", \"TRACTCE10\": \"String\", \"UACE10\": \"String\", \"UATYP10\": \"String\", \"UR10\": \"String\", \"population\": \"Mixed\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"tabblock_06001420\",\"count\": 1484,\"geometry\": \"Polygon\",\"attributeCount\": 15,\"attributes\": [{\"attribute\": \"ALAND10\",\"count\": 257,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 542505}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"tabblock_06001420\",\"description\":\"population\",\"minzoom\":3,\"maxzoom\":12,\"fields\":{\"ALAND10\":\"Land area\",\"AWATER10\":\"Number\",\"BLOCKCE10\":\"String\",\"COUNTYFP10\":\"String\",\"FUNCSTAT10\":\"String\",\"INTPTLAT10\":\"String\",\"INTPTLON10\":\"String\",\"MTFCC10\":\"String\",\"NAME10\":\"String\",\"STATEFP10\":\"String\",\"TRACTCE10\":\"String\",\"UACE10\":\"String\",\"UATYP10\":\"String\",\"UR10\":\"String\",\"population\":\"Mixed\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"tabblock_06001420\",\"count\":1484,\"geometry\":\"Polygon\",\"attributeCount\":15,\"attributes\":[{\"attribute\":\"ALAND10\",\"count\":257,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":542505}]}]}}",
|
||||
"maxzoom": "12",
|
||||
"minzoom": "0",
|
||||
"name": "tests/join-population/tabblock_06001420.mbtiles",
|
||||
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":152},{\"tiny_polygons\":76},{\"tiny_polygons\":46}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,10 +5,11 @@
|
||||
"description": "macarthur description",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur tests/join-population/macarthur.json; ./tippecanoe -q -f -d10 -D10 -Z9 -z11 -o tests/join-population/macarthur2.mbtiles -l macarthur tests/join-population/macarthur2.json; ./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join -q -f -o tests/join-population/merged.mbtiles tests/join-population/tabblock_06001420.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur2.mbtiles; ./tile-join -q -f -l macarthur -n 'macarthur name' -N 'macarthur description' -A 'macarthur'\"'\"'s attribution' -o tests/join-population/just-macarthur.mbtiles tests/join-population/merged.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 11, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"macarthur\",\"count\": 169,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 5,\"type\": \"string\",\"values\": [\"Macarthur\",\"Macarthur Blvd\",\"Macarthur Fwy\",\"W Macarthur\",\"W Macarthur Blvd\"]},{\"attribute\": \"LINEARID\",\"count\": 43,\"type\": \"string\",\"values\": [\"1102155930810\",\"1102156217102\",\"1102156241736\",\"1102156248968\",\"1102156510290\",\"1102157509691\",\"1102157651658\",\"1102406970092\",\"1102406970093\",\"1102406970094\",\"1102406970095\",\"1102407366406\",\"1102638069562\",\"1102638078801\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954189105\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1103717593123\",\"1104469713187\",\"1104469713198\",\"1104474748623\",\"1104475134288\",\"1104475134436\",\"1104485605278\",\"1104485645649\",\"1104485773833\",\"1104486090991\",\"1104486392881\",\"1105089436004\",\"1105089465114\",\"1105089465116\",\"1105281275434\",\"1105281275687\",\"1105281275688\",\"1105281275689\",\"1105281275692\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1100\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"macarthur\",\"description\":\"\",\"minzoom\":5,\"maxzoom\":11,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"macarthur\",\"count\":169,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":5,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Blvd\",\"Macarthur Fwy\",\"W Macarthur\",\"W Macarthur Blvd\"]},{\"attribute\":\"LINEARID\",\"count\":43,\"type\":\"string\",\"values\":[\"1102155930810\",\"1102156217102\",\"1102156241736\",\"1102156248968\",\"1102156510290\",\"1102157509691\",\"1102157651658\",\"1102406970092\",\"1102406970093\",\"1102406970094\",\"1102406970095\",\"1102407366406\",\"1102638069562\",\"1102638078801\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954189105\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1103717593123\",\"1104469713187\",\"1104469713198\",\"1104474748623\",\"1104475134288\",\"1104475134436\",\"1104485605278\",\"1104485645649\",\"1104485773833\",\"1104486090991\",\"1104486392881\",\"1105089436004\",\"1105089465114\",\"1105089465116\",\"1105281275434\",\"1105281275687\",\"1105281275688\",\"1105281275689\",\"1105281275692\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "12",
|
||||
"minzoom": "0",
|
||||
"name": "macarthur name",
|
||||
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":152},{\"tiny_polygons\":76},{\"tiny_polygons\":46}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/join-population/macarthur.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur tests/join-population/macarthur.json; ./tile-join -q -f -Z6 -z9 -X -o tests/join-population/macarthur-6-9-exclude.mbtiles tests/join-population/macarthur.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 6, \"maxzoom\": 9, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"macarthur\",\"count\": 61,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"macarthur\",\"description\":\"\",\"minzoom\":6,\"maxzoom\":9,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"macarthur\",\"count\":61,\"geometry\":\"LineString\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "9",
|
||||
"minzoom": "6",
|
||||
"name": "tests/join-population/macarthur.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/join-population/macarthur.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur tests/join-population/macarthur.json; ./tile-join -q -f -Z6 -z9 -o tests/join-population/macarthur-6-9.mbtiles tests/join-population/macarthur.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 6, \"maxzoom\": 9, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"macarthur\",\"count\": 61,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 3,\"type\": \"string\",\"values\": [\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\": \"LINEARID\",\"count\": 16,\"type\": \"string\",\"values\": [\"1102155930810\",\"1102156241736\",\"1102156510290\",\"1102638069562\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1104474748623\",\"1104486090991\",\"1104486392881\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1100\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"macarthur\",\"description\":\"\",\"minzoom\":6,\"maxzoom\":9,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"macarthur\",\"count\":61,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":3,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\":\"LINEARID\",\"count\":16,\"type\":\"string\",\"values\":[\"1102155930810\",\"1102156241736\",\"1102156510290\",\"1102638069562\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1104474748623\",\"1104486090991\",\"1104486392881\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "9",
|
||||
"minzoom": "6",
|
||||
"name": "tests/join-population/macarthur.mbtiles",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
"description": "tests/join-population/macarthur2.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur1 tests/join-population/macarthur.json; ./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur2.mbtiles -l macarthur2 tests/join-population/macarthur2.json; ./tile-join -q -R macarthur1:one '--rename-layer=macarthur2:two' -f -o tests/join-population/renamed.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur2.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"one\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 10, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} }, { \"id\": \"two\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 10, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 2,\"layers\": [{\"layer\": \"one\",\"count\": 90,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 3,\"type\": \"string\",\"values\": [\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\": \"LINEARID\",\"count\": 17,\"type\": \"string\",\"values\": [\"1102155930810\",\"1102156241736\",\"1102156510290\",\"1102157651658\",\"1102638069562\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1104474748623\",\"1104486090991\",\"1104486392881\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1100\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]},{\"layer\": \"two\",\"count\": 154,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 2,\"type\": \"string\",\"values\": [\"Macarthur Blvd\",\"W Macarthur Blvd\"]},{\"attribute\": \"LINEARID\",\"count\": 26,\"type\": \"string\",\"values\": [\"1102156217102\",\"1102156248968\",\"1102157509691\",\"1102406970092\",\"1102406970093\",\"1102406970094\",\"1102406970095\",\"1102407366406\",\"1102638078801\",\"1102954189105\",\"1103717593123\",\"1104469713187\",\"1104469713198\",\"1104475134288\",\"1104475134436\",\"1104485605278\",\"1104485645649\",\"1104485773833\",\"1105089436004\",\"1105089465114\",\"1105089465116\",\"1105281275434\",\"1105281275687\",\"1105281275688\",\"1105281275689\",\"1105281275692\"]},{\"attribute\": \"MTFCC\",\"count\": 1,\"type\": \"string\",\"values\": [\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"one\",\"description\":\"\",\"minzoom\":5,\"maxzoom\":10,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}},{\"id\":\"two\",\"description\":\"\",\"minzoom\":5,\"maxzoom\":10,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":2,\"layers\":[{\"layer\":\"one\",\"count\":90,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":3,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\":\"LINEARID\",\"count\":17,\"type\":\"string\",\"values\":[\"1102155930810\",\"1102156241736\",\"1102156510290\",\"1102157651658\",\"1102638069562\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1104474748623\",\"1104486090991\",\"1104486392881\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]},{\"layer\":\"two\",\"count\":154,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":2,\"type\":\"string\",\"values\":[\"Macarthur Blvd\",\"W Macarthur Blvd\"]},{\"attribute\":\"LINEARID\",\"count\":26,\"type\":\"string\",\"values\":[\"1102156217102\",\"1102156248968\",\"1102157509691\",\"1102406970092\",\"1102406970093\",\"1102406970094\",\"1102406970095\",\"1102407366406\",\"1102638078801\",\"1102954189105\",\"1103717593123\",\"1104469713187\",\"1104469713198\",\"1104475134288\",\"1104475134436\",\"1104485605278\",\"1104485645649\",\"1104485773833\",\"1105089436004\",\"1105089465114\",\"1105089465116\",\"1105281275434\",\"1105281275687\",\"1105281275688\",\"1105281275689\",\"1105281275692\"]},{\"attribute\":\"MTFCC\",\"count\":1,\"type\":\"string\",\"values\":[\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "10",
|
||||
"minzoom": "5",
|
||||
"name": "tests/join-population/macarthur.mbtiles + tests/join-population/macarthur2.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/join-population/macarthur.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur tests/join-population/macarthur.json; ./tile-join -q -f -c tests/join-population/windows.csv -o tests/join-population/windows.mbtiles tests/join-population/macarthur.mbtiles",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 10, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"macarthur\",\"count\": 90,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 3,\"type\": \"string\",\"values\": [\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\": \"LINEARID\",\"count\": 4,\"type\": \"string\",\"values\": [\"1102156510290\",\"1104486392881\",\"first\",\"second\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1100\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 1,\"type\": \"string\",\"values\": [\"M\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"macarthur\",\"description\":\"\",\"minzoom\":5,\"maxzoom\":10,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"macarthur\",\"count\":90,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":3,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Fwy\",\"W Macarthur\"]},{\"attribute\":\"LINEARID\",\"count\":4,\"type\":\"string\",\"values\":[\"1102156510290\",\"1104486392881\",\"first\",\"second\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "10",
|
||||
"minzoom": "5",
|
||||
"name": "tests/join-population/macarthur.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/knox/out/-zg.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/knox/out/-zg.json.check.mbtiles -zg tests/knox/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 10, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 53,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 9,\"type\": \"string\",\"values\": [\"E Old US Hwy 150\",\"E US Hwy 50\",\"E US Hwy 50-150\",\"N US Hwy 41\",\"Old US Hwy 41\",\"US Hwy 150\",\"US Hwy 41\",\"US Hwy 41 S\",\"US Hwy 50\"]},{\"attribute\": \"LINEARID\",\"count\": 53,\"type\": \"string\",\"values\": [\"110170070259\",\"110170070260\",\"110170070261\",\"110170070271\",\"110170070272\",\"110170070276\",\"110170070277\",\"110170070318\",\"110170070320\",\"110170071138\",\"110170072467\",\"1104257570399\",\"1104257599171\",\"1104257610285\",\"1104257610358\",\"1104257616296\",\"1104257622329\",\"1104257624305\",\"1104257624535\",\"1104257624536\",\"1104257624538\",\"1104257624700\",\"1104257627422\",\"1104257627423\",\"1104257640853\",\"1104257690581\",\"1104469553886\",\"1104469613150\",\"1104469613492\",\"1104471568916\",\"1104471680885\",\"1104471685645\",\"1104471685646\",\"1104471685675\",\"1104471685676\",\"1104471686635\",\"1104471686636\",\"1104472002543\",\"1104485818173\",\"1104485818174\",\"1104485838817\",\"1104485841551\",\"1104485841552\",\"1104485841553\",\"1104485841554\",\"1104485841555\",\"1104485841556\",\"1104485841662\",\"1104485841663\",\"1104485841664\",\"1104485841665\",\"1104485841666\",\"1104485841667\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1200\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 2,\"type\": \"string\",\"values\": [\"M\",\"U\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":10,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":53,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":9,\"type\":\"string\",\"values\":[\"E Old US Hwy 150\",\"E US Hwy 50\",\"E US Hwy 50-150\",\"N US Hwy 41\",\"Old US Hwy 41\",\"US Hwy 150\",\"US Hwy 41\",\"US Hwy 41 S\",\"US Hwy 50\"]},{\"attribute\":\"LINEARID\",\"count\":53,\"type\":\"string\",\"values\":[\"110170070259\",\"110170070260\",\"110170070261\",\"110170070271\",\"110170070272\",\"110170070276\",\"110170070277\",\"110170070318\",\"110170070320\",\"110170071138\",\"110170072467\",\"1104257570399\",\"1104257599171\",\"1104257610285\",\"1104257610358\",\"1104257616296\",\"1104257622329\",\"1104257624305\",\"1104257624535\",\"1104257624536\",\"1104257624538\",\"1104257624700\",\"1104257627422\",\"1104257627423\",\"1104257640853\",\"1104257690581\",\"1104469553886\",\"1104469613150\",\"1104469613492\",\"1104471568916\",\"1104471680885\",\"1104471685645\",\"1104471685646\",\"1104471685675\",\"1104471685676\",\"1104471686635\",\"1104471686636\",\"1104472002543\",\"1104485818173\",\"1104485818174\",\"1104485838817\",\"1104485841551\",\"1104485841552\",\"1104485841553\",\"1104485841554\",\"1104485841555\",\"1104485841556\",\"1104485841662\",\"1104485841663\",\"1104485841664\",\"1104485841665\",\"1104485841666\",\"1104485841667\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1200\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":2,\"type\":\"string\",\"values\":[\"M\",\"U\"]}]}]}}",
|
||||
"maxzoom": "10",
|
||||
"minzoom": "0",
|
||||
"name": "tests/knox/out/-zg.json.check.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/knox/out/-zg_-P.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/knox/out/-zg_-P.json.check.mbtiles -zg -P tests/knox/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 10, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 53,\"geometry\": \"LineString\",\"attributeCount\": 4,\"attributes\": [{\"attribute\": \"FULLNAME\",\"count\": 9,\"type\": \"string\",\"values\": [\"E Old US Hwy 150\",\"E US Hwy 50\",\"E US Hwy 50-150\",\"N US Hwy 41\",\"Old US Hwy 41\",\"US Hwy 150\",\"US Hwy 41\",\"US Hwy 41 S\",\"US Hwy 50\"]},{\"attribute\": \"LINEARID\",\"count\": 53,\"type\": \"string\",\"values\": [\"110170070259\",\"110170070260\",\"110170070261\",\"110170070271\",\"110170070272\",\"110170070276\",\"110170070277\",\"110170070318\",\"110170070320\",\"110170071138\",\"110170072467\",\"1104257570399\",\"1104257599171\",\"1104257610285\",\"1104257610358\",\"1104257616296\",\"1104257622329\",\"1104257624305\",\"1104257624535\",\"1104257624536\",\"1104257624538\",\"1104257624700\",\"1104257627422\",\"1104257627423\",\"1104257640853\",\"1104257690581\",\"1104469553886\",\"1104469613150\",\"1104469613492\",\"1104471568916\",\"1104471680885\",\"1104471685645\",\"1104471685646\",\"1104471685675\",\"1104471685676\",\"1104471686635\",\"1104471686636\",\"1104472002543\",\"1104485818173\",\"1104485818174\",\"1104485838817\",\"1104485841551\",\"1104485841552\",\"1104485841553\",\"1104485841554\",\"1104485841555\",\"1104485841556\",\"1104485841662\",\"1104485841663\",\"1104485841664\",\"1104485841665\",\"1104485841666\",\"1104485841667\"]},{\"attribute\": \"MTFCC\",\"count\": 2,\"type\": \"string\",\"values\": [\"S1200\",\"S1400\"]},{\"attribute\": \"RTTYP\",\"count\": 2,\"type\": \"string\",\"values\": [\"M\",\"U\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":10,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":53,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":9,\"type\":\"string\",\"values\":[\"E Old US Hwy 150\",\"E US Hwy 50\",\"E US Hwy 50-150\",\"N US Hwy 41\",\"Old US Hwy 41\",\"US Hwy 150\",\"US Hwy 41\",\"US Hwy 41 S\",\"US Hwy 50\"]},{\"attribute\":\"LINEARID\",\"count\":53,\"type\":\"string\",\"values\":[\"110170070259\",\"110170070260\",\"110170070261\",\"110170070271\",\"110170070272\",\"110170070276\",\"110170070277\",\"110170070318\",\"110170070320\",\"110170071138\",\"110170072467\",\"1104257570399\",\"1104257599171\",\"1104257610285\",\"1104257610358\",\"1104257616296\",\"1104257622329\",\"1104257624305\",\"1104257624535\",\"1104257624536\",\"1104257624538\",\"1104257624700\",\"1104257627422\",\"1104257627423\",\"1104257640853\",\"1104257690581\",\"1104469553886\",\"1104469613150\",\"1104469613492\",\"1104471568916\",\"1104471680885\",\"1104471685645\",\"1104471685646\",\"1104471685675\",\"1104471685676\",\"1104471686635\",\"1104471686636\",\"1104472002543\",\"1104485818173\",\"1104485818174\",\"1104485838817\",\"1104485841551\",\"1104485841552\",\"1104485841553\",\"1104485841554\",\"1104485841555\",\"1104485841556\",\"1104485841662\",\"1104485841663\",\"1104485841664\",\"1104485841665\",\"1104485841666\",\"1104485841667\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1200\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":2,\"type\":\"string\",\"values\":[\"M\",\"U\"]}]}]}}",
|
||||
"maxzoom": "10",
|
||||
"minzoom": "0",
|
||||
"name": "tests/knox/out/-zg_-P.json.check.mbtiles",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/layer-json/out.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"places\", \"description\": \"World cities\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"NAME\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"places\",\"count\": 243,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"NAME\",\"count\": 243,\"type\": \"string\",\"values\": [\"Abidjan\",\"Abu Dhabi\",\"Abuja\",\"Accra\",\"Addis Ababa\",\"Algiers\",\"Amman\",\"Amsterdam\",\"Andorra\",\"Ankara\",\"Antananarivo\",\"Apia\",\"Ashgabat\",\"Asmara\",\"Astana\",\"Asuncion\",\"Athens\",\"Atlanta\",\"Auckland\",\"Baghdad\",\"Baguio City\",\"Baku\",\"Bamako\",\"Bandar Seri Begawan\",\"Bangalore\",\"Bangkok\",\"Bangui\",\"Banjul\",\"Basseterre\",\"Beijing\",\"Beirut\",\"Belgrade\",\"Belmopan\",\"Berlin\",\"Bern\",\"Bir Lehlou\",\"Bishkek\",\"Bissau\",\"Bloemfontein\",\"Bogota\",\"Brasilia\",\"Bratislava\",\"Brazzaville\",\"Bridgetown\",\"Brussels\",\"Bucharest\",\"Budapest\",\"Buenos Aires\",\"Bujumbura\",\"Cairo\",\"Canberra\",\"Cape Town\",\"Caracas\",\"Casablanca\",\"Castries\",\"Chengdu\",\"Chicago\",\"Chisinau\",\"Colombo\",\"Conakry\",\"Cotonou\",\"Dakar\",\"Damascus\",\"Dar es Salaam\",\"Denver\",\"Dhaka\",\"Dili\",\"Djibouti\",\"Dodoma\",\"Doha\",\"Dubai\",\"Dublin\",\"Dushanbe\",\"Freetown\",\"Funafuti\",\"Gaborone\",\"Geneva\",\"Georgetown\",\"Guatemala\",\"Hanoi\",\"Harare\",\"Hargeysa\",\"Havana\",\"Helsinki\",\"Hong Kong\",\"Honiara\",\"Houston\",\"Islamabad\",\"Istanbul\",\"Jakarta\",\"Jerusalem\",\"Johannesburg\",\"Juba\",\"Kabul\",\"Kampala\",\"Kathmandu\",\"Khartoum\",\"Kiev\",\"Kigali\",\"Kingston\"]}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"places\",\"description\":\"World cities\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"NAME\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"places\",\"count\":243,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"NAME\",\"count\":243,\"type\":\"string\",\"values\":[\"Abidjan\",\"Abu Dhabi\",\"Abuja\",\"Accra\",\"Addis Ababa\",\"Algiers\",\"Amman\",\"Amsterdam\",\"Andorra\",\"Ankara\",\"Antananarivo\",\"Apia\",\"Ashgabat\",\"Asmara\",\"Astana\",\"Asuncion\",\"Athens\",\"Atlanta\",\"Auckland\",\"Baghdad\",\"Baguio City\",\"Baku\",\"Bamako\",\"Bandar Seri Begawan\",\"Bangalore\",\"Bangkok\",\"Bangui\",\"Banjul\",\"Basseterre\",\"Beijing\",\"Beirut\",\"Belgrade\",\"Belmopan\",\"Berlin\",\"Bern\",\"Bir Lehlou\",\"Bishkek\",\"Bissau\",\"Bloemfontein\",\"Bogota\",\"Brasilia\",\"Bratislava\",\"Brazzaville\",\"Bridgetown\",\"Brussels\",\"Bucharest\",\"Budapest\",\"Buenos Aires\",\"Bujumbura\",\"Cairo\",\"Canberra\",\"Cape Town\",\"Caracas\",\"Casablanca\",\"Castries\",\"Chengdu\",\"Chicago\",\"Chisinau\",\"Colombo\",\"Conakry\",\"Cotonou\",\"Dakar\",\"Damascus\",\"Dar es Salaam\",\"Denver\",\"Dhaka\",\"Dili\",\"Djibouti\",\"Dodoma\",\"Doha\",\"Dubai\",\"Dublin\",\"Dushanbe\",\"Freetown\",\"Funafuti\",\"Gaborone\",\"Geneva\",\"Georgetown\",\"Guatemala\",\"Hanoi\",\"Harare\",\"Hargeysa\",\"Havana\",\"Helsinki\",\"Hong Kong\",\"Honiara\",\"Houston\",\"Islamabad\",\"Istanbul\",\"Jakarta\",\"Jerusalem\",\"Johannesburg\",\"Juba\",\"Kabul\",\"Kampala\",\"Kathmandu\",\"Khartoum\",\"Kiev\",\"Kigali\",\"Kingston\"]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/layer-json/out.mbtiles",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "tests/longattr/out/-z0.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/longattr/out/-z0.json.check.mbtiles -z0 tests/longattr/sherlock.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"sherlock\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"sherlock\": \"String\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"sherlock\",\"count\": 1,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"sherlock\",\"count\": 1,\"type\": \"string\",\"values\": []}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"sherlock\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"sherlock\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"sherlock\",\"count\":1,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"sherlock\",\"count\":1,\"type\":\"string\",\"values\":[]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/longattr/out/-z0.json.check.mbtiles",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
"description": "tests/longlayer/out/-z0.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/longlayer/out/-z0.json.check.mbtiles -z0 tests/longlayer/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_1\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {} }, { \"id\": \"ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_2\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {} }, { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_1\": \"Number\", \"ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_2\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 2,\"layers\": [{\"layer\": \"ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongN\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 0,\"attributes\": []},{\"layer\": \"in\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHas\",\"count\": 2,\"type\": \"number\",\"values\": [12,13],\"min\": 12,\"max\": 13}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_1\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}},{\"id\":\"ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_2\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}},{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_1\":\"Number\",\"ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_2\":\"Number\"}}],\"tilestats\":{\"layerCount\":2,\"layers\":[{\"layer\":\"ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongName_ThisLayerHasAVeryLongN\",\"count\":2,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]},{\"layer\":\"in\",\"count\":2,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHasAVeryLongName_ThisAttributeHas\",\"count\":2,\"type\":\"number\",\"values\":[12,13],\"min\":12,\"max\":13}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/longlayer/out/-z0.json.check.mbtiles",
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/loop/out/-z0_-O200_--cluster-densest-as-needed.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/loop/out/-z0_-O200_--cluster-densest-as-needed.json.check.mbtiles -z0 -O200 --cluster-densest-as-needed tests/loop/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"clustered\": \"Boolean\", \"point_count\": \"Number\", \"sqrt_point_count\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1000,\"geometry\": \"Point\",\"attributeCount\": 3,\"attributes\": [{\"attribute\": \"clustered\",\"count\": 1,\"type\": \"boolean\",\"values\": [true]},{\"attribute\": \"point_count\",\"count\": 1,\"type\": \"number\",\"values\": [1000],\"min\": 1000,\"max\": 1000},{\"attribute\": \"sqrt_point_count\",\"count\": 1,\"type\": \"number\",\"values\": [31.620000],\"min\": 31.62,\"max\": 31.62}]}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"clustered\":\"Boolean\",\"point_count\":\"Number\",\"sqrt_point_count\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1000,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"clustered\",\"count\":1,\"type\":\"boolean\",\"values\":[true]},{\"attribute\":\"point_count\",\"count\":1,\"type\":\"number\",\"values\":[1000],\"min\":1000,\"max\":1000},{\"attribute\":\"sqrt_point_count\",\"count\":1,\"type\":\"number\",\"values\":[31.620000],\"min\":31.62,\"max\":31.62}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/loop/out/-z0_-O200_--cluster-densest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[ { \"coalesced_as_needed\": 999 } ]",
|
||||
"strategies": "[{\"coalesced_as_needed\":999,\"feature_count_desired\":1000}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/loop/out/-z0_-O200_--drop-densest-as-needed.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/loop/out/-z0_-O200_--drop-densest-as-needed.json.check.mbtiles -z0 -O200 --drop-densest-as-needed tests/loop/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1000,\"geometry\": \"Point\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1000,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/loop/out/-z0_-O200_--drop-densest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[ { \"dropped_as_needed\": 999 } ]",
|
||||
"strategies": "[{\"dropped_as_needed\":999,\"feature_count_desired\":1000}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"description": "tests/loop/out/-z0_-O200_--drop-fraction-as-needed.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/loop/out/-z0_-O200_--drop-fraction-as-needed.json.check.mbtiles -z0 -O200 --drop-fraction-as-needed tests/loop/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1000,\"geometry\": \"Point\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1000,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/loop/out/-z0_-O200_--drop-fraction-as-needed.json.check.mbtiles",
|
||||
"strategies": "[ { \"dropped_as_needed\": 811 } ]",
|
||||
"strategies": "[{\"dropped_as_needed\":811,\"feature_count_desired\":1000}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user