Skip to content

EDSC-4654: Split bounding boxes that cross the anti-meridian to draw correctly on the map#2048

Merged
macrouch merged 1 commit into
mainfrom
EDSC-4654
May 14, 2026
Merged

EDSC-4654: Split bounding boxes that cross the anti-meridian to draw correctly on the map#2048
macrouch merged 1 commit into
mainfrom
EDSC-4654

Conversation

@macrouch
Copy link
Copy Markdown
Contributor

@macrouch macrouch commented May 12, 2026

Overview

What is the feature?

We already split polygons and lines across the anti-meridian, but we don't split bounding boxes, so they do not show up correctly when drawn on our map.

What is the Solution?

Spilt bounding boxes that cross the anti-meridian

What areas of the application does this impact?

Drawing granules on the map

Testing

This UAT granule crosses with bounding box spatial. It should be drawn as two bounding boxes instead of one crossing the whole globe

http://localhost:8080/search/granules?p=C1275699127-ASF&pg[0][v]=f&pg[0][id]=OPERA_L3_DIST-ALERT-S1_T60UXC_20250123T182734Z_20260331T123639Z_S1A_30_v0.1&pg[0][gsk]=-start_date&ee=uat&q=OPERA_L3_DIST-ALERT-S1_V1

Attachments

Incorrect:
Screenshot 2026-05-12 at 4 38 11 PM

Correct:
Screenshot 2026-05-12 at 4 38 26 PM
Screenshot 2026-05-12 at 4 38 20 PM

Checklist

  • I have added automated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Summary by CodeRabbit

  • Tests

    • Added a test covering bounding boxes that cross the antimeridian to validate normalized GeoJSON output.
  • Bug Fixes

    • Improved spatial normalization for antimeridian-crossing regions by splitting affected boxes and producing correct MultiPolygon coordinate sets.

Review Change Stack

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

Bundle Size Comparison

Full build details

> earthdata-search@1.0.0 build
> vite build

vite v6.4.2 building for production...
transforming...
✓ 4038 modules transformed.
rendering chunks...
computing gzip size...
static/dist/assets/logo-DBK9nthR.webp                                                      0.97 kB
static/dist/assets/logo-CZz0VEVL.webp                                                      1.14 kB
static/dist/assets/logo-Cycj4Zl7.webp                                                      1.33 kB
static/dist/assets/logo-U_2b2F1P.webp                                                      1.37 kB
static/dist/assets/logo-DrQyzv8O.webp                                                      1.54 kB
static/dist/assets/logo-BtXPiD8D.webp                                                      1.81 kB
static/dist/assets/logo-CBoC93bb.webp                                                      2.16 kB
static/dist/assets/logo-DjzD1LMz.webp                                                      2.39 kB
static/dist/assets/orange-bars-circle-D7AglAGM.webp                                        2.77 kB
static/dist/assets/logo-mTUaHBfB.webp                                                      3.11 kB
static/dist/assets/blue-bars-circle-BoIdEwIS.webp                                          3.67 kB
static/dist/assets/logo-BRHnty9h.webp                                                      4.09 kB
static/dist/assets/cryosphere-icon-DSWEvPIt.svg                                            4.11 kB │ gzip:   1.64 kB
static/dist/assets/logo-m8iUFUyE.webp                                                      4.26 kB
static/dist/assets/logo-BI7QOwpp.webp                                                      4.72 kB
static/dist/assets/logo-CjKnSDvE.webp                                                      7.06 kB
static/dist/index.html                                                                    13.22 kB │ gzip:   3.09 kB
static/dist/assets/plate_carree_earth_scaled-RfqGhO39.png                                 18.14 kB
static/dist/assets/tour-video-thumbnail-BxsZeqvq.webp                                     18.84 kB
static/dist/assets/plate_carree_earth_scaled@2x-BIj0Wstc.png                              45.03 kB
static/dist/assets/image-unavailable-CcXgOtQr.svg                                         52.20 kB │ gzip:  20.77 kB
static/dist/assets/earthdata-search-og-image-Cs5RILJ1.webp                                92.82 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-800x600@2x-DdSR_KXb.webp      132.70 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-2560x1440@2x-CZbMhKXi.webp    224.17 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-800x600@2x-DFWWupvf.webp      381.18 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-2560x1440@2x-BwDp59vN.webp    464.37 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-2560x1440@2x-CeYlmMCD.webp    737.44 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-2560x1440@2x-tQ4uTIyn.webp  1,255.87 kB
static/dist/assets/MODIS-Terra-Swirling-Clouds-In-Atlantic-2560x1440@2x-BqbXRJmQ.webp  1,516.81 kB
static/dist/assets/AdminRetrieval-nNSujMnn.css                                             0.06 kB │ gzip:   0.08 kB
static/dist/assets/AdminPreferencesMetrics-GkGryAtC.css                                    0.10 kB │ gzip:   0.11 kB
static/dist/assets/ChunkedOrderModal-DIli9vpQ.css                                          0.11 kB │ gzip:   0.10 kB
static/dist/assets/TooManyPointsModal-D8ufPyjz.css                                         0.14 kB │ gzip:   0.12 kB
static/dist/assets/AdminRetrievalsMetrics-CT7bgXZt.css                                     0.22 kB │ gzip:   0.13 kB
static/dist/assets/AdminPage-D19229XC.css                                                  0.23 kB │ gzip:   0.16 kB
static/dist/assets/ContactInfo-C7Pr11wu.css                                                0.28 kB │ gzip:   0.18 kB
static/dist/assets/useDeleteSubscription-YPccXDF3.css                                      0.46 kB │ gzip:   0.23 kB
static/dist/assets/ShapefileDropzoneContainer-BG7JE7Dj.css                                 0.53 kB │ gzip:   0.26 kB
static/dist/assets/GranuleFiltersContainer-CfwvM6Mp.css                                    0.59 kB │ gzip:   0.27 kB
static/dist/assets/ShapefileUploadModal-CMzmPyoZ.css                                       0.66 kB │ gzip:   0.32 kB
static/dist/assets/Preferences-DGkx-xES.css                                                0.68 kB │ gzip:   0.24 kB
static/dist/assets/Skeleton-DtMOdDsM.css                                                   0.88 kB │ gzip:   0.34 kB
static/dist/assets/TextWindowActions-aNefZur7.css                                          0.91 kB │ gzip:   0.38 kB
static/dist/assets/RelatedCollection-BaShQZdF.css                                          0.93 kB │ gzip:   0.40 kB
static/dist/assets/CollectionDetailsHighlights-CHDYEfjF.css                                1.24 kB │ gzip:   0.44 kB
static/dist/assets/GranuleResultsHighlights-BIY0O9bb.css                                   1.24 kB │ gzip:   0.41 kB
static/dist/assets/Subscriptions-CYrzsucf.css                                              1.26 kB │ gzip:   0.40 kB
static/dist/assets/EDSCModalContainer-D_JXXJBf.css                                         1.77 kB │ gzip:   0.59 kB
static/dist/assets/AdminProjects-CZeT2VXI.css                                              1.98 kB │ gzip:   0.46 kB
static/dist/assets/AdminRetrievals-DIdJ2AD-.css                                            2.02 kB │ gzip:   0.46 kB
static/dist/assets/DownloadHistory-C2TrZbdc.css                                            2.05 kB │ gzip:   0.47 kB
static/dist/assets/DeprecatedParameterModal-nutVvbLm.css                                   2.12 kB │ gzip:   0.93 kB
static/dist/assets/Projects-5m-RoZO0.css                                                   2.13 kB │ gzip:   0.51 kB
static/dist/assets/EchoForm-VVUehB8V.css                                                   3.47 kB │ gzip:   1.06 kB
static/dist/assets/SearchTour-AJompJPK.css                                                 4.82 kB │ gzip:   1.22 kB
static/dist/assets/index-BOElThXL.css                                                      6.47 kB │ gzip:   1.24 kB
static/dist/assets/OrderStatus-qyLNmnfS.css                                                8.49 kB │ gzip:   1.93 kB
static/dist/assets/createSpatialDisplay-CiT4b-tQ.css                                      10.62 kB │ gzip:   2.41 kB
static/dist/assets/MapContainer-GerI1QoD.css                                              17.00 kB │ gzip:   5.89 kB
static/dist/assets/Project-RbLZgqcX.css                                                   20.04 kB │ gzip:   4.07 kB
static/dist/assets/Search-DWJQ45Qd.css                                                    69.43 kB │ gzip:  10.66 kB
static/dist/assets/index-DvsUNaze.css                                                    339.58 kB │ gzip: 109.39 kB
static/dist/assets/logo-BHeuky8i.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-C2M9lK3U.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-BbJQ0fWs.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-CW6PQqmQ.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-CM8gX-og.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-CGJHAKVD.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-DOLER09h.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-C6Ht_tBx.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-J7t-4CBp.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-CxvnVTz2.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-C9HDQHSy.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-IHV3gtAZ.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-Dedvhxzp.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo--kH-hKRS.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-Z4bYAKVs.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-nOuRrv94.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-DIxV4RPX.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/logo-uABdcgsF.js                                                        0.06 kB │ gzip:   0.08 kB
static/dist/assets/pluralize-49vSaAHF.js                                                   0.08 kB │ gzip:   0.09 kB
static/dist/assets/accessMethodTypes-CY5JnOnd.js                                           0.13 kB │ gzip:   0.14 kB
static/dist/assets/commafy-BfQYQOA4.js                                                     0.14 kB │ gzip:   0.14 kB
static/dist/assets/requestDebounceDuration-B92It3cW.js                                     0.16 kB │ gzip:   0.11 kB
static/dist/assets/subscriptions-Dm5gdJc_.js                                               0.41 kB │ gzip:   0.21 kB
static/dist/assets/Table-CNBXssMX.js                                                       0.60 kB │ gzip:   0.39 kB
static/dist/assets/humanizedQueryValueFormatters-CIZcasg0.js                               1.00 kB │ gzip:   0.54 kB
static/dist/assets/TooManyPointsModal-CRLkaCEo.js                                          1.10 kB │ gzip:   0.58 kB
static/dist/assets/DownloadsLayout-LAL8JlQR.js                                             1.12 kB │ gzip:   0.36 kB
static/dist/assets/metricsDataAccess-B0dv9eSs.js                                           1.26 kB │ gzip:   0.35 kB
static/dist/assets/AdminLayout-Bn41kIZs.js                                                 1.45 kB │ gzip:   0.48 kB
static/dist/assets/index-0zhIlf06.js                                                       1.64 kB │ gzip:   0.94 kB
static/dist/assets/useLazyQuery-P7OZD-zF.js                                                1.70 kB │ gzip:   0.89 kB
static/dist/assets/DefinitionList-Bb7nrj2G.js                                              1.85 kB │ gzip:   0.56 kB
static/dist/assets/AdminPage-CrXfWXVQ.js                                                   1.98 kB │ gzip:   0.51 kB
static/dist/assets/Skeleton-xDUn125D.js                                                    2.23 kB │ gzip:   0.71 kB
static/dist/assets/KeyboardShortcutsModal-Bvpf27bd.js                                      2.36 kB │ gzip:   0.85 kB
static/dist/assets/AdminIndex-BWaOUuuY.js                                                  2.69 kB │ gzip:   0.87 kB
static/dist/assets/useCreateRetrieval-Dmsw4J0g.js                                          3.31 kB │ gzip:   1.59 kB
static/dist/assets/DeprecatedParameterModal-CYljy7E6.js                                    3.42 kB │ gzip:   1.30 kB
static/dist/assets/AdminProject-FR7_NdmV.js                                                3.66 kB │ gzip:   1.03 kB
static/dist/assets/EditSubscriptionModal-4jf8zQzV.js                                       3.73 kB │ gzip:   1.28 kB
static/dist/assets/ChunkedOrderModal-CBSRSOUg.js                                           4.14 kB │ gzip:   1.36 kB
static/dist/assets/ShapefileUploadModal-CANFC6AE.js                                        4.97 kB │ gzip:   1.00 kB
static/dist/assets/AboutCSDAModal-DHHXTcOc.js                                              5.18 kB │ gzip:   1.19 kB
static/dist/assets/AdminPreferencesMetrics-DhgRZaW4.js                                     5.66 kB │ gzip:   1.05 kB
static/dist/assets/EarthdataDownloadRedirect-vuO8Oueu.js                                   5.98 kB │ gzip:   1.11 kB
static/dist/assets/EDSCModalContainer-BqEsm1Xd.js                                          7.38 kB │ gzip:   1.72 kB
static/dist/assets/GranuleResultsHighlights-BgQl2RDi.js                                    7.92 kB │ gzip:   1.61 kB
static/dist/assets/DownloadHistory-DyLTFXqS.js                                             7.99 kB │ gzip:   1.70 kB
static/dist/assets/CollectionDetailsHighlights-CZbVQ9Ki.js                                 9.97 kB │ gzip:   1.27 kB
static/dist/assets/useDeleteSubscription-C2qCZ_jT.js                                      10.57 kB │ gzip:   2.72 kB
static/dist/assets/Modal-y1ptS2VA.js                                                      10.75 kB │ gzip:   4.05 kB
static/dist/assets/AdminRetrieval-BEO93Sib.js                                             10.84 kB │ gzip:   2.13 kB
static/dist/assets/AdminProjects-Gn3Pl3db.js                                              10.85 kB │ gzip:   1.93 kB
static/dist/assets/RelatedCollection-BKiBQ9Dz.js                                          11.09 kB │ gzip:   4.14 kB
static/dist/assets/AboutCwicModal-WSEMmhXq.js                                             11.28 kB │ gzip:   2.26 kB
static/dist/assets/AdminRetrievals-Wp7_iXQa.js                                            11.43 kB │ gzip:   1.99 kB
static/dist/assets/Projects-ChjLvabb.js                                                   11.66 kB │ gzip:   2.15 kB
static/dist/assets/Subscriptions-BGVO0_L-.js                                              13.24 kB │ gzip:   2.16 kB
static/dist/assets/ContactInfo-B-uEaI0Z.js                                                13.41 kB │ gzip:   1.93 kB
static/dist/assets/AdminRetrievalsMetrics-Bo6ejsai.js                                     15.01 kB │ gzip:   2.09 kB
static/dist/assets/index-BA35vhJ8.js                                                      35.34 kB │ gzip:  12.82 kB
static/dist/assets/GranuleFiltersContainer-BB_aDKPF.js                                    39.70 kB │ gzip:   6.76 kB
static/dist/assets/styles-Dfd5EqNk.js                                                     60.27 kB │ gzip:  18.66 kB
static/dist/assets/moment-BAtM24Ew.js                                                     60.92 kB │ gzip:  19.77 kB
static/dist/assets/createSpatialDisplay-DY5sc-iU.js                                       81.69 kB │ gzip:  18.54 kB
static/dist/assets/lodash-DO8XiTt0.js                                                     92.24 kB │ gzip:  31.91 kB
static/dist/assets/OrderStatus-0YY1zkXk.js                                               108.81 kB │ gzip:  20.22 kB
static/dist/assets/EchoForm-B_JcUAnD.js                                                  108.86 kB │ gzip:  33.76 kB
static/dist/assets/ShapefileDropzoneContainer-BL0SJ8TA.js                                119.75 kB │ gzip:  40.14 kB
static/dist/assets/SearchTour-puvGsQVC.js                                                139.43 kB │ gzip:  37.02 kB
static/dist/assets/edscUtils-Bx40oR22.js                                                 141.73 kB │ gzip:  46.95 kB
static/dist/assets/Preferences-Dti-5FCw.js                                               367.69 kB │ gzip: 115.32 kB
static/dist/assets/Project-DFiwrEa9.js                                                   406.82 kB │ gzip: 119.39 kB
static/dist/assets/react-BBFNYsKV.js                                                     409.73 kB │ gzip: 127.90 kB
static/dist/assets/Search-CFxQQ80P.js                                                    660.96 kB │ gzip: 155.54 kB
static/dist/assets/index-C8nA9yFp.js                                                   1,129.05 kB │ gzip: 350.08 kB
static/dist/assets/MapContainer-B9uP2M_j.js                                            1,332.05 kB │ gzip: 270.48 kB
✓ built in 37.00s

The full bundle is larger than main by 0.11 kB. ❗

The index.js is larger than main by 0.11 kB. ❗

Run npx vite-bundle-visualizer to review the bundle in more detail.

File Main Branch Diff
Total 11023.15 kB 11023.26 kB 0.11 kB
index.js 1165.92 kB 1166.03 kB 0.11 kB
index.js (gzip) 363.8 kB 363.84 kB 0.04 kB
index.css 346.05 kB 346.05 kB 0 kB
index.css (gzip) 110.63 kB 110.63 kB 0 kB
Number of files 139 139 0
Build Time 34.11 s 37 s 2.89 s

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.80%. Comparing base (907ed29) to head (bb237d1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2048   +/-   ##
=======================================
  Coverage   95.80%   95.80%           
=======================================
  Files         753      753           
  Lines       17427    17431    +4     
  Branches     4867     4916   +49     
=======================================
+ Hits        16696    16700    +4     
  Misses        680      680           
  Partials       51       51           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@macrouch
Copy link
Copy Markdown
Contributor Author

@coderabbitai help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@macrouch
Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03c886fe-6f24-4543-ad30-3af2da5d7f9b

📥 Commits

Reviewing files that changed from the base of the PR and between 5832408 and bb237d1.

📒 Files selected for processing (2)
  • static/src/js/util/map/__tests__/normalizeSpatial.test.ts
  • static/src/js/util/map/normalizeSpatial.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • static/src/js/util/map/tests/normalizeSpatial.test.ts
  • static/src/js/util/map/normalizeSpatial.ts

📝 Walkthrough

Walkthrough

Splits bounding-box polygons at antimeridian crossings, interpolates each interior polygon, and returns a MultiPolygon; adds a test for a box spanning longitudes near +178 and -179 verifying two coordinate rings around +180 and -180.

Changes

Antimeridian crossing handling

Layer / File(s) Summary
Split bbox at antimeridian and interpolate interiors
static/src/js/util/map/normalizeSpatial.ts
Box-derived polygons crossing the antimeridian are now split via dividePolygon; each interior polygon is converted to coordinate arrays, interpolated with interpolateBoxPolygon (tolerance 250, maxDepth 6), and appended to the multipolygons result.
Test for box crossing antimeridian
static/src/js/util/map/__tests__/normalizeSpatial.test.ts
Adds a test that supplies a boxes string straddling +178 and -179 longitudes and asserts the returned Feature is a MultiPolygon with two coordinate sets reaching +180 and -180 respectively.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Over the line where longitudes part,
I bound and nudge each polygon's heart,
Split at the antimeridian's seam,
Interpolate edges, stitch the dream,
Tests cheer—multipolygons gleam!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: splitting bounding boxes that cross the anti-meridian for correct map rendering.
Description check ✅ Passed The description follows the template structure with all major sections completed, including overview, solution, impact, testing details with UAT granule reference, visual attachments, and a fully checked checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch EDSC-4654

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@static/src/js/util/map/normalizeSpatial.ts`:
- Around line 277-289: The divided polygon interiors from dividePolygon are not
guaranteed to be closed before interpolation, which can create invalid rings; in
the loop where dividedPolygon is mapped to dividedPolygonCoordinates and passed
to interpolateBoxPolygon (the block that pushes into multiPolygons), ensure each
dividedPolygonCoordinates is a closed ring by checking if the first coordinate
equals the last and, if not, push a copy of the first coordinate to the end
before calling interpolateBoxPolygon; update the code around the dividePolygon
-> dividedPolygonCoordinates -> interpolateBoxPolygon flow so every polygon
passed to interpolateBoxPolygon is closed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3e5313c5-3cef-4944-adfc-9085ecedbe9b

📥 Commits

Reviewing files that changed from the base of the PR and between e50db15 and 5832408.

📒 Files selected for processing (2)
  • static/src/js/util/map/__tests__/normalizeSpatial.test.ts
  • static/src/js/util/map/normalizeSpatial.ts

Comment thread static/src/js/util/map/normalizeSpatial.ts
@macrouch macrouch merged commit ec01c38 into main May 14, 2026
61 of 70 checks passed
@macrouch macrouch deleted the EDSC-4654 branch May 14, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants