-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
"geometry-type" to identify Multi- features #519
Conversation
- Add mapping from geometry-type to $type - Remove caching to geometry analysis results
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #519 +/- ##
==========================================
+ Coverage 92.70% 92.73% +0.03%
==========================================
Files 105 105
Lines 4648 4681 +33
Branches 1313 1322 +9
==========================================
+ Hits 4309 4341 +32
- Misses 339 340 +1 ☔ View full report in Codecov by Sentry. |
Reverted one lint "fix" that caused test failure
Resolves maplibre/maplibre-gl-js#3516 |
The result from the poll in #536 is that 8 out of 10 people voted for:
while only 2 out of 10 voted for:
I am in favor of the second option with the simple reason that we do not have a good way of informing our users that there has been a breaking style spec change. Up until today, when I as a map designer make a style sheet there have been two options:
If we start introducing breaking changes in the style specification we will have to add a third point to this list of options which is:
There are plenty of bad things in the MapLibre Style Specification and I would love to through away entirely things like |
I generally agree, except that this case is different - $type is used in most cases and there's no good way to get a multi geometry type. I believe that this case makes sense. The community had voted so. |
Thanks for the feedback, @HarelM. I doubt that we actually have a good way of knowing if people use I remember we did have some other breaking change in the style spec where we fixed something with colors, do you remember what the other breaking changes were? Fixing bugs in the style spec sounds attractive, but keep in mind how old this toolkit now is and how many people rely on it. It is like with any other old library. People know the bugs and the expect them to be there. If you fix the bugs, they will say why did you change the behavior - the old way was fine for us and now we have extra work because you made the code look better. Maybe I am too conservative and we can start to be more dynamic with how we handle the spec, I don't know, but I feel like it would be much better for our users to freeze the behavior and leave bugs and bad aesthetics where they are... |
They can still do that by not upgrading to the latest and greatest. Color was one thing and text along a line was another. Also collision boxes, which are still a bit broken, will be improved in the coming releases. |
None of the styles available in Maputnik uses |
Related to maplibre/maplibre-style-spec#519 and maplibre/maplibre-gl-js#3516 According to the Style Spec, `["geometry-type"]` is expected to distinguish between LineString and MultiLineString, while `"$type"` does not. For the transportation layer, the distinction is harmful. All of OMT style layers, except these two, use `"$type"`.
Related to maplibre/maplibre-style-spec#519 and maplibre/maplibre-gl-js#3516 According to the Style Spec, `["geometry-type"]` is expected to distinguish between LineString and MultiLineString, while `"$type"` does not. For the transportation layer, the distinction is harmful. All of OMT style layers, except these two, use `"$type"`.
@zstadler any chance you can update this PR with the latest changes? |
Is $type a deprecated expression type that can't be used in "newer" expressions? |
Yes. |
Use `return` often instead of nesting condisions
14b1c0f
to
ebe3bc4
Compare
Make comments part of the code
I've added some minor comments around the wording in the comments, looks good otherwise, thanks! |
Co-authored-by: Harel M <[email protected]>
What does this PR do
The style spec for
["geometry-type"]
says it "Gets the feature's geometry type:Point
,MultiPoint
,LineString
,MultiLineString
,Polygon
,MultiPolygon
." However the implementation for tile-based geometries was identical to that of$type
and the possible values werePoint
,LineString
,Polygon
. This also applied to GeoJSON sources in Maplibre-GL-JS because they are converted and stored internally as tile-based geometries.The PR adds aligns the implementation of
["geometry-type"]
with its spec and adds the distinction betweenPoint
andMultiPoint
, betweenLineString
andMultiLineString
, and betweenPolygon
andMultiPolygon
for tile-based geometries.Launch Checklist
CHANGELOG.md
under the## main
section.