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

With BBox present there is no need to simplify. #283

Merged
merged 2 commits into from
Jun 21, 2021

Conversation

aagm
Copy link
Member

@aagm aagm commented Jun 18, 2021

Substitute this line for a meaningful title for your changes

Overview

Please write a description. If the PR is hard to understand, provide a quick explanation of the code.

Designs

Link to the related design prototypes (if applicable)

Testing instructions

Please explain how to test the PR: ID of a dataset, steps to reach the feature, etc.

Feature relevant tickets

Link to the related task manager tickets


Checklist before submitting

  • Meaningful commits and code rebased on develop.
  • If this PR adds feature that should be tested for regressions when
    deploying to staging/production, please add brief testing instructions
    to the deploy checklist (docs/deployment-checklist.md)
  • Update CHANGELOG file

@vercel
Copy link

vercel bot commented Jun 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

marxan – ./app

🔍 Inspect: https://vercel.com/vizzuality1/marxan/2vSMdu2R6AuHejUoD9Fc2qcqFznW
✅ Preview: https://marxan-git-fix-geoprocessingremove-simplific-070959-vizzuality1.vercel.app

marxan-storybook – ./app

🔍 Inspect: https://vercel.com/vizzuality1/marxan-storybook/6kt5zuemUA8qXijCUUFBdFXDBD1T
✅ Preview: https://marxan-storybook-git-fix-geoprocessingremove-17b71c-vizzuality1.vercel.app

@aagm aagm requested a review from hotzevzl June 18, 2021 13:28
@aagm aagm self-assigned this Jun 18, 2021
@aagm aagm added API Everything related the api Ready to review PR ready to review labels Jun 18, 2021
@@ -111,7 +114,7 @@ export class PlanningUnitsService {
ST_Transform(ST_TileEnvelope(${z}, ${x}, ${y}), 3857))).geom as the_geom)`;
// (so we are checking that the pixel ration is < 8 px)
// If so the shape we are getting is down the optimal to visualize it
if (ratioPixelExtent < 8) {
if (ratioPixelExtent < 8 && !filters?.bbox) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I would add a tiny explanation for those like me who don't have much of a clue about what's going on here as to why we don't need to use the second query if the pixel ratio is within the limit or if we have a bbox 😬

also (but this is veeery much my preference for ternary operator), this could be written (more concisely in my opinion) as

const query = (ratioPixelExtent < 8 && !filters?.bbox) ?
  `( SELECT row_number() over() as id, st_centroid((${gridShape}(${gridSize}, \
        ST_Transform(ST_TileEnvelope(${z}, ${x}, ${y}), 3857))).geom ) as the_geom )` :
  `( SELECT row_number() over() as id, (${gridShape}(${gridSize}, \
                    ST_Transform(ST_TileEnvelope(${z}, ${x}, ${y}), 3857))).geom as the_geom)`;

@aagm aagm force-pushed the fix/geoprocessing/remove-simplification-if-bbox-present branch from a9cde2d to 2e3673d Compare June 21, 2021 08:45
@aagm aagm merged commit 6e90c4a into develop Jun 21, 2021
@aagm aagm deleted the fix/geoprocessing/remove-simplification-if-bbox-present branch August 2, 2021 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Everything related the api Ready to review PR ready to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants