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

Use address as backup label #6188

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/svg/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export function svgLabels(projection, context) {
['point', 'camp_site', '*', 10],
['line', 'name', '*', 12],
['area', 'name', '*', 12],
['point', 'name', '*', 10]
['point', 'name', '*', 10],
['area', 'addr:housenumber', '*', 12],
['point', 'addr:housenumber', '*', 10]
];


Expand Down
9 changes: 8 additions & 1 deletion modules/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,22 @@ export function utilGetAllNodes(ids, graph) {
export function utilDisplayName(entity) {
var localizedNameKey = 'name:' + utilDetect().locale.toLowerCase().split('-')[0];
var name = entity.tags[localizedNameKey] || entity.tags.name || '';
var network = entity.tags.cycle_network || entity.tags.network;

if (!name && entity.tags.ref) {
name = entity.tags.ref;
var network = entity.tags.cycle_network || entity.tags.network;
if (network) {
name = network + ' ' + name;
}
}

if (!name && entity.tags['addr:housenumber']) {
name = entity.tags['addr:housenumber'];
if (entity.tags['addr:street']) {
name += ' ' + entity.tags['addr:street'];
Copy link
Collaborator

@1ec5 1ec5 Apr 16, 2019

Choose a reason for hiding this comment

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

In some countries, the street name comes before the house number. Would it be feasible to use address-formats.json as a guide to how to format these addresses?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In areas where both buildings and addresses have been mapped or imported, there may still be freestanding address points for units within a multi-tenant building. Adding addr:unit to the display name would disambiguate these closely spaced points.

}
}

return name;
}

Expand Down