Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.0 release #113

Merged
merged 4 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.0

* Add `basic-filters` option for filtering on Number or Boolean properties. [#110](https://github.com/mapbox/vtquery/pull/110)
* Remove tests for node v4 + v6

## 0.3.0

* now adding feature.id to response JSON [#90](https://github.com/mapbox/vtquery/pull/90)
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ The two major use cases for this library are:
### Table of Contents

- [vtquery](#vtquery)
- [Parameters](#parameters)
- [Examples](#examples)

## vtquery

**Parameters**
### Parameters

- `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
- `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]`
Expand All @@ -36,8 +38,11 @@ The two major use cases for this library are:
Defaults to all geometry types.
- `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
properties. (optional, default `true`)
- `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
that match the filters based on the following conditions: `=, !=, <, <=, >, >=`. The first item must be the value "any" or "all" whether
any or all filters must evaluate to true.

**Examples**
### Examples

```javascript
const vtquery = require('@mapbox/vtquery');
Expand All @@ -52,7 +57,8 @@ const options = {
limit: 5,
geometry: 'polygon',
layers: ['building', 'parks'],
dedupe: true
dedupe: true,
'basic-filters': ['all', [['population', '>', 10], ['population', '<', 1000]]]
};

vtquery(tiles, [-122.4477, 37.7665], options, function(err, result) {
Expand Down
8 changes: 6 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
* @param {Array<Number>} LngLat a query point of longitude and latitude to query, `[lng, lat]`
* @param {Object} [options]
* @param {Number} [options.radius=0] the radius to query for features. If your radius is larger than
* the extent of an individual tile, include multiple nearby buffers to collect a realstic list of features
* the extent of an individual tile, include multiple nearby buffers to collect a realistic list of features
* @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)
* @param {Array<String>} [options.layers] an array of layer string names to query from. Default is all layers.
* @param {String} [options.geometry] only return features of a particular geometry type. Can be `point`, `linestring`, or `polygon`.
* Defaults to all geometry types.
* @param {String} [options.dedup=true] perform deduplication of features based on shared layers, geometry, IDs and matching
* properties.
* @param {Array<String,Array>} [options.basic-filters] - an expression-like filter to include features with Numeric or Boolean properties
* that match the filters based on the following conditions: `=, !=, <, <=, >, >=`. The first item must be the value "any" or "all" whether
* any or all filters must evaluate to true.
*
* @example
* const vtquery = require('@mapbox/vtquery');
Expand All @@ -28,7 +31,8 @@
* limit: 5,
* geometry: 'polygon',
* layers: ['building', 'parks'],
* dedupe: true
* dedupe: true,
* 'basic-filters': ['all', [['population', '>', 10], ['population', '<', 1000]]]
* };
*
* vtquery(tiles, [-122.4477, 37.7665], options, function(err, result) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapbox/vtquery",
"version": "0.3.1-basic-filter",
"version": "0.4.0",
"description": "Get features from Mapbox Vector Tiles from a lng/lat query point",
"url": "http://github.com/mapbox/vtquery",
"main": "./lib/index.js",
Expand Down