﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
15158	Feature request Tag2Link	de_vries	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:

{{{
#!xml
    <!-- 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: 
- OSM: https://www.openstreetmap.org/way/297923406
- BAG: https://bagviewer.kadaster.nl/lvbag/bag-viewer/index.html#?searchQuery=1740100000017978
Example of a building with a leading zero in the BAG-ID: 
- OSM: https://www.openstreetmap.org/way/265267429
- BAG: https://bagviewer.kadaster.nl/lvbag/bag-viewer/index.html#?searchQuery=0175100000003816

"	enhancement	assigned	normal		Plugin tag2link			netherlands	
