wiki:Rules/Pictures

Version 6 (modified by wangi, 8 days ago) ( diff )

move checks into the rules; per #24894

Pictures linking rules

meta {
    title: "Pictures rules";
    version: "6_2026-09-19";
    description: "Rules for checking syntax of picture-related tags";
    author: "PanierAvide";
    link: "https://josm.openstreetmap.de/wiki/Rules/Pictures";
    min-josm-version: "14481"; /* due to osmose attributs */
    baselanguage: "en";
}

*[mapillary][mapillary!~/^[0-9]{15,19}$/][mapillary=~/pKey=[0-9]{15,19}/] {
    throwError: tr("mapillary tag should only contain image ID instead of full URL");
    fixAdd: concat("mapillary=", get(regexp_match(".*pKey=([0-9]{15,19}).*", tag("mapillary")),1));
    assertMatch: "node mapillary=https://www.mapillary.com/app/?pKey=1410083070176035&focus=photo";
    assertMatch: "node mapillary=https://www.mapillary.com/app/?pKey=277755748254846";
    assertNoMatch: "node mapillary=1410083070176035";
    assertNoMatch: "node mapillary=8fX3-aB9vQ2kLm5nR7tYwZ";
}

*[mapillary][mapillary=~/^[A-Za-z0-9_-]{22}$/] {
    throwWarning: tr("mapillary tag contains a legacy image key, which Mapillary no longer resolves; replace it by the numeric image ID");
    assertMatch: "node mapillary=8fX3-aB9vQ2kLm5nR7tYwZ";
    assertNoMatch: "node mapillary=1410083070176035";
    assertNoMatch: "node mapillary=https://www.mapillary.com/app/?pKey=277755748254846";
}

*[mapillary][mapillary!~/^[0-9]{15,19}$/][mapillary!~/pKey=[0-9]{15,19}/][mapillary!~/^[A-Za-z0-9_-]{22}$/] {
    throwError: tr("mapillary tag should only contain image ID (15 to 19 digits)");
    assertMatch: "node mapillary=1";
    assertMatch: "node mapillary=abc";
    assertMatch: "node mapillary=12345678901234567890";
    assertNoMatch: "node mapillary=823115609853912";
    assertNoMatch: "node mapillary=1410083070176035";
    assertNoMatch: "node mapillary=12345678901234567";
    assertNoMatch: "node mapillary=1234567890123456789";
    assertNoMatch: "node mapillary=https://www.mapillary.com/app/?pKey=1410083070176035";
    assertNoMatch: "node mapillary=8fX3-aB9vQ2kLm5nR7tYwZ";
}

*[flickr][flickr!~/^https:\/\/www.flickr.com\/photos\/[0-9]+@[A-Z0-9]+\/[0-9]+$/] {
    throwError: tr("flickr tag should contain full image URL");
    assertMatch: "node flickr=12345678901";
    assertNoMatch: "node flickr=https://www.flickr.com/photos/12345678@N01/12345678901";
}

Rules_Pictures.validator.mapcss, Rules_Pictures.zip

Note: See TracWiki for help on using the wiki.