Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Adds CurvedLineSymbolizer #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

ibesora
Copy link

@ibesora ibesora commented Oct 25, 2021

Adds a new symbolizer to be used with curved labels.
Supports the same properties as LineLabelSymbolizer

{
    //water-line-label
    dataLayer: `natural_label`,
    symbolizer: new CurvedLabelSymbolizer({
      label_props: ["name_en", "name"],
      fill: params.waterPointLabelColor1,
      fontFamily: SansSerifRegular.fontFamily,
      fontSize: 20,
      letterSpacing: 0.25,
    }),
  },

image

image

Closes issue #38

@@ -18,6 +18,8 @@ export interface Label {
draw: (ctx: any, drawExtra?: DrawExtra) => void;
deduplicationKey?: string;
deduplicationDistance?: number;
allowCollisions?: boolean;
Copy link

Choose a reason for hiding this comment

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

is there a way to avoid adding these two keys? at the unit of a single Label, a Label's multiple bounding boxes are allowed to collide already - this happens with line label cells. So if a curved label can be expressed as one Label, this check shouldn't be necessary.

Copy link
Author

Choose a reason for hiding this comment

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

Looking into it. I added that because it was removing parts of the text

@bdon
Copy link

bdon commented Oct 26, 2021

What if we enforce a maximum curvature of the segment? I'm testing it against the layer physical_line in the protomaps tiles and it works fine for some and less for others:
Screen Shot 2021-10-26 at 10 28 20 AM

@ibesora
Copy link
Author

ibesora commented Oct 26, 2021

What if we enforce a maximum curvature of the segment? I'm testing it against the layer physical_line in the protomaps tiles and it works fine for some and less for others: Screen Shot 2021-10-26 at 10 28 20 AM

Yup, it makes sense because there are angles that can be difficult to solve. Is there an easy way I can reproduce what you are seeing?

@bdon
Copy link

bdon commented Oct 26, 2021

Use the protomaps tiles, demo api key on localhost, data layer physical_line

@ibesora ibesora force-pushed the master branch 2 times, most recently from a83db03 to 3e38478 Compare February 15, 2022 07:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants