Skip to content

Commit

Permalink
renamce GEOM_STORED_VALUE
Browse files Browse the repository at this point in the history
  • Loading branch information
padawannn committed Sep 26, 2024
1 parent ae5e9a2 commit 3359811
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
30 changes: 15 additions & 15 deletions packages/react-core/__tests__/filters/tileFeatures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { geojsonToBinary } from '@loaders.gl/gis';
import { TILE_FORMATS, tileFeatures } from '../../src';
import * as transformToTileCoords from '../../src/utils/transformToTileCoords';
import * as transformTileCoordsToWGS84 from '../../src/utils/transformTileCoordsToWGS84';
import { GEOM_STORED_VALUE } from '../../src/filters/tileFeaturesGeometries';
import { FEATURE_GEOM_PROPERTY } from '../../src/filters/tileFeaturesGeometries';

describe('viewport features with binary mode', () => {
const viewport = [-10, -10, 10, 10]; // west - south - east - north
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: linestrings[i].geometry
[FEATURE_GEOM_PROPERTY]: linestrings[i].geometry
}))
);
});
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: {
[FEATURE_GEOM_PROPERTY]: {
coordinates: multilinestrings[i].geometry.coordinates[0],
type: 'LineString'
}
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: polygons[i].geometry
[FEATURE_GEOM_PROPERTY]: polygons[i].geometry
}))
);
});
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: {
[FEATURE_GEOM_PROPERTY]: {
coordinates: multipolygons[i].geometry.coordinates[0],
type: 'Polygon'
}
Expand Down Expand Up @@ -300,7 +300,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: points[i].geometry
[FEATURE_GEOM_PROPERTY]: points[i].geometry
}))
);
});
Expand Down Expand Up @@ -344,7 +344,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: linestrings[i].geometry
[FEATURE_GEOM_PROPERTY]: linestrings[i].geometry
}))
);
});
Expand Down Expand Up @@ -388,7 +388,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: {
[FEATURE_GEOM_PROPERTY]: {
coordinates: multilinestrings[i].geometry.coordinates[0],
type: 'LineString'
}
Expand Down Expand Up @@ -435,7 +435,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: polygons[i].geometry
[FEATURE_GEOM_PROPERTY]: polygons[i].geometry
}))
);
});
Expand Down Expand Up @@ -482,7 +482,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: {
[FEATURE_GEOM_PROPERTY]: {
coordinates: multipolygons[i].geometry.coordinates[0],
type: 'Polygon'
}
Expand Down Expand Up @@ -550,7 +550,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: linestrings[i].geometry
[FEATURE_GEOM_PROPERTY]: linestrings[i].geometry
}))
);
});
Expand Down Expand Up @@ -599,7 +599,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: points[i].geometry
[FEATURE_GEOM_PROPERTY]: points[i].geometry
}))
);
});
Expand Down Expand Up @@ -648,7 +648,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: points[i].geometry
[FEATURE_GEOM_PROPERTY]: points[i].geometry
}))
);
});
Expand Down Expand Up @@ -696,7 +696,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: points[i].geometry
[FEATURE_GEOM_PROPERTY]: points[i].geometry
}))
);
});
Expand Down Expand Up @@ -748,7 +748,7 @@ describe('viewport features with binary mode', () => {
expect(properties).toEqual(
expectedProperties.map((expected, i) => ({
...expected,
[GEOM_STORED_VALUE]: points[i].geometry
[FEATURE_GEOM_PROPERTY]: points[i].geometry
}))
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export default function tileFeaturesGeometries(arg: {
options?: { storeGeometry: boolean };
}): TileFeaturesResponse;

export const GEOM_STORED_VALUE: string;
export const FEATURE_GEOM_PROPERTY: string;
4 changes: 2 additions & 2 deletions packages/react-core/src/filters/tileFeaturesGeometries.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import transformToTileCoords from '../utils/transformToTileCoords';
import { TILE_FORMATS } from '../types';
import transformTileCoordsToWGS84 from '../utils/transformTileCoordsToWGS84';

export const GEOM_STORED_VALUE = '__geomValue';
export const FEATURE_GEOM_PROPERTY = '__geomValue';

const GEOMETRY_TYPES = Object.freeze({
Point: 0,
Expand Down Expand Up @@ -49,7 +49,7 @@ function processTileFeatureProperties({

// Only save geometry if necessary
if (storeGeometry) {
properties[GEOM_STORED_VALUE] =
properties[FEATURE_GEOM_PROPERTY] =
tileFormat === TILE_FORMATS.MVT
? transformTileCoordsToWGS84(geometry, bbox)
: geometry;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export {
applyFilters as _applyFilters
} from './filters/Filter';

export { GEOM_STORED_VALUE } from './filters/tileFeaturesGeometries'
export { FEATURE_GEOM_PROPERTY } from './filters/tileFeaturesGeometries'
export { tileFeatures } from './filters/tileFeatures';
export { geojsonFeatures } from './filters/geojsonFeatures';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export {
applyFilters as _applyFilters
} from './filters/Filter';

export { GEOM_STORED_VALUE } from './filters/tileFeaturesGeometries';
export { FEATURE_GEOM_PROPERTY } from './filters/tileFeaturesGeometries';
export { tileFeatures } from './filters/tileFeatures';
export { geojsonFeatures } from './filters/geojsonFeatures';

Expand Down

0 comments on commit 3359811

Please sign in to comment.