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

Mapbox Vector Tiles loader #624

Merged
merged 6 commits into from
Jan 13, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Add JSON results, and tile properties for tests
jesusbotella committed Jan 13, 2020
commit e7a72fe9e82443ff1990cc1c54b12d0e4359d731
4 changes: 3 additions & 1 deletion modules/mapbox-vector-tile/src/mvt-loader.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ export const MapboxVectorTileLoader = {
binary: true,
testText: null,
options: {
mvt: {}
mvt: {
tileProperties: {}
}
}
};
12 changes: 11 additions & 1 deletion modules/mapbox-vector-tile/test/mvt/mvt-lines.spec.js
Original file line number Diff line number Diff line change
@@ -4,13 +4,23 @@ import test from 'tape-promise/tape';
import {MVTLoader} from '@loaders.gl/mapbox-vector-tile';
import {fetchFile, parse} from '@loaders.gl/core';

import decodedGeoJSON from '../results/decoded_mvt_lines.json';

const MVT_LINES_DATA_URL = '@loaders.gl/mapbox-vector-tile/test/data/lines_generated_5-16-11.mvt';

test('Lines MVT', async t => {
const response = await fetchFile(MVT_LINES_DATA_URL);
const mvtArrayBuffer = await response.arrayBuffer();

t.deepEqual(parse(mvtArrayBuffer, MVTLoader), {});
const loaderOptions = {
tileProperties: {
x: 16,
y: 11,
z: 5
}
};

t.deepEqual(parse(mvtArrayBuffer, MVTLoader, loaderOptions), decodedGeoJSON);

t.end();
});
12 changes: 11 additions & 1 deletion modules/mapbox-vector-tile/test/mvt/mvt-points.spec.js
Original file line number Diff line number Diff line change
@@ -4,13 +4,23 @@ import test from 'tape-promise/tape';
import {MVTLoader} from '@loaders.gl/mapbox-vector-tile';
import {fetchFile, parse} from '@loaders.gl/core';

import decodedGeoJSON from '../results/decoded_mvt_points.json';

const MVT_POINTS_DATA_URL = '@loaders.gl/mapbox-vector-tile/test/data/points_generated_2-0-1.mvt';

test('Point MVT', async t => {
const response = await fetchFile(MVT_POINTS_DATA_URL);
const mvtArrayBuffer = await response.arrayBuffer();

t.deepEqual(parse(mvtArrayBuffer, MVTLoader), {});
const loaderOptions = {
tileProperties: {
x: 0,
y: 1,
z: 2
}
};

t.deepEqual(parse(mvtArrayBuffer, MVTLoader, loaderOptions), decodedGeoJSON);

t.end();
});
12 changes: 11 additions & 1 deletion modules/mapbox-vector-tile/test/mvt/mvt-polygons.spec.js
Original file line number Diff line number Diff line change
@@ -4,13 +4,23 @@ import test from 'tape-promise/tape';
import {MVTLoader} from '@loaders.gl/mapbox-vector-tile';
import {fetchFile, parse} from '@loaders.gl/core';

import decodedGeoJSON from '../results/decoded_mvt_polygons.json';

const MVT_POLYGONS_DATA_URL = '@loaders.gl/mapbox-vector-tile/test/data/gadm_usa_3-0-3.mvt';

test('Polygons MVT', async t => {
const response = await fetchFile(MVT_POLYGONS_DATA_URL);
const mvtArrayBuffer = await response.arrayBuffer();

t.deepEqual(parse(mvtArrayBuffer, MVTLoader), {});
const loaderOptions = {
tileProperties: {
x: 0,
y: 3,
z: 3
}
};

t.deepEqual(parse(mvtArrayBuffer, MVTLoader, loaderOptions), decodedGeoJSON);

t.end();
});