Skip to content

Commit

Permalink
refactor(protected-areas): avoid cartesian result produced due to wor…
Browse files Browse the repository at this point in the history
…king on repo
  • Loading branch information
kgajowy committed Sep 16, 2021
1 parent fb62e57 commit 2ab2fe6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';

import { InjectRepository } from '@nestjs/typeorm';
import { Brackets, Repository, getConnection } from 'typeorm';
import { Brackets, Repository } from 'typeorm';
import { nominatim2bbox } from '@marxan-geoprocessing/utils/bbox.utils';
import { TileService } from '@marxan-geoprocessing/modules/tile/tile.service';

Expand Down Expand Up @@ -38,7 +38,7 @@ export class ProtectedAreasTilesService {
const inputProjection = 4326;
const attributes = 'full_name, status, wdpaid, iucn_cat';
const table = 'wdpa';
const query = getConnection().createQueryBuilder();
const query = this.areas.manager.createQueryBuilder();

query
.select(`ST_AsMVT(tile.*, 'layer0', ${extent}, 'mvt_geom')`, 'mvt')
Expand Down
5 changes: 2 additions & 3 deletions api/apps/geoprocessing/test/tiles/protected-area.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ export const getFixtures = async () => {
(feature) => feature.properties.full_name === customPa.name,
);

// TODO: fixme: original mvt creation produces multiplied layers
expect(customFeature.length).toBeGreaterThanOrEqual(1);
// expect(features.length).toEqual(10);
expect(customFeature.length).toEqual(1);
expect(features.length).toEqual(7);

/**
* TODO maybe:
Expand Down

0 comments on commit 2ab2fe6

Please sign in to comment.