Skip to content

Commit 0cf8342

Browse files
authored
0.4.0 (#113) [publish binary]
* prepare 0.4.0 release * typo fix * docs update
1 parent 68867f4 commit 0cf8342

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.4.0
2+
3+
* Add `basic-filters` option for filtering on Number or Boolean properties. [#110](https://github.com/mapbox/vtquery/pull/110)
4+
* Remove tests for node v4 + v6
5+
16
## 0.3.0
27

38
* now adding feature.id to response JSON [#90](https://github.com/mapbox/vtquery/pull/90)

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ The two major use cases for this library are:
2020
### Table of Contents
2121

2222
- [vtquery](#vtquery)
23+
- [Parameters](#parameters)
24+
- [Examples](#examples)
2325

2426
## vtquery
2527

26-
**Parameters**
28+
### Parameters
2729

2830
- `tiles` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** an array of tile objects with `buffer`, `z`, `x`, and `y` values
2931
- `LngLat` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>** a query point of longitude and latitude to query, `[lng, lat]`
@@ -36,8 +38,11 @@ The two major use cases for this library are:
3638
Defaults to all geometry types.
3739
- `options.dedup` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** perform deduplication of features based on shared layers, geometry, IDs and matching
3840
properties. (optional, default `true`)
41+
- `options.basic-filters` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)>?** an expression-like filter to include features with Numeric or Boolean properties
42+
that match the filters based on the following conditions: `=, !=, <, <=, >, >=`. The first item must be the value "any" or "all" whether
43+
any or all filters must evaluate to true.
3944

40-
**Examples**
45+
### Examples
4146

4247
```javascript
4348
const vtquery = require('@mapbox/vtquery');
@@ -52,7 +57,8 @@ const options = {
5257
limit: 5,
5358
geometry: 'polygon',
5459
layers: ['building', 'parks'],
55-
dedupe: true
60+
dedupe: true,
61+
'basic-filters': ['all', [['population', '>', 10], ['population', '<', 1000]]]
5662
};
5763

5864
vtquery(tiles, [-122.4477, 37.7665], options, function(err, result) {

lib/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
* @param {Array<Number>} LngLat a query point of longitude and latitude to query, `[lng, lat]`
88
* @param {Object} [options]
99
* @param {Number} [options.radius=0] the radius to query for features. If your radius is larger than
10-
* the extent of an individual tile, include multiple nearby buffers to collect a realstic list of features
10+
* the extent of an individual tile, include multiple nearby buffers to collect a realistic list of features
1111
* @param {Number} [options.limit=5] limit the number of results/features returned from the query. Minimum is 1, maximum is 1000 (to avoid pre allocating large amounts of memory)
1212
* @param {Array<String>} [options.layers] an array of layer string names to query from. Default is all layers.
1313
* @param {String} [options.geometry] only return features of a particular geometry type. Can be `point`, `linestring`, or `polygon`.
1414
* Defaults to all geometry types.
1515
* @param {String} [options.dedup=true] perform deduplication of features based on shared layers, geometry, IDs and matching
1616
* properties.
17+
* @param {Array<String,Array>} [options.basic-filters] - an expression-like filter to include features with Numeric or Boolean properties
18+
* that match the filters based on the following conditions: `=, !=, <, <=, >, >=`. The first item must be the value "any" or "all" whether
19+
* any or all filters must evaluate to true.
1720
*
1821
* @example
1922
* const vtquery = require('@mapbox/vtquery');
@@ -28,7 +31,8 @@
2831
* limit: 5,
2932
* geometry: 'polygon',
3033
* layers: ['building', 'parks'],
31-
* dedupe: true
34+
* dedupe: true,
35+
* 'basic-filters': ['all', [['population', '>', 10], ['population', '<', 1000]]]
3236
* };
3337
*
3438
* vtquery(tiles, [-122.4477, 37.7665], options, function(err, result) {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mapbox/vtquery",
3-
"version": "0.3.1-basic-filter",
3+
"version": "0.4.0",
44
"description": "Get features from Mapbox Vector Tiles from a lng/lat query point",
55
"url": "http://github.com/mapbox/vtquery",
66
"main": "./lib/index.js",

0 commit comments

Comments
 (0)