Skip to content

Commit

Permalink
querySourceFeatures: rename source-layer to sourceLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Mar 21, 2016
1 parent 49e24e1 commit 9a5432d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion js/source/worker_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ WorkerTile.prototype.querySourceFeatures = function(params) {
if (!this.data) return null;

var layer = this.data.layers ?
this.data.layers[params['source-layer']] :
this.data.layers[params.sourceLayer] :
this.data;

if (!layer) return null;
Expand Down
2 changes: 1 addition & 1 deletion js/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ util.extend(Map.prototype, /** @lends Map.prototype */{
*
* @param {string} sourceID source ID
* @param {Object} params
* @param {string} [params.source-layer] The name of the vector tile layer to get features from.
* @param {string} [params.sourceLayer] The name of the vector tile layer to get features from.
* @param {Array} [params.filter] A mapbox-gl-style-spec filter.
* @param {callback} callback function that receives the results
*
Expand Down
8 changes: 4 additions & 4 deletions test/js/source/worker_tile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ test('querySourceFeatures', function(t) {

tile.data = new vt.VectorTile(new Protobuf(new Uint8Array(fs.readFileSync(path.join(__dirname, '/../../fixtures/mbsv5-6-18-23.vector.pbf')))));

t.equal(tile.querySourceFeatures({ 'source-layer': 'does-not-exist'}), null);
t.equal(tile.querySourceFeatures({ 'sourceLayer': 'does-not-exist'}), null);

var roads = tile.querySourceFeatures({ 'source-layer': 'road' });
var roads = tile.querySourceFeatures({ 'sourceLayer': 'road' });
t.equal(roads.length, 3);

t.equal(tile.querySourceFeatures({ 'source-layer': 'road', filter: ['==', 'class', 'main'] }).length, 1);
t.equal(tile.querySourceFeatures({ 'source-layer': 'road', filter: ['!=', 'class', 'main'] }).length, 2);
t.equal(tile.querySourceFeatures({ 'sourceLayer': 'road', filter: ['==', 'class', 'main'] }).length, 1);
t.equal(tile.querySourceFeatures({ 'sourceLayer': 'road', filter: ['!=', 'class', 'main'] }).length, 2);

t.end();
});
Expand Down

0 comments on commit 9a5432d

Please sign in to comment.