Modify

Opened 7 years ago

Closed 4 years ago

#15158 closed enhancement (fixed)

Feature request Tag2Link: ref:bag

Reported by: de_vries Owned by: Klumbumbus
Priority: normal Milestone: 20.02
Component: Core tag2link Version:
Keywords: netherlands Cc: simon04, nyurik

Description (last modified by Don-vip)

Disclaimer: If this is not the right place for feature requests for plug-ins, please point me to the right place.

In the Netherlands all buildings and addresses are imported from a official database (BAG). All buildings have their BAG-ID in the tag "ref:bag". I would like to have Tag2Link to provide a link, based on the "ref:bag" tag, to that object in the BagViewer. This is a website were you can view the official BAG database: https://bagviewer.kadaster.nl/

To achieve this I added the following code to the "tag2link_sources.xml" file:

    <!-- BAG - Buildings in The Neterlands --> 
     
    <src name="BAG">
       <rule>
            <condition k="ref:bag" />
            <link name="Open in BAG Viewer" href="https://bagviewer.kadaster.nl/lvbag/bag-viewer/index.html#?searchQuery=0%v%" />
        </rule>
    </src>

This code adds a "0" in font of the BAG-ID. Here is why:

  • All BAG-ID's consist of 16 numbers
  • Most BAG-ID's start with a 0
  • Those leading zero's are striped from the BAG-ID when imported to OSM.
  • The BagViewer doesn't work if you leave out the leading zero.

So my code works in most cases, but when there was no leading zero in the original BAG-ID, it doesn't work.

I have two questions:

  • How to fix this code to ad just enough leading zero's to make the BAG-ID exactly 16 numbers long?
  • Can this be added to the plugin?

Additional details:
ref:bag is used 10.000.000 times: https://taginfo.openstreetmap.org/keys/ref%3Abag
Example of a building without a leading zero in the BAG-ID:

Example of a building with a leading zero in the BAG-ID:

Attachments (1)

15158_13_digit.PNG (1.1 MB ) - added by Klumbumbus 5 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 by stoecker, 7 years ago

Component: CorePlugin tag2link
Owner: changed from team to Don-vip
Type: defectenhancement

comment:2 by Don-vip, 7 years ago

Description: modified (diff)
Keywords: netherlands added
Status: newassigned

It is the right place :) I will look into it.

comment:3 by Don-vip, 5 years ago

Summary: Feature request Tag2LinkFeature request Tag2Link: ref:bag

comment:4 by Don-vip, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [o34854:34856].

comment:5 by stoecker, 5 years ago

Hmm, did you looks at the mentioned formating issue?

comment:6 by Don-vip, 5 years ago

Resolution: fixed
Status: closedreopened

Seems not

comment:7 by Klumbumbus, 5 years ago

Owner: changed from Don-vip to Klumbumbus
Status: reopenednew

comment:8 by Klumbumbus, 5 years ago

@de_vries: valid ref:bag values in the osm database have either exact 15 or 16 digits, not more or less right?

comment:9 by Klumbumbus, 5 years ago

I checked the database with overpass turbo (ways only), e.g.

[out:csv(::count)][timeout:295];
(
  way["ref:bag"~"^[0-9]{14}$"];
);
out count;

which gives the following results. (15 gives no result probably due to the large number.)

18 0
17 0
16 1.641.392
15 ? (should be around 7.777.117)
14 757.516
13 28.597
12 0
11 0
10 0
9 0
8 0
7 0
6 0
5 5
4 2
3 10
2 8
1 9

So, 13-16 digits seems valid?

Last edited 5 years ago by Klumbumbus (previous) (diff)

by Klumbumbus, 5 years ago

Attachment: 15158_13_digit.PNG added

comment:11 by de_vries, 5 years ago

@Klumbumbus 13-16 digits seems right. Anyway, your analysis seems more thorough than my knowledge.

comment:12 by Klumbumbus, 5 years ago

Resolution: fixed
Status: newclosed

fixed in [o35043:35044]

comment:13 by de_vries, 5 years ago

@Klumbumbus Thanks for fixing this, I really appreciate it!

comment:14 by Klumbumbus, 5 years ago

You're welcome :)

comment:15 by de_vries, 4 years ago

With the merging of Tag2Link into the core and the switch to obtaining the rules from wikidata the ref:bag feature broke. It was somewhat fixable by editing wikidata and the data entry of the ref:bag osm wiki page.

But the formatting issue with the leading zeros that I mentioned above still remains.

comment:16 by Klumbumbus, 4 years ago

Cc: simon04 added

comment:17 by simon04, 4 years ago

Cc: nyurik added

Sorry for the regression. I see two ways to tackle this problem:

  1. Find a way on Wikidata / OSM Wiki Wikibase to deal with leading zeros for the formatter URL – maybe @nyurik can help here?
  2. Hard-code ref:bag in the Java source Tag2Link.java

comment:18 by simon04, 4 years ago

Milestone: 20.02
Resolution: fixed
Status: closedreopened

I started a discussion on OSM wiki: Special:Diff/1958215

comment:19 by simon04, 4 years ago

Resolution: fixed
Status: reopenedclosed

In 15881/josm:

fix #15158 - Tag2Link: leading zeros for ref:bag

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Klumbumbus.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.