2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > mapbox tippecanoe切矢量瓦片参数设置和注意事项

mapbox tippecanoe切矢量瓦片参数设置和注意事项

时间:2019-09-29 07:01:55

相关推荐

mapbox tippecanoe切矢量瓦片参数设置和注意事项

tippecanoe生成矢量切片步骤在这篇帖子中有详细介绍windows下使用tippecanoe把GeoJSON制作成矢量切片vectortile_十月的秋的专栏-CSDN博客

下面介绍下tippecanoe切片的相关参数:

tippecanoe提供了众多选项。大多数时候不需要指定额外的选项参数,只需要通过-ooutput.mbtiles指定输出文件名,或者-f来删除已经存在的文件。

如果你不确定所使用数据的最大级别,可以使用-zg来根据数据密度自动估算一个级别。

如果你的数据包含点状要素,通常需要使用-Bg来自动计算一个基准级别做数据抽稀。如果这种方式对你无效,可以尝试使用-r1 --drop-fraction-as-needed关闭传统的抽稀方法,而仅仅在瓦片太大时才做抽稀。

如果你的数据包含点状要素或面状要素,你可能需要使用--drop-densest-as-needed来舍弃一些要素,让其可以在低级别显示。

如果你的数据包含大量的属性信息,可以使用-y来指定你需要的属性。

瓦片输出

-ofile.mbtiles或者--output=file.mbtiles: 指定输出文件名称-edirectory或者--output-to-directory=directory: 将瓦片文件输出到指定的directory文件夹,而不是mbtiles-f或者--force: 如果指定的mbtiles已存在,则删除,否则抛出错误-F或者--allow-existing: 忽略元数据或瓦片已存在的情况,一般不推荐使用

瓦片描述和权属信息

-nname或者--name=name:瓦片集的名称-Atext或者--attribution=text:使用瓦片数据时,显示在地图上的权属信息 (HTML格式)-Ndescription或者--description=description: 瓦片集的描述信息 (默认 file.mbtiles)

输入文件和图层名

name.json或者name.geojson: 读取指定的文件到一个名为name的图层-lname或者--layer=name:使用指定的图层名,如果输入的有多个文件,则这些文件将会被合并到一个图层-Lname:file.json或者--named-layer=name:file.json: 为每一个单独的文件指定一个图层名

输入文件的并行处理

-P或者--read-parallel: 使用多线程读取一个文件的不同部分

该选项只对新行分隔(每个要素为一行)的json文件有效。否则将会返回一个“EOF”错误。

输入文件的投影

-sprojection或者--projection=projection:为输入的数据指定一个投影。目前仅支持EPSG:4326(WGS84, 默认) 和EPSG:3857(Web墨卡托)。

缩放级别

-zzoom或者--maximum-zoom=zoom:切片的最大级别(默认14)-zg或者--maximum-zoom=g: 根据要素分布自动估算最大级别-Zzoom或者--minimum-zoom=zoom:切片的最小级别(默认0)

瓦片分辨率

-ddetail或者--full-detail=detail: 在最大级别时的“详细程度” (默认 12, 对应的分辨率为4096)-Ddetail或者--low-detail=detail:在最大级别时的“详细程度”(默认 12, 对应的分辨率为4096)-mdetail或者--minimum-detail=detail: “详细程度”下限,如果在标准“详细程度”下瓦片太大将会尝试的最小“详细程度” (默认 7,对应的分辨率为128)

All internal math is done in terms of a 32-bit tile coordinate system, so 1/(2^32) of the size of Earth,

or about 1cm, is the smallest distinguishable distance. Ifmaxzoom+detail> 32, no additional

resolution is obtained than by using a smallermaxzoomordetail.

过滤要素属性

-xname或者--exclude=name: 剔除的属性字段-yname或者--include=name: 包含的属性字段,其他字段都将被剔除-X或者--exclude-all: 剔除所有字段,仅仅编码“geometry”字段-Tattribute:type或者--attribute-type=attribute:type: 强制将要素的attribute属性类型转换为指定的type类型。

type的取值范围:string,float,int, 或bool。 如果是bool,那么原始属性中的0falsenull、或者空字符串都会被转为false,其它都被转为true。 如果是floatint并且原始数据为非数字,则会被转为0。如果是int并且原始数据为浮点型,将会被转为与其最接近的整数。

根据缩放级别舍弃部分要素

-rrate或者--drop-rate=rate: 在基准级别以下的瓦片中被舍弃的点的比例(默认 2.5)。 如果使用-rg,将会估算一个弃置比,保持瓦片中最多包含50,000个要素。同时也可以使用-rgwidth指定一个注记宽度来允许瓦片中保持较少的要素,以适应较大的注记或标记,也可以使用-rfnumber来设置瓦片中最多包含的要素数量。-Bzoom或者--base-zoom=zoom:基准级别,基准级别及以上的瓦片将不做点状数据的抽稀 (默认为最大级别)。 如果使用了-Bg, 将会根据最大要素数50,000估算基准级别。同时也可以使用-Bgwidth指定一个注记宽度来允许瓦片中保持较少的要素,以适应较大的注记或标记,也可以使用-Bfnumber来设置瓦片中最多包含的要素数量。-al或者--drop-lines: 让线要素跟点要素一样,在低级别做数据抽稀-ap或者--drop-polygons: 让面要素跟点要素一样,在低级别做数据抽稀

注意:在切片之前,一定要看下自己的是数据要素个数,如果超过50000个,一定要设置下-rfnumber,否则,切片显示会抽稀,不全

舍弃一小部分要素来保持瓦片大小不超限

-as或者--drop-densest-as-needed:如果瓦片太大,尝试增加要素之间的最小间隔来将瓦片大小控制在500kb以下。这种显示间距将会被应用到所有级别的瓦片。-ad或者--drop-fraction-as-needed:从每一个级别动态舍弃一部分要素来保持瓦片大小不超过500kb限制。 (类似于-pd,但是是应用于整个级别,而不是每一个瓦片)-an或者--drop-smallest-as-needed:从每一个级别动态舍弃最小的要素(物理上的最小:最短的线或最小的面)来保持瓦片大小不超过500kb限制。 该选项对点状要素无效。-pd或者--force-feature-limit: 动态舍弃部分要素来保持瓦片大小不超过500kb限制(该选项与-ad类似,但是是针对每个单独的瓦片,而不是整个缩放级别)。该选项可能会导致瓦片边界区域比较难看,一般情况不建议使用。

舍弃紧密交错的要素

-ggamma或者--gamma=_gamma_:特别密集的点将会被丢弃的比例 (默认 0,不丢弃)。gamma值为2表示减少小于一个像素的点,直到其数量减少到原始数量的平方根(译者注:不确定该翻译是否准确)。-aG或者--increase-gamma-as-needed:如果瓦片太大,尝试使用-g增加gamma值来将瓦片大小控制在500kb以下。这个gamma值将会被应用到整个缩放级别,一般情况下会使用--drop-densest-as-needed代替该命令。

线和面的简化

-Sscale或者--simplification=scale:Multiply the tolerance for line and polygon simplification byscale. The standard tolerance tries to keep

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或者--no-line-simplification: 禁止简化线和面-pS或者--simplify-only-low-zooms: 禁止在最大级别简化线和面 (在低级别仍然执行简化)-pt或者--no-tiny-polygon-reduction: Don’t combine the area of very small polygons into small squares that represent their combined area.

尝试改善多边形的公共边

-ab或者--detect-shared-borders: In the manner ofTopoJSON, detect borders that are shared between multiple polygons and simplify them identically in each polygon. This takes more time and memory than considering each polygon individually.-aLor--grid-low-zooms: At all zoom levels belowmaxzoom, snap all lines and polygons to a stairstep grid instead of allowing diagonals. You will also want to specify a tile resolution, probably-D8. This option provides a way to display continuous parcel, gridded, or binned data at low zooms without overwhelming the tiles with tiny polygons, since features will either get stretched out to the grid unit or lost entirely, depending on how they happened to be aligned in the original data. You probably don’t want to use this.

Controlling clipping to tile boundaries

-bpixelsor--buffer=pixels: Buffer size where features are duplicated from adjacent tiles. Units are “screen pixels”—1/256th of the tile width or height. (default 5)-pcor--no-clipping: Don’t clip features to the size of the tile. If a feature overlaps the tile’s bounds or buffer at all, it is included completely. Be careful: this can produce very large tilesets, especially with large polygons.-pDor--no-duplication: As with--no-clipping, each feature is included intact instead of cut to tile boundaries. In addition, it is included only in a single tile per zoom level rather than potentially in multiple copies. Clients of the tileset must check adjacent tiles (possibly some distance away) to ensure they have all features.

Reordering features within each tile

-pior--preserve-input-order: Preserve the original input order of features as the drawing order instead of ordering geographically. (This is implemented as a restoration of the original order at the end, so that dot-dropping is still geographic, which means it also undoes-ao).-aoor--reorder: Reorder features to put ones with the same properties in sequence, to try to get them to coalesce. You probably don’t want to use this.-acor--coalesce: Coalesce adjacent line and polygon features that have the same properties. You probably don’t want to use this.-aror--reverse: Try reversing the directions of lines to make them coalesce and compress better. You probably don’t want to use this.

添加可计算的属性

-ag或者--calculate-feature-density:添加一个新属性,tippecanoe_feature_density, to each feature, to record how densely features are spaced in that area of the tile. You can use this attribute in the style to produce a glowing effect where points are densely packed. It can range from 0 in the sparsest areas to 255 in the densest.

尝试修复损坏的数据源

-aw或者--detect-longitude-wraparound: Detect when adjacent points within a feature jump to the other side of the world, and try to fix the geometry.

设置或取消瓦片大小限制

-Mbytesor--maximum-tile-bytes=bytes: Use the specified number ofbytesas the maximum compressed tile size instead of 500K.-pfor--no-feature-limit: Don’t limit tiles to 200,000 features-pkor--no-tile-size-limit: Don’t limit tiles to 500K bytes-pCor--no-tile-compression: Don’t compress the PBF vector tile data.

注意:在切片之前,一定要看下自己的数据量,如果数据超过了200,000个,一定要设置下这个参数

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。