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

Matching empty strings #2319

Closed
ashh87 opened this issue May 10, 2014 · 2 comments
Closed

Matching empty strings #2319

ashh87 opened this issue May 10, 2014 · 2 comments

Comments

@ashh87
Copy link

ashh87 commented May 10, 2014

Updating openstreetmap-carto (gravitystorm/openstreetmap-carto#517 for details) I tried to filter data by "[access = '']". openstreetmap-carto already contains filters for "[access != '']" and these work fine. I can't get "[access = '']" to work though. I have a postgis setup, with a node that I want to be rendered, it doesn't have an 'access' tag, which is what I thought the rule I am trying should match (as the value for the access column in the relevant database row is blank) - it doesn't render the node with this rule. It doesn't render it when I change to "[access != '']", but that is expected!

Am I taking the wrong approach to this filter, or trying to match an empty(/null) string incorrectly or is this a bug? How does this affect the OSM website (mapnik?) if it is a bug? NB, as mentioned on the linked pull request, doing a regex for a blank string seems to allow the node to render correctly, but I didn't have time to double check my regex was correct :)

@springmeyer
Copy link
Member

Try "[access = null]". The "[access != '']" is a hack for old Mapnik versions (before v2.2.0) which did not support filtering on nulls. Now that "[access != null]" and "[access = null]" work you should avoid "[access != '']". It is only there now as a back compatibility shim.

On May 10, 2014, at 7:40 AM, ashh87 notifications@github.com wrote:

Updating openstreetmap-carto (gravitystorm/openstreetmap-carto#517 for details) I tried to filter data by "[access = '']". openstreetmap-carto already contains filters for "[access != '']" and these work fine. I can't get "[access = '']" to work though. I have a postgis setup, with a node that I want to be rendered, it doesn't have an 'access' tag, which is what I thought the rule I am trying should match (as the value for the access column in the relevant database row is blank) - it doesn't render the node with this rule. It doesn't render it when I change to "[access != '']", but that is expected!

Am I taking the wrong approach to this filter, or trying to match an empty(/null) string incorrectly or is this a bug? How does this affect the OSM website (mapnik?) if it is a bug? NB, as mentioned on the linked pull request, doing a regex for a blank string seems to allow the node to render correctly, but I didn't have time to double check my regex was correct :)


Reply to this email directly or view it on GitHub.

@ashh87
Copy link
Author

ashh87 commented May 10, 2014

perfect, thank you ! :)

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

No branches or pull requests

2 participants