Skip to content

Commit

Permalink
Upgrade supercluster and geojson-vt. Document and add support for geo…
Browse files Browse the repository at this point in the history
…json-vt generateId
  • Loading branch information
Asheem Mamoowala committed Jul 28, 2018
1 parent cdef662 commit 2af2d7d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
4 changes: 3 additions & 1 deletion flow-typed/style-spec.js
Expand Up @@ -77,6 +77,7 @@ declare type VectorSourceSpecification = {
"url"?: string,
"tiles"?: Array<string>,
"bounds"?: [number, number, number, number],
"scheme"?: "xyz" | "tms",
"minzoom"?: number,
"maxzoom"?: number,
"attribution"?: string
Expand Down Expand Up @@ -116,7 +117,8 @@ declare type GeojsonSourceSpecification = {|
"cluster"?: boolean,
"clusterRadius"?: number,
"clusterMaxZoom"?: number,
"lineMetrics"?: boolean
"lineMetrics"?: boolean,
"generateId"?: boolean
|}

declare type VideoSourceSpecification = {|
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -25,7 +25,7 @@
"csscolorparser": "~1.0.2",
"earcut": "^2.1.3",
"geojson-rewind": "^0.3.0",
"geojson-vt": "^3.1.4",
"geojson-vt": "^3.2.0",
"gl-matrix": "^2.6.1",
"gray-matter": "^3.0.8",
"grid-index": "^1.0.0",
Expand All @@ -35,7 +35,7 @@
"rw": "^1.3.3",
"shuffle-seed": "^1.1.6",
"sort-object": "^0.3.2",
"supercluster": "^4.0.1",
"supercluster": "^4.1.1",
"through2": "^2.0.3",
"tinyqueue": "^1.1.0",
"vt-pbf": "^3.0.1"
Expand Down
3 changes: 2 additions & 1 deletion src/source/geojson_source.js
Expand Up @@ -126,7 +126,8 @@ class GeoJSONSource extends Evented implements Source {
tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale,
extent: EXTENT,
maxZoom: this.maxzoom,
lineMetrics: options.lineMetrics || false
lineMetrics: options.lineMetrics || false,
generateId: options.generateId || false
},
superclusterOptions: {
maxZoom: options.clusterMaxZoom !== undefined ?
Expand Down
5 changes: 5 additions & 0 deletions src/style-spec/reference/v8.json
Expand Up @@ -377,6 +377,11 @@
"type": "boolean",
"default": false,
"doc": "Whether to calculate line distance metrics. This is required for line layers that specify `line-gradient` values."
},
"generateId": {
"type": "boolean",
"default": false,
"doc": "Whether to generate ids for the geojson features."
}
},
"source_video": {
Expand Down
6 changes: 4 additions & 2 deletions test/unit/source/geojson_source.test.js
Expand Up @@ -145,7 +145,8 @@ test('GeoJSONSource#update', (t) => {
maxZoom: 10,
tolerance: 4,
buffer: 256,
lineMetrics: false
lineMetrics: false,
generateId: true
});
t.end();
}
Expand All @@ -155,7 +156,8 @@ test('GeoJSONSource#update', (t) => {
data: {},
maxzoom: 10,
tolerance: 0.25,
buffer: 16
buffer: 16,
generateId: true
}, mockDispatcher).load();
});

Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Expand Up @@ -4351,9 +4351,9 @@ geojson-rewind@^0.3.0:
concat-stream "~1.6.0"
minimist "1.2.0"

geojson-vt@^3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/geojson-vt/-/geojson-vt-3.1.4.tgz#c8ffefbe3613d3ad2747e963b0b63b9e62ff11b8"
geojson-vt@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/geojson-vt/-/geojson-vt-3.2.0.tgz#039cea549df5f892c48cff8eb66c2e217d61c241"

get-caller-file@^1.0.1:
version "1.0.2"
Expand Down Expand Up @@ -9628,9 +9628,9 @@ sugarss@^1.0.0:
dependencies:
postcss "^6.0.14"

supercluster@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/supercluster/-/supercluster-4.0.1.tgz#eead7ab49f50322b265e0087859ebcabdc5c2ed8"
supercluster@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/supercluster/-/supercluster-4.1.1.tgz#cf13c3b28a3fb3db5290bfad7f524e244bd4ce78"
dependencies:
kdbush "^2.0.1"

Expand Down

0 comments on commit 2af2d7d

Please sign in to comment.