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

made the v5 geometry type change more explicitely documented. #5317

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

CommanderStorm
Copy link
Contributor

As discussed in the discussion just now, I think a bit of a longer wording for this might be more clear in how it breaks.
Currently this point is somewhat simple to gloss over if reading quickly ^^

To be clear:
Would be fine with closing this PR if you think the docs are currently sufficient.
We are on the same team ^^

PS: Could we also change the release notes here?

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

Sorry, something went wrong.

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.83%. Comparing base (0061f85) to head (80288dc).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5317      +/-   ##
==========================================
- Coverage   91.84%   91.83%   -0.01%     
==========================================
  Files         282      282              
  Lines       38908    38908              
  Branches     6829     6822       -7     
==========================================
- Hits        35735    35733       -2     
- Misses       3046     3047       +1     
- Partials      127      128       +1     

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

@CommanderStorm CommanderStorm requested a review from HarelM January 8, 2025 20:38

Verified

This commit was signed with the committer’s verified signature.
arthurpar06 Arthur Parienté
@HarelM
Copy link
Collaborator

HarelM commented Jan 8, 2025

Looks like npm and girhub aren't communicating well now.
I'll update the release notes as well with this change.

Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

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

Thanks!

@HarelM HarelM enabled auto-merge (squash) January 8, 2025 20:46
@HarelM HarelM merged commit dd054e3 into maplibre:main Jan 8, 2025
16 of 17 checks passed
@slaviczavik
Copy link

Just a note the ["==", "$type", "Polygon"] expression cannot be used together with the expression syntax defined by ExpressionSpecification type. What is workaround for this?

@HarelM
Copy link
Collaborator

HarelM commented Jan 9, 2025

in, match, case can be used as well, it's just a bit longer and usually $type is enough... Feel free to improve the comment if you feel it is still lacking.

@slaviczavik
Copy link

in, match, case can be used as well, it's just a bit longer and usually $type is enough... Feel free to improve the comment if you feel it is still lacking.

Thanks for quick answer. I would like to use expression with match operator something like this:

[
  "all",
  [
    "==",
    [
      "geometry-type"
    ],
    "Polygon"
  ],
  [
    "match",
    [
      "get",
      "brunnel"
    ],
    [
      "bridge",
      "tunnel"
    ],
    true,
    false
  ]
]

What would be correct syntax with $type attribute?

@HarelM
Copy link
Collaborator

HarelM commented Jan 9, 2025

I meant to say that you can replace $type with in, match, case to support "non-deprecated" expressions.
Something like the following, I haven't tested it so it might be a bit off...

-[
-    "==",
-    [
-      "geometry-type"
-    ],
-    "Polygon"
-  ],
+[
+    "in",
+    [
+      "geometry-type"
+    ],
+    [["literal"], ["Polygon", "MultiPolygon"]]
+  ],

@prusswan
Copy link

prusswan commented Jan 9, 2025

Could the docs/examples be updated as well? I also ended up with @HarelM's last example, it looks rather convoluted but more understandable than the $type version which seems to be getting deprecated (but why?).

$type: the feature type. This key may be used with the "==","!=", "in", and "!in" operators. Possible values are "Point", "LineString", and "Polygon".

This does not seem to explain how/why $type can work with multi geometry types in the way that it does.

@CommanderStorm CommanderStorm deleted the patch-1 branch January 9, 2025 13:59
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.

None yet

4 participants