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

Restore rendering of text labels on points #3878

Merged
merged 3 commits into from Sep 20, 2019

Conversation

jeisenbe
Copy link
Collaborator

@jeisenbe jeisenbe commented Sep 8, 2019

Fixes #3876
Fixes #3868

Changes proposed in this pull request:

  • Restore rendering of text labels on points, including landcover and islands

Explanation:

Prior to #3764 most features in landcover had text labels rendered at high zoom level when tagged on nodes. For islands this was the case before #1444. It appears that text labels of the name for points was unintentionally lost in these two PRs.
This PR restores this rendering by adding a check for way_pixels=null.
Suprisingly, way_pixels != null has to be checked for each instance of [way_pixels > 12000] or else the points render with the large lancover text size

Test rendering:

Old rendering, before #3764 but after #1444
z17-landcover-poi-before-3764

Current test rendering:
z17-landcover-poi-text-current-rendering

After this PR:
z17-landcover-poi-test-after

Prior to gravitystorm#3764 most features in `landcover` had text labels rendered at high zoom level when tagged on nodes.
This PR restores this rendering by adding a check for way_pixels=null.
Suprisingly, way_pixels != null has to be checked or else the points render with the large lancover text size
@kocio-pl
Copy link
Collaborator

kocio-pl commented Sep 8, 2019

I remember that you have made similar rendering tests for different features. Do you have the idea how could we make a standard (possibly automated) test for indicating visual changes in every feature we render, to avoid most basic problems, like this one?

@jeisenbe
Copy link
Collaborator Author

jeisenbe commented Sep 8, 2019 via email

@kocio-pl
Copy link
Collaborator

kocio-pl commented Sep 8, 2019

I mean a list of objects and dumb automated file diff, not high level tests. It is trivial to catch the difference between tile with object and without it. The idea is to do it for every commit (possibly by Travis), so we do not have to remember about running it.

@jeisenbe
Copy link
Collaborator Author

jeisenbe commented Sep 8, 2019 via email

@kocio-pl
Copy link
Collaborator

kocio-pl commented Sep 8, 2019

@pnorman You have some experience with Travis checks, do you have some idea for implementing such test?

Maybe every feature should be in separate file, to make diffs atomic. If anybody else has some suggestion how can we deal with it, it would be great.

@jeisenbe jeisenbe added the text label Sep 9, 2019
@pnorman
Copy link
Collaborator

pnorman commented Sep 9, 2019

If someone comes up with checks I can help get Travis running them.

@HolgerJeromin
Copy link
Contributor

Ref #3446 (Regression tests for tag order on the same object)

Copy link
Collaborator

@imagico imagico left a comment

Choose a reason for hiding this comment

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

Works fine.

Since this would significantly reduce code complexity (essentially it would make this change unnecessary) i wonder if it would not make more sense to simply set way_pixels to 0 instead of NULL in SQL since we essentially treat (and will likely always treat) point features the same way as very small polygon features in cases where both are rendered identically in principle.

@jeisenbe
Copy link
Collaborator Author

Thanks. I'll merge this in a couple of days if there are no other comments or objections.

@jeisenbe jeisenbe removed the request for review from sommerluk September 17, 2019 01:23
@jeisenbe
Copy link
Collaborator Author

... simply set way_pixels to 0 instead of NULL in SQL since we essentially treat (and will likely always treat) point features the same way as very small polygon features in cases where both are rendered identically in principle.

@pnorman - any opinion on this idea? Would it slow things down to have more non-NULL fields in the rendering database?

@jeisenbe jeisenbe mentioned this pull request Sep 17, 2019
@pnorman
Copy link
Collaborator

pnorman commented Sep 17, 2019

@pnorman - any opinion on this idea? Would it slow things down to have more non-NULL fields in the rendering database?

We would not be altering the database. We could go for 0.

@jeisenbe
Copy link
Collaborator Author

jeisenbe commented Sep 17, 2019 via email

@sommerluk sommerluk self-requested a review September 17, 2019 06:59
Copy link
Collaborator

@sommerluk sommerluk left a comment

Choose a reason for hiding this comment

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

Sorry for long waiting time. (I'm really busy currently.)

I approve this PR.

Going to way_pixels = 0 instead of way_pixels = null for nodes would not allow us anymore to have different rules for nodes and areas, but as @imagico said essentially we treat nodes like small areas anyway. It would not only make the MSS code shorter, but also much more natural to read (and prevent that someone else does the same error I did when introducing this bug). So I would go for the way_pixels = 0 on nodes solution right now instead of doing it later.

Selects way_area as 0 instead of null when union all is used in amenity-points and stations sql queries
This allows filtering on way_area = O instead of way_area IS NULL and allows features tagged on points to be rendered like areas with way_area=0
Thus this simplifies fixing the rendering for text labels on points, so way_pixels = null and != null are removed
@jeisenbe
Copy link
Collaborator Author

OK, I've pushed a new commit which changes from NULL as way_area to O as way_area for the points, and removed the other changes. The test renderings above are unchanged, and all of the amenity-points.mss features in my test rendering appear to still render correctly, including subway entrances and stations (that layer is also affected by the change).

@imagico
Copy link
Collaborator

imagico commented Sep 17, 2019

I don't mind this approach but what i actually had in mind is changing

way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels

using COALESCE(..., 0).

The differentiation between NULL and zero is not practically that relevant because polygons with zero area are not valid and AFAIK osm2pgsql does not generate those. But for clarity selecting the node only feature types with way_area IS NULL is still clearer.

@jeisenbe
Copy link
Collaborator Author

I thought about that but didn't know how to do it. :-)

I've pushed a new commit using COALESCE(way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0), 0) AS way_pixels and switched back to way_area IS NULL

@jeisenbe
Copy link
Collaborator Author

@imagico or @sommerluk do you have time to review this before Friday?

Copy link
Collaborator

@imagico imagico left a comment

Choose a reason for hiding this comment

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

It works fine.

@jeisenbe jeisenbe merged commit 120d364 into gravitystorm:master Sep 20, 2019
jeisenbe added a commit to jeisenbe/openstreetmap-carto that referenced this pull request Sep 20, 2019
@jeisenbe jeisenbe deleted the point-labels branch September 20, 2019 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants