Example #1
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[name=~/ي/][language("fa")]
        # *[name:fa=~/ي/]
        if (u'name' in keys) or (u'name:fa' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Arabic letter detected in Farsi name")
                # -osmoseItemClassLevel:"5010/50109001:0/2"
                # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ي","ی")
                # fixAdd:concat("{0.key}=",replace("{0.value}","ي","ی"))
                # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa')
                # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"'
                # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"'
                err.append({'class': 50109001, 'subclass': 0, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ي', u'ی'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ي', u'ی'))).split('=', 1)])
                }})

        # *[name=~/ك/][language("fa")]
        # *[name:fa=~/ك/]
        if (u'name' in keys) or (u'name:fa' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Arabic letter detected in Farsi name")
                # -osmoseItemClassLevel:"5010/50109001:1/2"
                # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ك","ک")
                # fixAdd:concat("{0.key}=",replace("{0.value}","ك","ک"))
                # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa')
                # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"'
                # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"'
                err.append({'class': 50109001, 'subclass': 1, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ك', u'ک'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ك', u'ک'))).split('=', 1)])
                }})

        return err
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[name=~/ي/][language("fa")]
        # *[name:fa=~/ي/]
        if (u'name' in keys) or (u'name:fa' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Arabic letter detected in Farsi name")
                # -osmoseItemClassLevel:"5010/50109001/2"
                # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ي","ی")
                # fixAdd:concat("{0.key}=",replace("{0.value}","ي","ی"))
                # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa')
                # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"'
                # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"'
                err.append({'class': 50109001, 'subclass': 0, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ي', u'ی'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ي', u'ی'))).split('=', 1)])
                }})

        # *[name=~/ك/][language("fa")]
        # *[name:fa=~/ك/]
        if (u'name' in keys) or (u'name:fa' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Arabic letter detected in Farsi name")
                # -osmoseItemClassLevel:"5010/50109001/2"
                # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ك","ک")
                # fixAdd:concat("{0.key}=",replace("{0.value}","ك","ک"))
                # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa')
                # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"'
                # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"'
                err.append({'class': 50109001, 'subclass': 0, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ك', u'ک'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ك', u'ک'))).split('=', 1)])
                }})

        return err
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[operator=ERDF][inside("FR")]
        if (u'operator' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'operator') == mapcss._value_capture(capture_tags, 0, u'ERDF') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"operator=Enedis"
                # fixAdd:"operator=Enedis"
                err.append({'class': 9009001, 'subclass': 262422756, 'text': mapcss.tr(u'{0} is deprecated', mapcss._tag_uncapture(capture_tags, u'{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'operator',u'Enedis']])
                }})

        # *[addr:street=~/(?i).*Strasse.*/][addr:street!~/(?i).*Strasser.*/][inside("DE,AT")]
        # *[name=~/(?i).*Strasse.*/][name!~/(?i).*Strasser.*/][inside("DE,AT")]
        if (u'addr:street' in keys) or (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5b84a257), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')) and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_559797c8), mapcss._tag_capture(capture_tags, 1, tags, u'addr:street')) and mapcss.inside(self.father.config.options, u'DE,AT'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5b84a257), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_559797c8), mapcss._tag_capture(capture_tags, 1, tags, u'name')) and mapcss.inside(self.father.config.options, u'DE,AT'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("street name contains ss")
                err.append({'class': 9009002, 'subclass': 821908491, 'text': mapcss.tr(u'street name contains ss')})

        # *[addr:street=~/(?i).*Straße.*/][inside("LI,CH")]
        # *[name=~/(?i).*Straße.*/][inside("LI,CH")]
        if (u'addr:street' in keys) or (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3d3faeb5), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')) and mapcss.inside(self.father.config.options, u'LI,CH'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3d3faeb5), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.inside(self.father.config.options, u'LI,CH'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("street name contains ß")
                err.append({'class': 9009003, 'subclass': 610086334, 'text': mapcss.tr(u'street name contains ß')})

        return err
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # node[place=locality][name=~/.+([- ]([Nn]ord|[Ss]ud$|[Ee]st|[Oo]uest|[Cc]entre))$/][inside("FR")]
        # node[place=hamlet][name=~/.+([- ]([Nn]ord|[Ss]ud$|[Ee]st|[Oo]uest|[Cc]entre))$/][inside("FR")]
        if (u'name' in keys and u'place' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'place')
                        == mapcss._value_capture(capture_tags, 0, u'locality')
                        and mapcss.regexp_test(
                            mapcss._value_capture(capture_tags, 1,
                                                  self.re_5d724bf1),
                            mapcss._tag_capture(capture_tags, 1, tags,
                                                u'name'))
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'place')
                        == mapcss._value_capture(capture_tags, 0, u'hamlet')
                        and mapcss.regexp_test(
                            mapcss._value_capture(capture_tags, 1,
                                                  self.re_5d724bf1),
                            mapcss._tag_capture(capture_tags, 1, tags,
                                                u'name'))
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"5080/50801/1"
                # throwError:tr("Hamlet or Locality name suffix Nord, Sud, Est, Ouest, Centre should be removed from Cadastre name. Place should be integrated only once.")
                # -osmoseAssertNoMatchWithContext:list('node place=hamlet name="Kerbrest"',"inside=FR")
                # -osmoseAssertNoMatchWithContext:list('node place=hamlet name="ZA Sud Loire"',"inside=FR")
                # -osmoseAssertMatchWithContext:list('node place=hamlet name=Montdésert-Sud',"inside=FR")
                err.append({
                    'class':
                    50801,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Hamlet or Locality name suffix Nord, Sud, Est, Ouest, Centre should be removed from Cadastre name. Place should be integrated only once.'
                       )
                })

        return err
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[addr:street=~/(?i).*Strasse.*/][addr:street!~/(?i).*Strasser.*/][inside("DE,AT")]
        # *[name=~/(?i).*Strasse.*/][name!~/(?i).*Strasser.*/][inside("DE,AT")]
        if (u'addr:street' in keys) or (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5b84a257), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_559797c8, u'(?i).*Strasser.*'), mapcss._tag_capture(capture_tags, 1, tags, u'addr:street')) and mapcss.inside(self.father.config.options, u'DE,AT'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5b84a257), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_559797c8, u'(?i).*Strasser.*'), mapcss._tag_capture(capture_tags, 1, tags, u'name')) and mapcss.inside(self.father.config.options, u'DE,AT'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("street name contains ss")
                err.append({'class': 9009002, 'subclass': 821908491, 'text': mapcss.tr(u'street name contains ss')})

        # *[addr:street=~/(?i).*Straße.*/][inside("LI,CH")]
        # *[name=~/(?i).*Straße.*/][inside("LI,CH")]
        if (u'addr:street' in keys) or (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3d3faeb5), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')) and mapcss.inside(self.father.config.options, u'LI,CH'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3d3faeb5), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.inside(self.father.config.options, u'LI,CH'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("street name contains ß")
                err.append({'class': 9009003, 'subclass': 610086334, 'text': mapcss.tr(u'street name contains ß')})

        # relation[type=associatedStreet][inside("DE")]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'associatedStreet') and mapcss.inside(self.father.config.options, u'DE'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated in {1}","{0.tag}","Deutschland")
                # suggestAlternative:"addr:street"
                err.append({'class': 9009001, 'subclass': 746730328, 'text': mapcss.tr(u'{0} is deprecated in {1}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), u'Deutschland')})

        return err
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[name=~/(?i)co.?voiturage/][amenity!=car_pooling][!carpool][inside("FR")]
        if (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_045a0f34), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss._tag_capture(capture_tags, 1, tags, u'amenity') != mapcss._value_const_capture(capture_tags, 1, u'car_pooling', u'car_pooling') and not mapcss._tag_capture(capture_tags, 2, tags, u'carpool') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("parking","amenity","fix:chair")
                # -osmoseItemClassLevel:"2080/20806/3"
                # throwWarning:tr("Missing tag carpool on area")
                # fixAdd:"amenity=car_pooling"
                # fixAdd:"carpool=designated"
                err.append({'class': 20806, 'subclass': 0, 'text': mapcss.tr(u'Missing tag carpool on area'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'amenity',u'car_pooling'],
                    [u'carpool',u'designated']])
                }})

        return err
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # *[addr:housenumber][addr:housenumber!~/^((?:вл)?[0-9]+[А-Я]?(?:\/[0-9]+[А-Я]?)?(?: к[0-9А-Я]+)?(?: с[0-9А-Я]+)?(?: соор[0-9А-Я]+)?(?: лит[0-9А-Я]+)?(?: фл[0-9А-Я]+)?|[0-9]+-[0-9]+|[0-9]+[А-Я]?[\/-][0-9]+[А-Я]?[\/-][0-9]+[А-Я]?|(([0-9]+[А-Я]?[IXV]*)|[IXV]*)[\/-]([0-9]+[А-Я]?|[IXV]*)|ЗЯБ-[0-9]+|С-([0-9]+[А-Я]?(?:\/[0-9]+[А-Я]?)?|[IXV]*)|к[0-9А-Я]+)$/]
        if (u'addr:housenumber' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags, u'addr:housenumber'
                    ) and not mapcss.regexp_test(
                        mapcss._value_const_capture(
                            capture_tags, 1, self.re_62d22c1b,
                            u'^((?:вл)?[0-9]+[А-Я]?(?:\/[0-9]+[А-Я]?)?(?: к[0-9А-Я]+)?(?: с[0-9А-Я]+)?(?: соор[0-9А-Я]+)?(?: лит[0-9А-Я]+)?(?: фл[0-9А-Я]+)?|[0-9]+-[0-9]+|[0-9]+[А-Я]?[\/-][0-9]+[А-Я]?[\/-][0-9]+[А-Я]?|(([0-9]+[А-Я]?[IXV]*)|[IXV]*)[\/-]([0-9]+[А-Я]?|[IXV]*)|ЗЯБ-[0-9]+|С-([0-9]+[А-Я]?(?:\/[0-9]+[А-Я]?)?|[IXV]*)|к[0-9А-Я]+)$'
                        ),
                        mapcss._tag_capture(capture_tags, 1, tags,
                                            u'addr:housenumber')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("Номера домов не соответствующие принятому соглашению")
                err.append({
                    'class':
                    9017001,
                    'subclass':
                    774061168,
                    'text':
                    mapcss.
                    tr(u'Номера домов не соответствующие принятому соглашению')
                })

        return err
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[addr:street=~/(?i).*Strasse.*/][addr:street!~/(?i).*Strasser.*/][inside("DE,AT")]
        # *[name=~/(?i).*Strasse.*/][name!~/(?i).*Strasser.*/][inside("DE,AT")]
        if (u'addr:street' in keys) or (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5b84a257), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_559797c8, u'(?i).*Strasser.*'), mapcss._tag_capture(capture_tags, 1, tags, u'addr:street')) and mapcss.inside(self.father.config.options, u'DE,AT'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5b84a257), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_559797c8, u'(?i).*Strasser.*'), mapcss._tag_capture(capture_tags, 1, tags, u'name')) and mapcss.inside(self.father.config.options, u'DE,AT'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("street name contains ss")
                # assertMatch:"way name=Hauptstrasse"
                # assertNoMatch:"way name=Hauptstraße"
                # assertNoMatch:"way name=Kapitän-Strasser-Straße"
                # assertNoMatch:"way name=Peter-Strasser-Platz"
                err.append({'class': 9009002, 'subclass': 821908491, 'text': mapcss.tr(u'street name contains ss')})

        # *[addr:street=~/(?i).*Straße.*/][inside("LI,CH")]
        # *[name=~/(?i).*Straße.*/][inside("LI,CH")]
        if (u'addr:street' in keys) or (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3d3faeb5), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')) and mapcss.inside(self.father.config.options, u'LI,CH'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3d3faeb5), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.inside(self.father.config.options, u'LI,CH'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("street name contains ß")
                # assertNoMatch:"way name=Hauptstrasse"
                # assertMatch:"way name=Hauptstraße"
                err.append({'class': 9009003, 'subclass': 610086334, 'text': mapcss.tr(u'street name contains ß')})

        return err
Example #9
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # node[highway=~/motorway|trunk|primary|secondary|tertiary|unclassified|residential|service|living_street|pedestrian|track|path|footway|cycleway|bus_guideway|bridleway/][highway!=motorway_junction][highway!=services]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss.regexp_test(
                            mapcss._value_capture(capture_tags, 0,
                                                  self.re_3dc5dd7c),
                            mapcss._tag_capture(capture_tags, 0, tags,
                                                u'highway')) and
                        mapcss._tag_capture(capture_tags, 1, tags, u'highway')
                        != mapcss._value_capture(capture_tags, 1,
                                                 u'motorway_junction') and
                        mapcss._tag_capture(capture_tags, 2, tags, u'highway')
                        != mapcss._value_capture(capture_tags, 2, u'services'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("wrong highway tag on a node")
                # assertNoMatch:"node highway=bus_stop"
                # assertNoMatch:"node highway=crossing"
                # assertNoMatch:"node highway=emergency_access_point"
                # assertNoMatch:"node highway=give_way"
                # assertNoMatch:"node highway=mini_roundabout"
                # assertNoMatch:"node highway=motorway_junction"
                # assertNoMatch:"node highway=passing_place"
                # assertMatch:"node highway=primary"
                # assertMatch:"node highway=primary_link"
                # assertNoMatch:"node highway=rest_area"
                # assertNoMatch:"node highway=services"
                # assertNoMatch:"node highway=speed_camera"
                # assertNoMatch:"node highway=stop"
                # assertNoMatch:"node highway=street_lamp"
                # assertNoMatch:"node highway=traffic_calming"
                # assertNoMatch:"node highway=traffic_signals"
                # assertNoMatch:"node highway=turning_circle"
                err.append({
                    'class': 9004008,
                    'subclass': 325492196,
                    'text': mapcss.tr(u'wrong highway tag on a node')
                })

        # node[railway!=crossing][crossing!=no].is_in_railway.is_in_minor_road!.is_in_major_road
        # Use undeclared class is_in_major_road, is_in_minor_road, is_in_railway

        # node[railway!=level_crossing].is_in_railway.is_in_major_road!.is_in_minor_road
        # Use undeclared class is_in_major_road, is_in_minor_road, is_in_railway

        return err
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[railway=rail][!gauge][inside("FR")]
        if (u'railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'rail') and not mapcss._tag_capture(capture_tags, 1, tags, u'gauge') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("tag","railway")
                # -osmoseItemClassLevel:"2160/21600/3"
                # throwWarning:tr("Missing tag gauge on rail")
                # suggestAlternative:"gauge"
                # -osmoseAssertNoMatchWithContext:list("way railway=disused","inside=FR")
                # -osmoseAssertNoMatchWithContext:list("way railway=rail gauge=1435","inside=FR")
                # -osmoseAssertMatchWithContext:list("way railway=rail","inside=FR")
                err.append({'class': 21600, 'subclass': 0, 'text': mapcss.tr(u'Missing tag gauge on rail')})

        # *[name=~/(?i)co.?voiturage/][amenity!=car_pooling][!carpool][inside("FR")]
        if (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_045a0f34), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss._tag_capture(capture_tags, 1, tags, u'amenity') != mapcss._value_const_capture(capture_tags, 1, u'car_pooling', u'car_pooling') and not mapcss._tag_capture(capture_tags, 2, tags, u'carpool') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("parking","amenity","fix:chair")
                # -osmoseItemClassLevel:"2080/20806/3"
                # throwWarning:tr("Missing tag carpool on area")
                # fixAdd:"amenity=car_pooling"
                # fixAdd:"carpool=designated"
                # -osmoseAssertNoMatchWithContext:list("way name='Aire de covoiturage' amenity=car_pooling","inside=FR")
                # -osmoseAssertMatchWithContext:list("way name='Aire de covoiturage' amenity=car_sharing","inside=FR")
                # -osmoseAssertNoMatchWithContext:list("way name='Aire de covoiturage' amenity=parking carpool=designated","inside=FR")
                err.append({'class': 20806, 'subclass': 0, 'text': mapcss.tr(u'Missing tag carpool on area'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'amenity',u'car_pooling'],
                    [u'carpool',u'designated']])
                }})

        return err
Example #11
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # node[highway=~/motorway|trunk|primary|secondary|tertiary|unclassified|residential|service|living_street|pedestrian|track|path|footway|cycleway|bus_guideway|bridleway/][highway!=motorway_junction][highway!=services]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3dc5dd7c), mapcss._tag_capture(capture_tags, 0, tags, u'highway')) and mapcss._tag_capture(capture_tags, 1, tags, u'highway') != mapcss._value_capture(capture_tags, 1, u'motorway_junction') and mapcss._tag_capture(capture_tags, 2, tags, u'highway') != mapcss._value_capture(capture_tags, 2, u'services'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("wrong highway tag on a node")
                # assertNoMatch:"node highway=bus_stop"
                # assertNoMatch:"node highway=crossing"
                # assertNoMatch:"node highway=emergency_access_point"
                # assertNoMatch:"node highway=give_way"
                # assertNoMatch:"node highway=mini_roundabout"
                # assertNoMatch:"node highway=motorway_junction"
                # assertNoMatch:"node highway=passing_place"
                # assertMatch:"node highway=primary"
                # assertMatch:"node highway=primary_link"
                # assertNoMatch:"node highway=rest_area"
                # assertNoMatch:"node highway=services"
                # assertNoMatch:"node highway=speed_camera"
                # assertNoMatch:"node highway=stop"
                # assertNoMatch:"node highway=street_lamp"
                # assertNoMatch:"node highway=traffic_calming"
                # assertNoMatch:"node highway=traffic_signals"
                # assertNoMatch:"node highway=turning_circle"
                err.append({'class': 9004008, 'subclass': 325492196, 'text': mapcss.tr(u'wrong highway tag on a node')})

        # node[railway!=crossing][crossing!=no].is_in_railway.is_in_minor_road!.is_in_major_road
        # Use undeclared class is_in_major_road, is_in_minor_road, is_in_railway

        # node[railway!=level_crossing].is_in_railway.is_in_major_road!.is_in_minor_road
        # Use undeclared class is_in_major_road, is_in_minor_road, is_in_railway

        return err
Example #12
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # relation[highway=~/^((motorway|trunk|primary|secondary|tertiary)(_link)?|residential|unclassified)$/][type=multipolygon]
        if ('highway' in keys and 'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5757d731), mapcss._tag_capture(capture_tags, 0, tags, 'highway'))) and (mapcss._tag_capture(capture_tags, 1, tags, 'type') == mapcss._value_capture(capture_tags, 1, 'multipolygon')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("suspicious tag combination")
                # throwError:tr("Area with {0} above {1} is invalid","highway=*","highway=service")
                # suggestAlternative:"area:highway=*"
                # assertMatch:"relation highway=trunk type=multipolygon"
                err.append({'class': 9004011, 'subclass': 2126629809, 'text': mapcss.tr('Area with {0} above {1} is invalid', 'highway=*', 'highway=service')})

        return err
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[place=locality][name=~/.+([- ]([Nn]ord|[Ss]ud$|[Ee]st|[Oo]uest|[Cc]entre))$/][inside("FR")]
        # way[place=hamlet][name=~/.+([- ]([Nn]ord|[Ss]ud$|[Ee]st|[Oo]uest|[Cc]entre))$/][inside("FR")]
        if ('name' in keys and 'place' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'place') == mapcss._value_capture(capture_tags, 0, 'locality')) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_5d724bf1), mapcss._tag_capture(capture_tags, 1, tags, 'name'))) and (mapcss.inside(self.father.config.options, 'FR')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'place') == mapcss._value_capture(capture_tags, 0, 'hamlet')) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_5d724bf1), mapcss._tag_capture(capture_tags, 1, tags, 'name'))) and (mapcss.inside(self.father.config.options, 'FR')))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"5080/50801/1"
                # throwError:tr("Hamlet or Locality name suffix Nord, Sud, Est, Ouest, Centre should be removed from Cadastre name. Place should be integrated only once.")
                err.append({'class': 50801, 'subclass': 0, 'text': mapcss.tr('Hamlet or Locality name suffix Nord, Sud, Est, Ouest, Centre should be removed from Cadastre name. Place should be integrated only once.')})

        return err
Example #14
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # way[highway=~/^(motorway|trunk|primary|secondary|tertiary)$/]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_55ee32ac),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'highway')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setmajor_road
                set_major_road = True

        # way[highway=~/^.*_link$/]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_3092b7ac),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'highway')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setlink_road
                set_link_road = True

        # way[highway=~/^(unclassified|residential|living_street|service)$/]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_015aabd5),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'highway')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setminor_road
                set_minor_road = True

        # way[highway][name=~/(?i).* (Ave|Blvd|Br|Brg|Cct|Cir|Cl|Cr|Crct|Cres|Crt|Ct|Dr|Drv|Esp|Espl|Hwy|Ln|Mw|Mwy|Pky|Pkwy|Pl|Rd|Qy|Qys|Sq|St|Str|Ter|Tce|Tr|Wy)[.]?$/]
        if (u'highway' in keys and u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'highway')
                             and mapcss.regexp_test(
                                 mapcss._value_capture(capture_tags, 1,
                                                       self.re_776f2c1a),
                                 mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'name')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("abbreviated street name")
                # assertMatch:"way highway=unclassified name=\"Bou Blvd.\""
                # assertMatch:"way highway=unclassified name=\"Bou blvd.\""
                # assertMatch:"way highway=unclassified name=\"Foo Ave\""
                # assertMatch:"way highway=unclassified name=\"Foo Ave.\""
                err.append({
                    'class': 9004001,
                    'subclass': 544432044,
                    'text': mapcss.tr(u'abbreviated street name')
                })

        # way[highway=crossing]
        # way[railway=crossing]
        # way[railway=level_crossing]
        if (u'highway' in keys) or (u'railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'highway') == mapcss._value_capture(
                            capture_tags, 0, u'crossing'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'railway') == mapcss._value_capture(
                            capture_tags, 0, u'crossing'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'railway') == mapcss._value_capture(
                            capture_tags, 0, u'level_crossing'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("wrong crossing tag on a way")
                # assertMatch:"way highway=crossing"
                err.append({
                    'class': 9004002,
                    'subclass': 1549110307,
                    'text': mapcss.tr(u'wrong crossing tag on a way')
                })

        # way[highway=yes]
        # way[highway=road]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'highway') == mapcss._value_capture(
                            capture_tags, 0, u'yes'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'highway') == mapcss._value_capture(
                            capture_tags, 0, u'road'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("Unspecific highway type")
                # assertNoMatch:"way highway=residential"
                # assertMatch:"way highway=road"
                err.append({
                    'class': 9004004,
                    'subclass': 1729022478,
                    'text': mapcss.tr(u'Unspecific highway type')
                })

        # way[highway=footway][maxspeed]
        # way[highway=steps][maxspeed]
        # way[highway=cycleway][bicycle=no]
        # way[highway=footway][foot=no]
        # way[highway=cycleway][cycleway=lane]
        if (u'bicycle' in keys and u'highway'
                in keys) or (u'cycleway' in keys and u'highway' in keys) or (
                    u'foot' in keys
                    and u'highway' in keys) or (u'highway' in keys
                                                and u'maxspeed' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'footway')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'maxspeed'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'steps')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'maxspeed'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'cycleway')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'bicycle')
                        == mapcss._value_capture(capture_tags, 1, u'no'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'footway')
                        and mapcss._tag_capture(capture_tags, 1, tags, u'foot')
                        == mapcss._value_capture(capture_tags, 1, u'no'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'cycleway')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'cycleway')
                        == mapcss._value_capture(capture_tags, 1, u'lane'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("{0} used with {1}","{0.value}","{1.tag}")
                # assertNoMatch:"way highway=cycleway bicycle=yes"
                # assertMatch:"way highway=cycleway cycleway=lane"
                # assertNoMatch:"way highway=cycleway"
                # assertNoMatch:"way highway=cycleway"
                # assertNoMatch:"way highway=footway foot=yes"
                # assertMatch:"way highway=footway maxspeed=20"
                # assertNoMatch:"way highway=footway"
                # assertNoMatch:"way highway=footway"
                # assertNoMatch:"way highway=residential cycleway=lane"
                # assertNoMatch:"way highway=residential maxspeed=20"
                err.append({
                    'class':
                    9004005,
                    'subclass':
                    469607562,
                    'text':
                    mapcss.tr(
                        u'{0} used with {1}',
                        mapcss._tag_uncapture(capture_tags, u'{0.value}'),
                        mapcss._tag_uncapture(capture_tags, u'{1.tag}'))
                })

        # way[footway=left][/^footway:/]
        # way[footway=right][/^footway:/]
        # way[footway=both][/^footway:/]
        # way[footway=no][/^footway:/]
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'footway')
                             == mapcss._value_capture(capture_tags, 0, u'left')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     self.re_4dcdb354))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'footway')
                        == mapcss._value_capture(capture_tags, 0, u'right')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                self.re_4dcdb354))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'footway')
                             == mapcss._value_capture(capture_tags, 0, u'both')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     self.re_4dcdb354))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'footway')
                             == mapcss._value_capture(capture_tags, 0, u'no')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     self.re_4dcdb354))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setnot_fixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}","{0.tag}","sidewalk","{1.key}")
                # assertMatch:"way footway=both footway:surface=asphalt"
                set_not_fixable_footway = True
                err.append({
                    'class':
                    9004006,
                    'subclass':
                    141262069,
                    'text':
                    mapcss.tr(
                        u'{0} is deprecated, use {1} instead. Also check similar tags like {2}',
                        mapcss._tag_uncapture(capture_tags, u'{0.tag}'),
                        u'sidewalk',
                        mapcss._tag_uncapture(capture_tags, u'{1.key}'))
                })

        # way[footway=none][/footway:/]
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'footway')
                             == mapcss._value_capture(capture_tags, 0, u'none')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     self.re_61bbe299))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setnot_fixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}","{0.tag}","sidewalk=no","{1.key}")
                set_not_fixable_footway = True
                err.append({
                    'class':
                    9004006,
                    'subclass':
                    1570348899,
                    'text':
                    mapcss.tr(
                        u'{0} is deprecated, use {1} instead. Also check similar tags like {2}',
                        mapcss._tag_uncapture(capture_tags, u'{0.tag}'),
                        u'sidewalk=no',
                        mapcss._tag_uncapture(capture_tags, u'{1.key}'))
                })

        # way[footway=left]!.not_fixable_footway
        # way[footway=right]!.not_fixable_footway
        # way[footway=both]!.not_fixable_footway
        # way[footway=no]!.not_fixable_footway
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (not set_not_fixable_footway
                             and mapcss._tag_capture(
                                 capture_tags, 0, tags,
                                 u'footway') == mapcss._value_capture(
                                     capture_tags, 0, u'left'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (not set_not_fixable_footway
                             and mapcss._tag_capture(
                                 capture_tags, 0, tags,
                                 u'footway') == mapcss._value_capture(
                                     capture_tags, 0, u'right'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (not set_not_fixable_footway
                             and mapcss._tag_capture(
                                 capture_tags, 0, tags,
                                 u'footway') == mapcss._value_capture(
                                     capture_tags, 0, u'both'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (not set_not_fixable_footway
                             and mapcss._tag_capture(capture_tags, 0, tags,
                                                     u'footway')
                             == mapcss._value_capture(capture_tags, 0, u'no'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setfixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"sidewalk"
                # fixChangeKey:"footway => sidewalk"
                set_fixable_footway = True
                err.append({
                    'class':
                    9004006,
                    'subclass':
                    2076937761,
                    'text':
                    mapcss.tr(u'{0} is deprecated',
                              mapcss._tag_uncapture(capture_tags, u'{0.tag}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+': dict([[u'sidewalk',
                                    mapcss.tag(tags, u'footway')]]),
                        '-': ([u'footway'])
                    }
                })

        # way[footway=none]!.not_fixable_footway
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (not set_not_fixable_footway
                             and mapcss._tag_capture(
                                 capture_tags, 0, tags,
                                 u'footway') == mapcss._value_capture(
                                     capture_tags, 0, u'none'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setfixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"sidewalk=no"
                # fixRemove:"footway"
                # fixAdd:"sidewalk=no"
                set_fixable_footway = True
                err.append({
                    'class':
                    9004006,
                    'subclass':
                    430589555,
                    'text':
                    mapcss.tr(u'{0} is deprecated',
                              mapcss._tag_uncapture(capture_tags, u'{0.tag}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+': dict([[u'sidewalk', u'no']]),
                        '-': ([u'footway'])
                    }
                })

        # way[footway][footway!=sidewalk][footway!=crossing]!.fixable_footway!.not_fixable_footway
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        not set_fixable_footway and not set_not_fixable_footway
                        and mapcss._tag_capture(capture_tags, 0, tags,
                                                u'footway') and
                        mapcss._tag_capture(capture_tags, 1, tags, u'footway')
                        != mapcss._value_const_capture(
                            capture_tags, 1, u'sidewalk', u'sidewalk') and
                        mapcss._tag_capture(capture_tags, 2, tags, u'footway')
                        != mapcss._value_const_capture(
                            capture_tags, 2, u'crossing', u'crossing'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("Value of ''{0}'' should either be ''{1}'' or ''{2}''. For sidewalks use ''{3}'' instead.","{0.key}","{1.value}","{2.value}","sidewalk=left|right|both|no")
                # assertMatch:"way footway=bar"
                # assertNoMatch:"way footway=left footway:left:surface=asphalt"
                # assertNoMatch:"way footway=left"
                # assertNoMatch:"way footway=none"
                err.append({
                    'class':
                    9004007,
                    'subclass':
                    156640320,
                    'text':
                    mapcss.tr(
                        u'Value of \'\'{0}\'\' should either be \'\'{1}\'\' or \'\'{2}\'\'. For sidewalks use \'\'{3}\'\' instead.',
                        mapcss._tag_uncapture(capture_tags, u'{0.key}'),
                        mapcss._tag_uncapture(capture_tags, u'{1.value}'),
                        mapcss._tag_uncapture(capture_tags, u'{2.value}'),
                        u'sidewalk=left|right|both|no')
                })

        return err
Example #15
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_ok_housenumber = False

        # *[addr:housenumber][addr:housename]["addr:housenumber"=*"addr:housename"]
        if ('addr:housename' in keys and 'addr:housenumber' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = ((mapcss._tag_capture(capture_tags, 0, tags,
                                                  'addr:housenumber'))
                             and (mapcss._tag_capture(capture_tags, 1, tags,
                                                      'addr:housename'))
                             and (mapcss._tag_capture(capture_tags, 2, tags,
                                                      'addr:housenumber')
                                  == mapcss._value_capture(
                                      capture_tags, 2,
                                      mapcss.tag(tags, 'addr:housename'))))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("Same value of {0} and {1}","{0.key}","{1.key}")
                # assertMatch:"node addr:housename=1 addr:housenumber=1"
                # assertNoMatch:"node addr:housename=1 addr:housenumber=2"
                err.append({
                    'class':
                    9000003,
                    'subclass':
                    1820984183,
                    'text':
                    mapcss.tr('Same value of {0} and {1}',
                              mapcss._tag_uncapture(capture_tags, '{0.key}'),
                              mapcss._tag_uncapture(capture_tags, '{1.key}'))
                })

        # *[addr:housenumber=bb][inside("BA")]
        if ('addr:housenumber' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = ((mapcss._tag_capture(capture_tags, 0, tags,
                                                  'addr:housenumber')
                              == mapcss._value_capture(capture_tags, 0, 'bb'))
                             and
                             (mapcss.inside(self.father.config.options, 'BA')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setok_housenumber
                set_ok_housenumber = True

        # *[addr:housenumber][addr:housenumber!~/[0-9]/]!.ok_housenumber
        if ('addr:housenumber' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = ((not set_ok_housenumber) and (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        'addr:housenumber')) and (not mapcss.regexp_test(
                            mapcss._value_const_capture(
                                capture_tags, 1, self.re_4983542e, '[0-9]'),
                            mapcss._tag_capture(capture_tags, 1, tags,
                                                'addr:housenumber'))))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("{0} without number","{0.key}")
                err.append({
                    'class':
                    9000004,
                    'subclass':
                    1053226919,
                    'text':
                    mapcss.tr('{0} without number',
                              mapcss._tag_uncapture(capture_tags, '{0.key}'))
                })

        return err
Example #16
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # node[highway=~/motorway|trunk|primary|secondary|tertiary|unclassified|residential|service|living_street|pedestrian|track|path|footway|cycleway|busway|bus_guideway|bridleway/][highway!=motorway_junction][highway!=services]
        if ('highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_447f4d65), mapcss._tag_capture(capture_tags, 0, tags, 'highway'))) and (mapcss._tag_capture(capture_tags, 1, tags, 'highway') != mapcss._value_const_capture(capture_tags, 1, 'motorway_junction', 'motorway_junction')) and (mapcss._tag_capture(capture_tags, 2, tags, 'highway') != mapcss._value_const_capture(capture_tags, 2, 'services', 'services')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("wrong highway tag on a node")
                # assertNoMatch:"node highway=bus_stop"
                # assertNoMatch:"node highway=crossing"
                # assertNoMatch:"node highway=emergency_access_point"
                # assertNoMatch:"node highway=give_way"
                # assertNoMatch:"node highway=mini_roundabout"
                # assertNoMatch:"node highway=motorway_junction"
                # assertNoMatch:"node highway=passing_place"
                # assertMatch:"node highway=primary"
                # assertMatch:"node highway=primary_link"
                # assertNoMatch:"node highway=rest_area"
                # assertNoMatch:"node highway=services"
                # assertNoMatch:"node highway=speed_camera"
                # assertNoMatch:"node highway=stop"
                # assertNoMatch:"node highway=street_lamp"
                # assertNoMatch:"node highway=traffic_calming"
                # assertNoMatch:"node highway=traffic_signals"
                # assertNoMatch:"node highway=turning_circle"
                err.append({'class': 9004008, 'subclass': 224371448, 'text': mapcss.tr('wrong highway tag on a node')})

        # node[footway=crossing]
        if ('footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'crossing')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node","{0.tag}")
                # suggestAlternative:"highway=crossing"
                # suggestAlternative:"railway=crossing"
                err.append({'class': 9004010, 'subclass': 1262520638, 'text': mapcss.tr('{0} on a node', mapcss._tag_uncapture(capture_tags, '{0.tag}'))})

        # node[cycleway=crossing]
        if ('cycleway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'cycleway') == mapcss._value_capture(capture_tags, 0, 'crossing')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node","{0.tag}")
                # suggestAlternative:"highway=crossing + bicycle=yes"
                # suggestAlternative:"railway=crossing + bicycle=yes"
                err.append({'class': 9004010, 'subclass': 1385847744, 'text': mapcss.tr('{0} on a node', mapcss._tag_uncapture(capture_tags, '{0.tag}'))})

        # node[railway!=crossing][crossing!=no].is_in_railway.is_in_minor_road!.is_in_major_road
        if True:
            match = False
            # Skip selector using undeclared class is_in_major_road, is_in_minor_road, is_in_railway
            if match:
                # group:tr("missing tag")
                # throwWarning:tr("pedestrian railway crossing without {0}","{0.tag}")
                # fixAdd:"railway=crossing"
                err.append({'class': 9004009, 'subclass': 18813378, 'text': mapcss.tr('pedestrian railway crossing without {0}', mapcss._tag_uncapture(capture_tags, '{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['railway','crossing']])
                }})

        # node[railway!=level_crossing].is_in_railway.is_in_major_road!.is_in_minor_road
        if True:
            match = False
            # Skip selector using undeclared class is_in_major_road, is_in_minor_road, is_in_railway
            if match:
                # group:tr("missing tag")
                # throwWarning:tr("railway crossing without {0}","{0.tag}")
                # fixAdd:"railway=level_crossing"
                err.append({'class': 9004009, 'subclass': 1127761651, 'text': mapcss.tr('railway crossing without {0}', mapcss._tag_uncapture(capture_tags, '{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['railway','level_crossing']])
                }})

        # node[highway=crossing][barrier=kerb].is_in_major_road
        if ('barrier' in keys and 'highway' in keys):
            match = False
            # Skip selector using undeclared class is_in_major_road
            if match:
                # group:tr("suspicious tag combination")
                # throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
                # suggestAlternative:"kerb=*"
                err.append({'class': 9004011, 'subclass': 440952770, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

        return err
Example #17
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # way[cycleway][cycleway:right][cycleway:left]
        if (u'cycleway' in keys and u'cycleway:left' in keys
                and u'cycleway:right' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'cycleway')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'cycleway:right')
                             and mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'cycleway:left'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("cycleway","fix:chair")
                # -osmoseItemClassLevel:"4030/40301/2"
                # throwWarning:tr("{0} with {1} and {2}","{0.key}","{1.key}","{2.key}")
                # assertMatch:"way cycleway=a cycleway:right=b cycleway:left=c"
                err.append({
                    'class':
                    40301,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'{0} with {1} and {2}',
                              mapcss._tag_uncapture(capture_tags, u'{0.key}'),
                              mapcss._tag_uncapture(capture_tags, u'{1.key}'),
                              mapcss._tag_uncapture(capture_tags, u'{2.key}'))
                })

        # way[footway=sidewalk][highway!~/footway|construction/]
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'footway')
                        == mapcss._value_capture(capture_tags, 0, u'sidewalk')
                        and not mapcss.regexp_test(
                            mapcss._value_const_capture(
                                capture_tags, 1, self.re_1825c777,
                                u'footway|construction'),
                            mapcss._tag_capture(capture_tags, 1, tags,
                                                u'highway')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("footway","fix:chair")
                # -osmoseItemClassLevel:"2080/20805/3"
                # throwWarning:tr("{0} without {1}","{0.tag}","highway=footway|construction")
                # assertNoMatch:"way footway=sidewalk highway=construction construction=footway"
                # assertNoMatch:"way footway=sidewalk highway=footway"
                # assertMatch:"way footway=sidewalk highway=path"
                err.append({
                    'class':
                    20805,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'{0} without {1}',
                              mapcss._tag_uncapture(capture_tags, u'{0.tag}'),
                              u'highway=footway|construction')
                })

        # way[highway=service][service=psv][psv!=yes]
        if (u'highway' in keys and u'service' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'service')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'service')
                        == mapcss._value_capture(capture_tags, 1, u'psv')
                        and mapcss._tag_capture(capture_tags, 2, tags, u'psv')
                        != mapcss._value_const_capture(capture_tags, 2, u'yes',
                                                       u'yes'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("fix:chair")
                # -osmoseItemClassLevel:"4010/40101/2"
                # throwWarning:tr("{0} is preferred to {1}","{2.tag}","{1.tag}")
                # fixAdd:"psv=yes"
                # fixRemove:"service"
                # assertMatch:"way highway=service service=psv psv=no"
                # assertNoMatch:"way highway=service service=psv psv=yes"
                err.append({
                    'class':
                    40101,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'{0} is preferred to {1}',
                              mapcss._tag_uncapture(capture_tags, u'{2.tag}'),
                              mapcss._tag_uncapture(capture_tags, u'{1.tag}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+': dict([[u'psv', u'yes']]),
                        '-': ([u'service'])
                    }
                })

        # way[highway=cycleway][cycleway=track]
        if (u'cycleway' in keys and u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'highway')
                        == mapcss._value_capture(capture_tags, 0, u'cycleway')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'cycleway')
                        == mapcss._value_capture(capture_tags, 1, u'track'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("cycleway","fix:chair")
                # -osmoseItemClassLevel:"3032/30328/2"
                # throwWarning:tr("{0} with {1}","{0.tag}","{1.tag}")
                # fixRemove:"cycleway"
                err.append({
                    'class':
                    30328,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'{0} with {1}',
                              mapcss._tag_uncapture(capture_tags, u'{0.tag}'),
                              mapcss._tag_uncapture(capture_tags, u'{1.tag}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-': ([u'cycleway'])
                    }
                })

        # way[bicycle=~/no|use_sidepath/][cycleway][cycleway!~/no|none|separate/]
        # way[bicycle=~/no|use_sidepath/][cycleway:left][cycleway:left!~/no|none|separate/]
        # way[bicycle=~/no|use_sidepath/][cycleway:right][cycleway:right!~/no|none|separate/]
        if (u'bicycle' in keys and u'cycleway' in keys) or (
                u'bicycle' in keys and u'cycleway:left'
                in keys) or (u'bicycle' in keys and u'cycleway:right' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_5b286a0d),
                        mapcss._tag_capture(capture_tags, 0, tags, u'bicycle'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'cycleway')
                             and not mapcss.regexp_test(
                                 mapcss._value_const_capture(
                                     capture_tags, 2, self.re_6781a1fd,
                                     u'no|none|separate'),
                                 mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'cycleway')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_5b286a0d),
                        mapcss._tag_capture(capture_tags, 0, tags, u'bicycle'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'cycleway:left')
                             and not mapcss.regexp_test(
                                 mapcss._value_const_capture(
                                     capture_tags, 2, self.re_6781a1fd,
                                     u'no|none|separate'),
                                 mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'cycleway:left')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_5b286a0d),
                        mapcss._tag_capture(capture_tags, 0, tags, u'bicycle'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'cycleway:right')
                             and not mapcss.regexp_test(
                                 mapcss._value_const_capture(
                                     capture_tags, 2, self.re_6781a1fd,
                                     u'no|none|separate'),
                                 mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'cycleway:right')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("fix:chair")
                # -osmoseItemClassLevel:"3032/30329/2"
                # throwWarning:tr("{0} with {1}","{0.tag}","{1.tag}")
                # assertNoMatch:"way bicycle=no cycleway:right=no"
                # assertMatch:"way bicycle=no cycleway=track"
                # assertMatch:"way bicycle=use_sidepath cycleway:left=lane"
                # assertNoMatch:"way bicycle=use_sidepath cycleway:left=none"
                # assertNoMatch:"way highway=cycleway cycleway=separate"
                # assertNoMatch:"way highway=residential bicycle=use_sidepath"
                err.append({
                    'class':
                    30329,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'{0} with {1}',
                              mapcss._tag_uncapture(capture_tags, u'{0.tag}'),
                              mapcss._tag_uncapture(capture_tags, u'{1.tag}'))
                })

        # way[cycleway=~/opposite|opposite_lane/][!oneway]
        # way[cycleway=~/opposite|opposite_lane/][oneway=no]
        if (u'cycleway' in keys) or (u'cycleway' in keys
                                     and u'oneway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_67b51e41),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'cycleway'))
                             and not mapcss._tag_capture(
                                 capture_tags, 1, tags, u'oneway'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_67b51e41),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'cycleway'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'oneway')
                             == mapcss._value_capture(capture_tags, 1, u'no'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("cycleway","fix:survey")
                # -osmoseItemClassLevel:"2030/20301/1"
                # throwError:tr("Opposite cycleway without oneway")
                # assertNoMatch:"way cycleway=lane oneway=yes"
                # assertNoMatch:"way cycleway=opposite oneway=yes"
                # assertMatch:"way cycleway=opposite"
                err.append({
                    'class':
                    20301,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'Opposite cycleway without oneway')
                })

        # way:righthandtraffic["cycleway:right"=~/opposite|opposite_lane/][oneway=yes]
        # way:righthandtraffic["cycleway:left"=~/opposite|opposite_lane/][oneway="-1"]
        # way!:righthandtraffic["cycleway:left"=~/opposite|opposite_lane/][oneway=yes]
        # way!:righthandtraffic["cycleway:right"=~/opposite|opposite_lane/][oneway="-1"]
        if (u'cycleway:left' in keys
                and u'oneway' in keys) or (u'cycleway:right' in keys
                                           and u'oneway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_67b51e41),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'cycleway:right'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'oneway')
                             == mapcss._value_capture(capture_tags, 1, u'yes')
                             and mapcss.setting(self.father.config.options,
                                                u'driving_side') != u'left')
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_67b51e41),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'cycleway:left'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'oneway')
                             == mapcss._value_capture(capture_tags, 1, u'-1')
                             and mapcss.setting(self.father.config.options,
                                                u'driving_side') != u'left')
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_67b51e41),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'cycleway:left'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'oneway')
                             == mapcss._value_capture(capture_tags, 1, u'yes')
                             and mapcss.setting(self.father.config.options,
                                                u'driving_side') == u'left')
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_67b51e41),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'cycleway:right'))
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'oneway')
                             == mapcss._value_capture(capture_tags, 1, u'-1')
                             and mapcss.setting(self.father.config.options,
                                                u'driving_side') == u'left')
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("cycleway","fix:survey")
                # -osmoseItemClassLevel:"2030/20302/1"
                # throwError:tr("Opposite or opposite lane in the same way of the oneway")
                # assertMatch:"way cycleway:right=opposite oneway=yes"
                # assertNoMatch:"way cycleway=opposite oneway=yes"
                err.append({
                    'class':
                    20302,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Opposite or opposite lane in the same way of the oneway'
                       )
                })

        return err
Example #18
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[cycleway][cycleway:right][cycleway:left]
        if (u'cycleway' in keys and u'cycleway:left' in keys and u'cycleway:right' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'cycleway') and mapcss._tag_capture(capture_tags, 1, tags, u'cycleway:right') and mapcss._tag_capture(capture_tags, 2, tags, u'cycleway:left'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("cycleway","fix:chair")
                # -osmoseItemClassLevel:"4030/40301/2"
                # throwWarning:tr("{0} with {1} and {2}","{0.key}","{1.key}","{2.key}")
                # assertMatch:"way cycleway=a cycleway:right=b cycleway:left=c"
                err.append({'class': 40301, 'subclass': 0, 'text': mapcss.tr(u'{0} with {1} and {2}', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.key}'), mapcss._tag_uncapture(capture_tags, u'{2.key}'))})

        # way[footway=sidewalk][highway!~/footway|construction/]
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'sidewalk') and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_1825c777), mapcss._tag_capture(capture_tags, 1, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("footway","fix:chair")
                # -osmoseItemClassLevel:"2080/20805/3"
                # throwWarning:tr("{0} without {1}","{0.tag}","highway=footway|construction")
                # assertNoMatch:"way footway=sidewalk highway=construction construction=footway"
                # assertNoMatch:"way footway=sidewalk highway=footway"
                # assertMatch:"way footway=sidewalk highway=path"
                err.append({'class': 20805, 'subclass': 0, 'text': mapcss.tr(u'{0} without {1}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), u'highway=footway|construction')})

        # way[highway=service][service=psv][psv!=yes]
        if (u'highway' in keys and u'service' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'service') and mapcss._tag_capture(capture_tags, 1, tags, u'service') == mapcss._value_capture(capture_tags, 1, u'psv') and mapcss._tag_capture(capture_tags, 2, tags, u'psv') != mapcss._value_capture(capture_tags, 2, u'yes'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("fix:chair")
                # -osmoseItemClassLevel:"4010/40101/2"
                # throwWarning:tr("{0} is preferred to {1}","{2.tag}","{1.tag}")
                # fixAdd:"psv=yes"
                # fixRemove:"service"
                # assertMatch:"way highway=service service=psv psv=no"
                # assertNoMatch:"way highway=service service=psv psv=yes"
                err.append({'class': 40101, 'subclass': 0, 'text': mapcss.tr(u'{0} is preferred to {1}', mapcss._tag_uncapture(capture_tags, u'{2.tag}'), mapcss._tag_uncapture(capture_tags, u'{1.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'psv',u'yes']]),
                    '-': ([
                    u'service'])
                }})

        # way[highway=cycleway][cycleway=track]
        if (u'cycleway' in keys and u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'cycleway') and mapcss._tag_capture(capture_tags, 1, tags, u'cycleway') == mapcss._value_capture(capture_tags, 1, u'track'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("cycleway","fix:chair")
                # -osmoseItemClassLevel:"3032/30328/2"
                # throwWarning:tr("{0} with {1}","{0.tag}","{1.tag}")
                # fixRemove:"cycleway"
                err.append({'class': 30328, 'subclass': 0, 'text': mapcss.tr(u'{0} with {1}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), mapcss._tag_uncapture(capture_tags, u'{1.tag}')), 'allow_fix_override': True, 'fix': {
                    '-': ([
                    u'cycleway'])
                }})

        # way[cycleway=~/opposite|opposite_lane/][!oneway]
        # way[cycleway=~/opposite|opposite_lane/][oneway=no]
        if (u'cycleway' in keys) or (u'cycleway' in keys and u'oneway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_67b51e41), mapcss._tag_capture(capture_tags, 0, tags, u'cycleway')) and not mapcss._tag_capture(capture_tags, 1, tags, u'oneway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_67b51e41), mapcss._tag_capture(capture_tags, 0, tags, u'cycleway')) and mapcss._tag_capture(capture_tags, 1, tags, u'oneway') == mapcss._value_capture(capture_tags, 1, u'no'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("cycleway","fix:survey")
                # -osmoseItemClassLevel:"2030/20301/1"
                # throwError:tr("Opposite cycleway without oneway")
                # assertNoMatch:"way cycleway=lane oneway=yes"
                # assertNoMatch:"way cycleway=opposite oneway=yes"
                # assertMatch:"way cycleway=opposite"
                err.append({'class': 20301, 'subclass': 0, 'text': mapcss.tr(u'Opposite cycleway without oneway')})

        # way:righthandtraffic["cycleway:right"=~/opposite|opposite_lane/][oneway=yes]
        # way:righthandtraffic["cycleway:left"=~/opposite|opposite_lane/][oneway="-1"]
        # way!:righthandtraffic["cycleway:left"=~/opposite|opposite_lane/][oneway=yes]
        # way!:righthandtraffic["cycleway:right"=~/opposite|opposite_lane/][oneway="-1"]
        if (u'cycleway:left' in keys and u'oneway' in keys) or (u'cycleway:right' in keys and u'oneway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_67b51e41), mapcss._tag_capture(capture_tags, 0, tags, u'cycleway:right')) and mapcss._tag_capture(capture_tags, 1, tags, u'oneway') == mapcss._value_capture(capture_tags, 1, u'yes') and mapcss.setting(self.father.config.options, u'driving_side') != u'left')
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_67b51e41), mapcss._tag_capture(capture_tags, 0, tags, u'cycleway:left')) and mapcss._tag_capture(capture_tags, 1, tags, u'oneway') == mapcss._value_capture(capture_tags, 1, u'-1') and mapcss.setting(self.father.config.options, u'driving_side') != u'left')
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_67b51e41), mapcss._tag_capture(capture_tags, 0, tags, u'cycleway:left')) and mapcss._tag_capture(capture_tags, 1, tags, u'oneway') == mapcss._value_capture(capture_tags, 1, u'yes') and mapcss.setting(self.father.config.options, u'driving_side') == u'left')
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_67b51e41), mapcss._tag_capture(capture_tags, 0, tags, u'cycleway:right')) and mapcss._tag_capture(capture_tags, 1, tags, u'oneway') == mapcss._value_capture(capture_tags, 1, u'-1') and mapcss.setting(self.father.config.options, u'driving_side') == u'left')
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseTags:list("cycleway","fix:survey")
                # -osmoseItemClassLevel:"2030/20302/1"
                # throwError:tr("Opposite or opposite lane in the same way of the oneway")
                # assertMatch:"way cycleway:right=opposite oneway=yes"
                # assertNoMatch:"way cycleway=opposite oneway=yes"
                err.append({'class': 20302, 'subclass': 0, 'text': mapcss.tr(u'Opposite or opposite lane in the same way of the oneway')})

        return err
Example #19
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[building:colour][building:colour=~/^#/][building:colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[roof:colour][roof:colour=~/^#/][roof:colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[ref:colour][ref:colour=~/^#/][ref:colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        if (u'building:colour' in keys) or (u'ref:colour' in keys) or (u'roof:colour' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'building:colour')) and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 2, self.re_1b3f6ace), mapcss._tag_capture(capture_tags, 2, tags, u'building:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'roof:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'roof:colour')) and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 2, self.re_1b3f6ace), mapcss._tag_capture(capture_tags, 2, tags, u'roof:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'ref:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'ref:colour')) and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 2, self.re_1b3f6ace), mapcss._tag_capture(capture_tags, 2, tags, u'ref:colour')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Colour code should start with '#' followed by 3 or 6 digits")
                # -osmoseItemClassLevel:"3091/30911:0/2"
                # throwWarning:tr("{0} colour code should start with '#' followed by 3 or 6 digits","{0.tag}")
                # assertNoMatch:"way building:colour=#123"
                # assertMatch:"way building:colour=#1234"
                # assertNoMatch:"way building:colour=#abcdef"
                # assertMatch:"way building:colour=#foobar9"
                # assertMatch:"way building:colour=#zzz"
                # assertNoMatch:"way roof:colour=#484443 building:colour=#8c6b57"
                err.append({'class': 30911, 'subclass': 0, 'text': mapcss.tr(u'{0} colour code should start with \'#\' followed by 3 or 6 digits', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # *[building:colour][building:colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[roof:colour][roof:colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[ref:colour][ref:colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        if (u'building:colour' in keys) or (u'ref:colour' in keys) or (u'roof:colour' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'building:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'roof:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'roof:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'ref:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'ref:colour')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Colour code should start with '#' followed by 3 or 6 digits")
                # -osmoseItemClassLevel:"3091/30911:1/2"
                # throwWarning:tr("{0} colour code should start with '#' followed by 3 or 6 digits","{0.tag}")
                # fixAdd:"{0.key}=#{0.value}"
                # assertNoMatch:"way building:colour=#123"
                # assertMatch:"way building:colour=123"
                # assertMatch:"way building:colour=abcdef"
                # assertNoMatch:"way building:colour=red"
                # assertNoMatch:"way roof:colour=#484443 building:colour=#8c6b57"
                err.append({'class': 30911, 'subclass': 1, 'text': mapcss.tr(u'{0} colour code should start with \'#\' followed by 3 or 6 digits', mapcss._tag_uncapture(capture_tags, u'{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    (mapcss._tag_uncapture(capture_tags, u'{0.key}=#{0.value}')).split('=', 1)])
                }})

        return err
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # *[name=~/(?i)co.?voiturage/][amenity!=car_pooling][!carpool][inside("FR")]
        if (u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss.regexp_test(
                            mapcss._value_capture(capture_tags, 0,
                                                  self.re_045a0f34),
                            mapcss._tag_capture(capture_tags, 0, tags,
                                                u'name')) and
                        mapcss._tag_capture(capture_tags, 1, tags, u'amenity')
                        != mapcss._value_const_capture(
                            capture_tags, 1, u'car_pooling', u'car_pooling')
                        and not mapcss._tag_capture(capture_tags, 2, tags,
                                                    u'carpool')
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("parking","amenity","fix:chair")
                # -osmoseItemClassLevel:"2080/20806/3"
                # throwWarning:tr("Missing tag carpool on area")
                # fixAdd:"amenity=car_pooling"
                # fixAdd:"carpool=designated"
                # -osmoseAssertMatchWithContext:list("node name='Aire de Covoiturage' amenity=parking","inside=FR")
                err.append({
                    'class': 20806,
                    'subclass': 0,
                    'text': mapcss.tr(u'Missing tag carpool on area'),
                    'allow_fix_override': True,
                    'fix': {
                        '+':
                        dict([[u'amenity', u'car_pooling'],
                              [u'carpool', u'designated']])
                    }
                })

        # *[amenity=fuel][fuel:octane_95=yes][!fuel:e10][inside("FR")]
        if (u'amenity' in keys and u'fuel:octane_95' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'amenity')
                        == mapcss._value_capture(capture_tags, 0, u'fuel')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'fuel:octane_95')
                        == mapcss._value_capture(capture_tags, 1, u'yes')
                        and not mapcss._tag_capture(capture_tags, 2, tags,
                                                    u'fuel:e10')
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("parking","amenity","fix:chair")
                # -osmoseItemClassLevel:"4061/40612/2"
                # throwWarning:tr("Does this station still sell SP95, or has it been replaced by the SP95-E10?")
                # suggestAlternative:"fuel:e10=yes/no"
                err.append({
                    'class':
                    40612,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Does this station still sell SP95, or has it been replaced by the SP95-E10?'
                       )
                })

        return err
Example #21
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *["addr:street"=~/.+;(.+)?/]
        # *[highway=~/.+;(.+)?/]
        # *[lanes=~/.+;(.+)?/]
        # *[maxspeed=~/.+;(.+)?/]
        # *[name=~/.+;(.+)?/]
        # *[surface=~/.+;(.+)?/]
        # *[water=~/.+;(.+)?/]
        if (u'addr:street' in keys) or (u'highway' in keys) or (u'lanes' in keys) or (u'maxspeed' in keys) or (u'name' in keys) or (u'surface' in keys) or (u'water' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'lanes')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'maxspeed')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'surface')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'water')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} with multiple values","{0.key}")
                err.append({'class': 9005001, 'subclass': 1911063816, 'text': mapcss.tr(u'{0} with multiple values', mapcss._tag_uncapture(capture_tags, u'{0.key}'))})

        # *[source=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:addr"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:maxspeed"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:name"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:position"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:postcode"=~/^(;.*|.*;;.*|.*;)$/]
        # *[ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[int_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[old_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[source_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[route_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[attribution=~/^(;.*|.*;;.*|.*;)$/]
        # *[name=~/^(;.*|.*;;.*|.*;)$/]
        # *[alt_name=~/^(;.*|.*;;.*|.*;)$/]
        # *[note=~/^(;.*|.*;;.*|.*;)$/]
        # *[fixme=~/^(;.*|.*;;.*|.*;)$/]
        # *["addr:housenumber"=~/^(;.*|.*;;.*|.*;)$/]
        # *[destination=~/^(;.*|.*;;.*|.*;)$/]
        # *[exit_to=~/^(;.*|.*;;.*|.*;)$/]
        # *[surface=~/^(;.*|.*;;.*|.*;)$/]
        # *["building:use"=~/^(;.*|.*;;.*|.*;)$/]
        # *[traffic_sign=~/^(;.*|.*;;.*|.*;)$/]
        # *[voltage=~/^(;.*|.*;;.*|.*;)$/]
        # *[cuisine=~/^(;.*|.*;;.*|.*;)$/]
        if (u'addr:housenumber' in keys) or (u'alt_name' in keys) or (u'attribution' in keys) or (u'building:use' in keys) or (u'cuisine' in keys) or (u'destination' in keys) or (u'exit_to' in keys) or (u'fixme' in keys) or (u'int_ref' in keys) or (u'name' in keys) or (u'note' in keys) or (u'old_ref' in keys) or (u'ref' in keys) or (u'route_ref' in keys) or (u'source' in keys) or (u'source:addr' in keys) or (u'source:maxspeed' in keys) or (u'source:name' in keys) or (u'source:position' in keys) or (u'source:postcode' in keys) or (u'source_ref' in keys) or (u'surface' in keys) or (u'traffic_sign' in keys) or (u'voltage' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:addr')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:maxspeed')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:position')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:postcode')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'int_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'old_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'route_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'attribution')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'alt_name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'note')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'fixme')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'addr:housenumber')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'destination')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'exit_to')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'surface')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'building:use')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'traffic_sign')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'voltage')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'cuisine')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("empty value in semicolon-separated ''{0}''","{0.key}")
                err.append({'class': 9005002, 'subclass': 978530936, 'text': mapcss.tr(u'empty value in semicolon-separated \'\'{0}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'))})

        return err
Example #22
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # way[highway=~/^(motorway|trunk|primary|secondary|tertiary)$/]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_55ee32ac), mapcss._tag_capture(capture_tags, 0, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if match:
                # setmajor_road
                set_major_road = True

        # way[highway=~/^.*_link$/]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3092b7ac), mapcss._tag_capture(capture_tags, 0, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if match:
                # setlink_road
                set_link_road = True

        # way[highway=~/^(unclassified|residential|living_street|service)$/]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_015aabd5), mapcss._tag_capture(capture_tags, 0, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if match:
                # setminor_road
                set_minor_road = True

        # way[highway][name=~/(?i).* (Ave|Blvd|Br|Brg|Cct|Cir|Cl|Cr|Crct|Cres|Crt|Ct|Dr|Drv|Esp|Espl|Hwy|Ln|Mw|Mwy|Pky|Pkwy|Pl|Rd|Qy|Qys|Sq|St|Str|Ter|Tce|Tr|Wy)[.]?$/]
        if (u'highway' in keys and u'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_776f2c1a), mapcss._tag_capture(capture_tags, 1, tags, u'name')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("abbreviated street name")
                # assertMatch:"way highway=unclassified name=\"Bou Blvd.\""
                # assertMatch:"way highway=unclassified name=\"Bou blvd.\""
                # assertMatch:"way highway=unclassified name=\"Foo Ave\""
                # assertMatch:"way highway=unclassified name=\"Foo Ave.\""
                err.append({'class': 9004001, 'subclass': 544432044, 'text': mapcss.tr(u'abbreviated street name')})

        # way[highway=crossing]
        # way[railway=crossing]
        # way[railway=level_crossing]
        if (u'highway' in keys) or (u'railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'crossing'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'crossing'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'level_crossing'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("wrong crossing tag on a way")
                # assertMatch:"way highway=crossing"
                err.append({'class': 9004002, 'subclass': 1549110307, 'text': mapcss.tr(u'wrong crossing tag on a way')})

        # way[highway=yes]
        # way[highway=road]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'yes'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'road'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Unspecific highway type")
                # assertNoMatch:"way highway=residential"
                # assertMatch:"way highway=road"
                err.append({'class': 9004004, 'subclass': 1729022478, 'text': mapcss.tr(u'Unspecific highway type')})

        # way[highway=footway][maxspeed]
        # way[highway=steps][maxspeed]
        # way[highway=cycleway][bicycle=no]
        # way[highway=footway][foot=no]
        # way[highway=cycleway][cycleway=lane]
        if (u'bicycle' in keys and u'highway' in keys) or (u'cycleway' in keys and u'highway' in keys) or (u'foot' in keys and u'highway' in keys) or (u'highway' in keys and u'maxspeed' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'footway') and mapcss._tag_capture(capture_tags, 1, tags, u'maxspeed'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'steps') and mapcss._tag_capture(capture_tags, 1, tags, u'maxspeed'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'cycleway') and mapcss._tag_capture(capture_tags, 1, tags, u'bicycle') == mapcss._value_capture(capture_tags, 1, u'no'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'footway') and mapcss._tag_capture(capture_tags, 1, tags, u'foot') == mapcss._value_capture(capture_tags, 1, u'no'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'cycleway') and mapcss._tag_capture(capture_tags, 1, tags, u'cycleway') == mapcss._value_capture(capture_tags, 1, u'lane'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} used with {1}","{0.value}","{1.tag}")
                # assertNoMatch:"way highway=cycleway bicycle=yes"
                # assertMatch:"way highway=cycleway cycleway=lane"
                # assertNoMatch:"way highway=cycleway"
                # assertNoMatch:"way highway=cycleway"
                # assertNoMatch:"way highway=footway foot=yes"
                # assertMatch:"way highway=footway maxspeed=20"
                # assertNoMatch:"way highway=footway"
                # assertNoMatch:"way highway=footway"
                # assertNoMatch:"way highway=residential cycleway=lane"
                # assertNoMatch:"way highway=residential maxspeed=20"
                err.append({'class': 9004005, 'subclass': 469607562, 'text': mapcss.tr(u'{0} used with {1}', mapcss._tag_uncapture(capture_tags, u'{0.value}'), mapcss._tag_uncapture(capture_tags, u'{1.tag}'))})

        # way[footway=left][/^footway:/]
        # way[footway=right][/^footway:/]
        # way[footway=both][/^footway:/]
        # way[footway=no][/^footway:/]
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'left') and mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'right') and mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'both') and mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'no') and mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354))
                except mapcss.RuleAbort: pass
            if match:
                # setnot_fixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}","{0.tag}","sidewalk","{1.key}")
                # assertMatch:"way footway=both footway:surface=asphalt"
                set_not_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 141262069, 'text': mapcss.tr(u'{0} is deprecated, use {1} instead. Also check similar tags like {2}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), u'sidewalk', mapcss._tag_uncapture(capture_tags, u'{1.key}'))})

        # way[footway=none][/footway:/]
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'none') and mapcss._tag_capture(capture_tags, 1, tags, self.re_61bbe299))
                except mapcss.RuleAbort: pass
            if match:
                # setnot_fixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}","{0.tag}","sidewalk=no","{1.key}")
                set_not_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 1570348899, 'text': mapcss.tr(u'{0} is deprecated, use {1} instead. Also check similar tags like {2}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), u'sidewalk=no', mapcss._tag_uncapture(capture_tags, u'{1.key}'))})

        # way[footway=left]!.not_fixable_footway
        # way[footway=right]!.not_fixable_footway
        # way[footway=both]!.not_fixable_footway
        # way[footway=no]!.not_fixable_footway
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (not set_not_fixable_footway and mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'left'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (not set_not_fixable_footway and mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'right'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (not set_not_fixable_footway and mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'both'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (not set_not_fixable_footway and mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'no'))
                except mapcss.RuleAbort: pass
            if match:
                # setfixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"sidewalk"
                # fixChangeKey:"footway => sidewalk"
                set_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 2076937761, 'text': mapcss.tr(u'{0} is deprecated', mapcss._tag_uncapture(capture_tags, u'{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'sidewalk', mapcss.tag(tags, u'footway')]]),
                    '-': ([
                    u'footway'])
                }})

        # way[footway=none]!.not_fixable_footway
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (not set_not_fixable_footway and mapcss._tag_capture(capture_tags, 0, tags, u'footway') == mapcss._value_capture(capture_tags, 0, u'none'))
                except mapcss.RuleAbort: pass
            if match:
                # setfixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"sidewalk=no"
                # fixRemove:"footway"
                # fixAdd:"sidewalk=no"
                set_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 430589555, 'text': mapcss.tr(u'{0} is deprecated', mapcss._tag_uncapture(capture_tags, u'{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'sidewalk',u'no']]),
                    '-': ([
                    u'footway'])
                }})

        # way[footway][footway!=sidewalk][footway!=crossing]!.fixable_footway!.not_fixable_footway
        if (u'footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (not set_fixable_footway and not set_not_fixable_footway and mapcss._tag_capture(capture_tags, 0, tags, u'footway') and mapcss._tag_capture(capture_tags, 1, tags, u'footway') != mapcss._value_capture(capture_tags, 1, u'sidewalk') and mapcss._tag_capture(capture_tags, 2, tags, u'footway') != mapcss._value_capture(capture_tags, 2, u'crossing'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Value of ''{0}'' should either be ''{1}'' or ''{2}''. For sidewalks use ''{3}'' instead.","{0.key}","{1.value}","{2.value}","sidewalk=left|right|both|no")
                # assertMatch:"way footway=bar"
                # assertNoMatch:"way footway=left footway:left:surface=asphalt"
                # assertNoMatch:"way footway=left"
                # assertNoMatch:"way footway=none"
                err.append({'class': 9004007, 'subclass': 156640320, 'text': mapcss.tr(u'Value of \'\'{0}\'\' should either be \'\'{1}\'\' or \'\'{2}\'\'. For sidewalks use \'\'{3}\'\' instead.', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.value}'), mapcss._tag_uncapture(capture_tags, u'{2.value}'), u'sidewalk=left|right|both|no')})

        return err
Example #23
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[access][highway=proposed]
        # *[motor_vehicle?][vehicle!=no][access!=no][bicycle_road!=yes][highway=~/^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified|residential|service|living_street)$/]
        # *[bridge=no]
        # *[building=no]
        # *[elevation="0"]
        # *[layer="0"]
        if (u'access' in keys and u'highway' in keys) or (u'bridge' in keys) or (u'building' in keys) or (u'elevation' in keys) or (u'highway' in keys and u'motor_vehicle' in keys) or (u'layer' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'access') and mapcss._tag_capture(capture_tags, 1, tags, u'highway') == mapcss._value_capture(capture_tags, 1, u'proposed'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'motor_vehicle') in ('yes', 'true', '1') and mapcss._tag_capture(capture_tags, 1, tags, u'vehicle') != mapcss._value_capture(capture_tags, 1, u'no') and mapcss._tag_capture(capture_tags, 2, tags, u'access') != mapcss._value_capture(capture_tags, 2, u'no') and mapcss._tag_capture(capture_tags, 3, tags, u'bicycle_road') != mapcss._value_capture(capture_tags, 3, u'yes') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 4, self.re_3ad9e1f5), mapcss._tag_capture(capture_tags, 4, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'bridge') == mapcss._value_capture(capture_tags, 0, u'no'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building') == mapcss._value_capture(capture_tags, 0, u'no'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'elevation') == mapcss._value_capture(capture_tags, 0, u'0'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'layer') == mapcss._value_capture(capture_tags, 0, u'0'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("unnecessary tag")
                # throwWarning:tr("{0} is unnecessary","{0.tag}")
                # fixRemove:"{0.key}"
                err.append({'class': 9010001, 'subclass': 1949087363, 'text': mapcss.tr(u'{0} is unnecessary', mapcss._tag_uncapture(capture_tags, u'{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '-': ([
                    mapcss._tag_uncapture(capture_tags, u'{0.key}')])
                }})

        # *[emergency=permissive]
        if (u'emergency' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'emergency') == mapcss._value_capture(capture_tags, 0, u'permissive'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} makes no sense","{0.tag")
                # fixAdd:"emergency=yes"
                err.append({'class': 9010002, 'subclass': 325672362, 'text': mapcss.tr(u'{0} makes no sense', u'{0.tag'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'emergency',u'yes']])
                }})

        # *[payment:cash][payment:coins][payment:notes]
        if (u'payment:cash' in keys and u'payment:coins' in keys and u'payment:notes' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'payment:cash') and mapcss._tag_capture(capture_tags, 1, tags, u'payment:coins') and mapcss._tag_capture(capture_tags, 2, tags, u'payment:notes'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("unnecessary tag")
                # throwWarning:tr("{0} together with {1} and {2}. Remove {0}.","{0.key}","{1.key}","{2.key}")
                # fixRemove:"payment:cash"
                err.append({'class': 9010001, 'subclass': 1340792439, 'text': mapcss.tr(u'{0} together with {1} and {2}. Remove {0}.', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.key}'), mapcss._tag_uncapture(capture_tags, u'{2.key}')), 'allow_fix_override': True, 'fix': {
                    '-': ([
                    u'payment:cash'])
                }})

        return err
Example #24
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[emergency=fire_hydrant]
        # way[entrance]
        # way[door]
        # way[railway=subway_entrance]
        # way[man_made=survey_point]
        # way[aeroway=holding_position]
        # way[power=transformer]
        # way[power=pole]
        # way[power=catenary_mast]
        # way[power=terminal]
        # way[power=tower]!:closed
        # way[amenity=vending_machine]
        # way[natural=peak]
        # way[natural=saddle]
        # way[natural=volcano]
        # way[natural=tree]
        # way[highway=give_way]
        # way[highway=milestone]
        # way[highway=mini_roundabout]
        # way[highway=stop]
        # way[highway=street_lamp]
        # way[highway=traffic_signals]
        # way[highway=turning_loop]
        # way[highway=turning_circle]
        # way[highway=motorway_junction]
        if (u'aeroway' in keys) or (u'amenity' in keys) or (u'door' in keys) or (u'emergency' in keys) or (u'entrance' in keys) or (u'highway' in keys) or (u'man_made' in keys) or (u'natural' in keys) or (u'power' in keys) or (u'railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'emergency') == mapcss._value_capture(capture_tags, 0, u'fire_hydrant'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'entrance'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'door'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'subway_entrance'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'survey_point'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'holding_position'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'transformer'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'pole'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'catenary_mast'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'terminal'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'tower') and nds[0] == nds[-1])
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'amenity') == mapcss._value_capture(capture_tags, 0, u'vending_machine'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'peak'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'saddle'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'volcano'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'tree'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'give_way'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'milestone'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'mini_roundabout'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'stop'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'street_lamp'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'traffic_signals'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'turning_loop'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'turning_circle'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'motorway_junction'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a way. Should be used on a node.","{0.tag}")
                err.append({'class': 9003007, 'subclass': 1144340551, 'text': mapcss.tr(u'{0} on a way. Should be used on a node.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # way[restriction][restriction=~/^(no_right_turn|no_left_turn|no_u_turn|no_straight_on|only_right_turn|only_left_turn|only_straight_on|no_entry|no_exit)$/]
        # way[type=multipolygon]
        # way[interval][route!=ferry]
        # way[route=bus]
        if (u'interval' in keys) or (u'restriction' in keys) or (u'route' in keys) or (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'restriction') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_22f56734), mapcss._tag_capture(capture_tags, 1, tags, u'restriction')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'multipolygon'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'interval') and mapcss._tag_capture(capture_tags, 1, tags, u'route') != mapcss._value_capture(capture_tags, 1, u'ferry'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'route') == mapcss._value_capture(capture_tags, 0, u'bus'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("{0} on a way. Should be used in a relation","{0.tag}")
                err.append({'class': 9003008, 'subclass': 665916193, 'text': mapcss.tr(u'{0} on a way. Should be used in a relation', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # way[place=island]!:closed
        if (u'place' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'place') == mapcss._value_capture(capture_tags, 0, u'island') and nds[0] == nds[-1])
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Way with {0} not closed.","{0.tag}")
                err.append({'class': 9003010, 'subclass': 167228643, 'text': mapcss.tr(u'Way with {0} not closed.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        return err
Example #25
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

        # way[highway=~/^(motorway|trunk|primary|secondary|tertiary)$/]
        if ('highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_55ee32ac), mapcss._tag_capture(capture_tags, 0, tags, 'highway'))))
                except mapcss.RuleAbort: pass
            if match:
                # setmajor_road
                set_major_road = True

        # way[highway=~/^.*_link$/]
        if ('highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3092b7ac), mapcss._tag_capture(capture_tags, 0, tags, 'highway'))))
                except mapcss.RuleAbort: pass
            if match:
                # setlink_road
                set_link_road = True

        # way[highway=~/^(unclassified|residential|living_street|service)$/]
        if ('highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_015aabd5), mapcss._tag_capture(capture_tags, 0, tags, 'highway'))))
                except mapcss.RuleAbort: pass
            if match:
                # setminor_road
                set_minor_road = True

        # way[highway][name=~/(?i).* (Ave|Blvd|Bnd|Br|Brg|Cct|Cir|Cl|Cr|Crct|Cres|Crt|Ct|Cv|Dr|Drv|Esp|Espl|Hwy|Ln|Mw|Mwy|Pky|Pkwy|Pl|Rd|Qy|Qys|Sq|St|Str|Ter|Tce|Tr|Trl|Vw|Wy|Xing)[.]?$/]
        if ('highway' in keys and 'name' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway')) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_4186cb68), mapcss._tag_capture(capture_tags, 1, tags, 'name'))))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("abbreviated street name")
                # assertMatch:"way highway=unclassified name=\"Bou Blvd.\""
                # assertMatch:"way highway=unclassified name=\"Bou blvd.\""
                # assertMatch:"way highway=unclassified name=\"Foo Ave\""
                # assertMatch:"way highway=unclassified name=\"Foo Ave.\""
                err.append({'class': 9004001, 'subclass': 1120623403, 'text': mapcss.tr('abbreviated street name')})

        # way[highway=crossing]
        # way[railway=crossing]
        # way[railway=level_crossing]
        if ('highway' in keys) or ('railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'crossing')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'railway') == mapcss._value_capture(capture_tags, 0, 'crossing')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'railway') == mapcss._value_capture(capture_tags, 0, 'level_crossing')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("wrong crossing tag on a way")
                # assertMatch:"way highway=crossing"
                err.append({'class': 9004002, 'subclass': 1549110307, 'text': mapcss.tr('wrong crossing tag on a way')})

        # way[highway=yes]
        # way[highway=road]
        if ('highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'yes')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'road')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Unspecific highway type")
                # assertNoMatch:"way highway=residential"
                # assertMatch:"way highway=road"
                err.append({'class': 9004004, 'subclass': 1729022478, 'text': mapcss.tr('Unspecific highway type')})

        # way[highway=footway][maxspeed]
        # way[highway=steps][maxspeed]
        # way[highway=cycleway][bicycle=no]
        # way[highway=footway][foot=no]
        # way[highway=cycleway][cycleway=lane]
        if ('bicycle' in keys and 'highway' in keys) or ('cycleway' in keys and 'highway' in keys) or ('foot' in keys and 'highway' in keys) or ('highway' in keys and 'maxspeed' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'footway')) and (mapcss._tag_capture(capture_tags, 1, tags, 'maxspeed')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'steps')) and (mapcss._tag_capture(capture_tags, 1, tags, 'maxspeed')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'cycleway')) and (mapcss._tag_capture(capture_tags, 1, tags, 'bicycle') == mapcss._value_capture(capture_tags, 1, 'no')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'footway')) and (mapcss._tag_capture(capture_tags, 1, tags, 'foot') == mapcss._value_capture(capture_tags, 1, 'no')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'cycleway')) and (mapcss._tag_capture(capture_tags, 1, tags, 'cycleway') == mapcss._value_capture(capture_tags, 1, 'lane')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
                # assertNoMatch:"way highway=cycleway bicycle=yes"
                # assertMatch:"way highway=cycleway cycleway=lane"
                # assertNoMatch:"way highway=cycleway"
                # assertNoMatch:"way highway=cycleway"
                # assertNoMatch:"way highway=footway foot=yes"
                # assertMatch:"way highway=footway maxspeed=20"
                # assertNoMatch:"way highway=footway"
                # assertNoMatch:"way highway=footway"
                # assertNoMatch:"way highway=residential cycleway=lane"
                # assertNoMatch:"way highway=residential maxspeed=20"
                err.append({'class': 9004012, 'subclass': 469607562, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

        # way[footway=left][/^footway:/]
        # way[footway=right][/^footway:/]
        # way[footway=both][/^footway:/]
        # way[footway=separate][/^footway:/]
        # way[footway=no][/^footway:/]
        if ('footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'left')) and (mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354)))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'right')) and (mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354)))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'both')) and (mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354)))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'separate')) and (mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354)))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'no')) and (mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354)))
                except mapcss.RuleAbort: pass
            if match:
                # setnot_fixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}","{0.tag}","sidewalk","{1.key}")
                # assertMatch:"way footway=both footway:surface=asphalt"
                # assertMatch:"way footway=separate footway:surface=asphalt"
                set_not_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 1255595246, 'text': mapcss.tr('{0} is deprecated, use {1} instead. Also check similar tags like {2}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), 'sidewalk', mapcss._tag_uncapture(capture_tags, '{1.key}'))})

        # way[footway=none][/^footway:/]
        if ('footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'none')) and (mapcss._tag_capture(capture_tags, 1, tags, self.re_4dcdb354)))
                except mapcss.RuleAbort: pass
            if match:
                # setnot_fixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}","{0.tag}","sidewalk=no","{1.key}")
                # assertNoMatch:"way footway=no footway:surface=asphalt"
                # assertMatch:"way footway=none footway:surface=asphalt"
                set_not_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 2016837729, 'text': mapcss.tr('{0} is deprecated, use {1} instead. Also check similar tags like {2}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), 'sidewalk=no', mapcss._tag_uncapture(capture_tags, '{1.key}'))})

        # way[footway=left]!.not_fixable_footway
        # way[footway=right]!.not_fixable_footway
        # way[footway=both]!.not_fixable_footway
        # way[footway=separate]!.not_fixable_footway
        # way[footway=no]!.not_fixable_footway
        if ('footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((not set_not_fixable_footway) and (mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'left')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((not set_not_fixable_footway) and (mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'right')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((not set_not_fixable_footway) and (mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'both')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((not set_not_fixable_footway) and (mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'separate')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((not set_not_fixable_footway) and (mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'no')))
                except mapcss.RuleAbort: pass
            if match:
                # setfixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"sidewalk"
                # fixChangeKey:"footway => sidewalk"
                set_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 1136570919, 'text': mapcss.tr('{0} is deprecated', mapcss._tag_uncapture(capture_tags, '{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['sidewalk', mapcss.tag(tags, 'footway')]]),
                    '-': ([
                    'footway'])
                }})

        # way[footway=none]!.not_fixable_footway
        if ('footway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((not set_not_fixable_footway) and (mapcss._tag_capture(capture_tags, 0, tags, 'footway') == mapcss._value_capture(capture_tags, 0, 'none')))
                except mapcss.RuleAbort: pass
            if match:
                # setfixable_footway
                # group:tr("deprecated tagging")
                # throwWarning:tr("{0} is deprecated","{0.tag}")
                # suggestAlternative:"sidewalk=no"
                # fixRemove:"footway"
                # fixAdd:"sidewalk=no"
                set_fixable_footway = True
                err.append({'class': 9004006, 'subclass': 430589555, 'text': mapcss.tr('{0} is deprecated', mapcss._tag_uncapture(capture_tags, '{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['sidewalk','no']]),
                    '-': ([
                    'footway'])
                }})

        # way[turn][turn!~/^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$/]
        # way[turn:forward][turn:forward!~/^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$/]
        # way[turn:backward][turn:backward!~/^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$/]
        # way[turn:both_ways][turn:both_ways!~/^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$/]
        # way[turn:both_ways:forward][turn:both_ways:forward!~/^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$/]
        # way[turn:both_ways:backward][turn:both_ways:backward!~/^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$/]
        # way[turn:lanes][turn:lanes!~/^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$/]
        # way[turn:lanes:forward][turn:lanes:forward!~/^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$/]
        # way[turn:lanes:backward][turn:lanes:backward!~/^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$/]
        # way[turn:lanes:both_ways][turn:lanes:both_ways!~/^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$/]
        # way[turn:lanes:both_ways:forward][turn:lanes:both_ways:forward!~/^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$/]
        # way[turn:lanes:both_ways:backward][turn:lanes:both_ways:backward!~/^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$/]
        if ('turn' in keys) or ('turn:backward' in keys) or ('turn:both_ways' in keys) or ('turn:both_ways:backward' in keys) or ('turn:both_ways:forward' in keys) or ('turn:forward' in keys) or ('turn:lanes' in keys) or ('turn:lanes:backward' in keys) or ('turn:lanes:both_ways' in keys) or ('turn:lanes:both_ways:backward' in keys) or ('turn:lanes:both_ways:forward' in keys) or ('turn:lanes:forward' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_33052a50, '^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:forward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_33052a50, '^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:forward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:backward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_33052a50, '^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:backward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:both_ways')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_33052a50, '^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:both_ways'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:both_ways:forward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_33052a50, '^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:both_ways:forward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:both_ways:backward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_33052a50, '^(none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:both_ways:backward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:lanes')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_23c50386, '^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:lanes'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:lanes:forward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_23c50386, '^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:lanes:forward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:lanes:backward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_23c50386, '^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:lanes:backward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:lanes:both_ways')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_23c50386, '^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:lanes:both_ways'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:lanes:both_ways:forward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_23c50386, '^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:lanes:both_ways:forward'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'turn:lanes:both_ways:backward')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_23c50386, '^(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*)(\|(|none|((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through)(;((sharp_|slight_|merge_to_|slide_)?(left|right)|reverse|through))*))*$'), mapcss._tag_capture(capture_tags, 1, tags, 'turn:lanes:both_ways:backward'))))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("unusual value of {0}","{0.key}")
                # assertNoMatch:"way turn:lanes:forward=sharp_left;left||left;through;slight_right|slight_right;right|"
                # assertMatch:"way turn:lanes:forward=slight_reverse|right"
                # assertMatch:"way turn:lanes:forward=straight|right"
                # assertMatch:"way turn:lanes=left;none|right"
                # assertMatch:"way turn=slight_reverse"
                # assertMatch:"way turn=straight"
                # assertNoMatch:"way turn=through;right"
                # assertMatch:"way turn=through|right"
                err.append({'class': 9004013, 'subclass': 1634496690, 'text': mapcss.tr('unusual value of {0}', mapcss._tag_uncapture(capture_tags, '{0.key}'))})

        # way[highway=~/^((motorway|trunk|primary|secondary|tertiary)(_link)?|residential|unclassified)$/][area=yes]
        if ('area' in keys and 'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5757d731), mapcss._tag_capture(capture_tags, 0, tags, 'highway'))) and (mapcss._tag_capture(capture_tags, 1, tags, 'area') == mapcss._value_capture(capture_tags, 1, 'yes')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("suspicious tag combination")
                # throwError:tr("Area with {0} above {1} is invalid","highway=*","highway=service")
                # suggestAlternative:"area:highway=*"
                # assertNoMatch:"way highway=service area=yes"
                # assertMatch:"way highway=trunk area=yes"
                # assertNoMatch:"way highway=trunk"
                err.append({'class': 9004011, 'subclass': 610375152, 'text': mapcss.tr('Area with {0} above {1} is invalid', 'highway=*', 'highway=service')})

        return err
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[addr:housenumber][addr:housenumber!~/^((?:вл)?[0-9]+[А-Я]?(?:\/[0-9]+[А-Я]?)?(?: к[0-9А-Я]+)?(?: с[0-9А-Я]+)?(?: соор[0-9А-Я]+)?(?: лит[0-9А-Я]+)?(?: фл[0-9А-Я]+)?|[0-9]+-[0-9]+|[0-9]+[А-Я]?[\/-][0-9]+[А-Я]?[\/-][0-9]+[А-Я]?|(([0-9]+[А-Я]?[IXV]*)|[IXV]*)[\/-]([0-9]+[А-Я]?|[IXV]*)|ЗЯБ-[0-9]+|С-([0-9]+[А-Я]?(?:\/[0-9]+[А-Я]?)?|[IXV]*)|к[0-9А-Я]+)$/]
        if (u'addr:housenumber' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'addr:housenumber') and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_62d22c1b), mapcss._tag_capture(capture_tags, 1, tags, u'addr:housenumber')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Номера домов не соответствующие принятому соглашению")
                err.append({'class': 9017001, 'subclass': 774061168, 'text': mapcss.tr(u'Номера домов не соответствующие принятому соглашению')})

        return err
Example #27
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[place=locality][name=~/.+([Nn]ord|[Ss]ud$|[Ee]st|[Oo]uest|[Cc]entre)$/][inside("FR")]
        # way[place=hamlet][name=~/.+([Nn]ord|[Ss]ud$|[Ee]st|[Oo]uest|[Cc]entre)$/][inside("FR")]
        if (u'name' in keys and u'place' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'place') == mapcss._value_capture(capture_tags, 0, u'locality') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_422a87ff), mapcss._tag_capture(capture_tags, 1, tags, u'name')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'place') == mapcss._value_capture(capture_tags, 0, u'hamlet') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_422a87ff), mapcss._tag_capture(capture_tags, 1, tags, u'name')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"5080/50801/1"
                # throwError:tr("Hamlet or Locality name suffix Nord, Sud, Est, Ouest, Centre should be removed from Cadastre name. Place should be integrated only once.")
                # -osmoseAssertNoMatchWithContext:list('node place=hamlet name="ZA Sud Loire"',"inside=FR")
                # -osmoseAssertMatchWithContext:list('node place=hamlet name=Montdésert-Sud',"inside=FR")
                err.append({'class': 50801, 'subclass': 0, 'text': mapcss.tr(u'Hamlet or Locality name suffix Nord, Sud, Est, Ouest, Centre should be removed from Cadastre name. Place should be integrated only once.')})

        return err
Example #28
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[line_attachment]
        # way[line_management]
        # way[emergency=fire_hydrant]
        # way[emergency=defibrillator]
        # way[entrance]
        # way[door]
        # way[railway=subway_entrance]
        # way[man_made=survey_point]
        # way[power=transformer]
        # way[transformer]
        # way[power=pole]
        # way[power=catenary_mast]
        # way[power=connection]
        # way[power=terminal]
        # way[power=tower]!:closed
        # way[amenity=vending_machine]
        # way[natural=peak]
        # way[natural=saddle]
        # way[natural=volcano]
        # way[natural=tree]
        # way[highway=give_way]
        # way[highway=milestone]
        # way[highway=mini_roundabout]
        # way[highway=stop]
        # way[highway=street_lamp]
        # way[highway=traffic_signals]
        # way[highway=turning_loop]
        # way[highway=turning_circle]
        # way[highway=motorway_junction]
        if ('amenity' in keys) or ('door' in keys) or ('emergency' in keys) or ('entrance' in keys) or ('highway' in keys) or ('line_attachment' in keys) or ('line_management' in keys) or ('man_made' in keys) or ('natural' in keys) or ('power' in keys) or ('railway' in keys) or ('transformer' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'line_attachment')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'line_management')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'emergency') == mapcss._value_capture(capture_tags, 0, 'fire_hydrant')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'emergency') == mapcss._value_capture(capture_tags, 0, 'defibrillator')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'entrance')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'door')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'railway') == mapcss._value_capture(capture_tags, 0, 'subway_entrance')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'man_made') == mapcss._value_capture(capture_tags, 0, 'survey_point')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'transformer')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'transformer')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'pole')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'catenary_mast')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'connection')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'terminal')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'tower')) and (nds[0] != nds[-1]))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'amenity') == mapcss._value_capture(capture_tags, 0, 'vending_machine')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'natural') == mapcss._value_capture(capture_tags, 0, 'peak')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'natural') == mapcss._value_capture(capture_tags, 0, 'saddle')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'natural') == mapcss._value_capture(capture_tags, 0, 'volcano')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'natural') == mapcss._value_capture(capture_tags, 0, 'tree')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'give_way')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'milestone')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'mini_roundabout')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'stop')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'street_lamp')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'traffic_signals')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'turning_loop')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'turning_circle')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'motorway_junction')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a way. Should be used on a node.","{0.tag}")
                err.append({'class': 9003007, 'subclass': 1374694710, 'text': mapcss.tr('{0} on a way. Should be used on a node.', mapcss._tag_uncapture(capture_tags, '{0.tag}'))})

        # way[restriction][restriction=~/^(no_right_turn|no_left_turn|no_u_turn|no_straight_on|only_right_turn|only_left_turn|only_straight_on|no_entry|no_exit)$/]
        # way[type=multipolygon]
        # way[interval][route!=ferry]
        # way[route=bus]
        if ('interval' in keys) or ('restriction' in keys) or ('route' in keys) or ('type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'restriction')) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_22f56734), mapcss._tag_capture(capture_tags, 1, tags, 'restriction'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'type') == mapcss._value_capture(capture_tags, 0, 'multipolygon')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'interval')) and (mapcss._tag_capture(capture_tags, 1, tags, 'route') != mapcss._value_const_capture(capture_tags, 1, 'ferry', 'ferry')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'route') == mapcss._value_capture(capture_tags, 0, 'bus')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("{0} on a way. Should be used in a relation","{0.tag}")
                err.append({'class': 9003008, 'subclass': 665916193, 'text': mapcss.tr('{0} on a way. Should be used in a relation', mapcss._tag_uncapture(capture_tags, '{0.tag}'))})

        # way:closed[power=line]
        if ('power' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'power') == mapcss._value_capture(capture_tags, 0, 'line')) and (nds[0] == nds[-1]))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a closed way. Should be used on an unclosed way.","{1.tag}")
                err.append({'class': 9003011, 'subclass': 2100265426, 'text': mapcss.tr('{0} on a closed way. Should be used on an unclosed way.', mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

        return err
Example #29
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way["mtb:scale:uphill"][!incline]
        if (u'mtb:scale:uphill' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:uphill') and not mapcss._tag_capture(capture_tags, 1, tags, u'incline'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Way contains ''{0}'' but not ''{1}''.","{0.key}","{1.key}")
                err.append({'class': 9013001, 'subclass': 1368047539, 'text': mapcss.tr(u'Way contains \'\'{0}\'\' but not \'\'{1}\'\'.', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.key}'))})

        # way["mtb:scale:uphill"][highway][highway!~/path|track/]
        if (u'highway' in keys and u'mtb:scale:uphill' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:uphill') and mapcss._tag_capture(capture_tags, 1, tags, u'highway') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 2, self.re_6937bec1, u'path|track'), mapcss._tag_capture(capture_tags, 2, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Way contains ''{0}'' but is neither a track nor a path.","{0.key}")
                err.append({'class': 9013002, 'subclass': 139842783, 'text': mapcss.tr(u'Way contains \'\'{0}\'\' but is neither a track nor a path.', mapcss._tag_uncapture(capture_tags, u'{0.key}'))})

        # way["mtb:scale"]["mtb:scale"!~/^[0-6][-+]?$/]
        if (u'mtb:scale' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_1b95e3e9, u'^[0-6][-+]?$'), mapcss._tag_capture(capture_tags, 1, tags, u'mtb:scale')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Invalid ''{0}'' value: ''{1}''","{0.key}","{0.value}")
                err.append({'class': 9013003, 'subclass': 1229830952, 'text': mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}'))})

        # way["mtb:scale:uphill"]["mtb:scale:uphill"!~/^[0-5]$/]
        if (u'mtb:scale:uphill' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:uphill') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_3d3b0752, u'^[0-5]$'), mapcss._tag_capture(capture_tags, 1, tags, u'mtb:scale:uphill')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Invalid ''{0}'' value: ''{1}''","{0.key}","{0.value}")
                err.append({'class': 9013003, 'subclass': 86930524, 'text': mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}'))})

        # way["mtb:scale:imba"]["mtb:scale:imba"!~/^[0-4]$/]
        if (u'mtb:scale:imba' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:imba') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_731f6ce6, u'^[0-4]$'), mapcss._tag_capture(capture_tags, 1, tags, u'mtb:scale:imba')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Invalid ''{0}'' value: ''{1}''","{0.key}","{0.value}")
                err.append({'class': 9013003, 'subclass': 2005358544, 'text': mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}'))})

        return err
Example #30
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # *[takeaway:covid19=yes][takeaway!=yes][inside("FR")]
        if ('takeaway:covid19' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            'takeaway:covid19')
                        == mapcss._value_capture(capture_tags, 0, 'yes') and
                        mapcss._tag_capture(capture_tags, 1, tags, 'takeaway')
                        != mapcss._value_const_capture(capture_tags, 1, 'yes',
                                                       'yes')
                        and mapcss.inside(self.father.config.options, 'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"4010/202004/2"
                # throwWarning:tr("This store offered a take-away service during the lockdown. Does it still offer take-away in usual times")
                # fixChangeKey:"takeaway:covid19=>takeaway"
                err.append({
                    'class':
                    202004,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr('This store offered a take-away service during the lockdown. Does it still offer take-away in usual times'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+':
                        dict([[
                            'takeaway',
                            mapcss.tag(tags, 'takeaway:covid19')
                        ]]),
                        '-': (['takeaway:covid19'])
                    }
                })

        # *[delivery:covid19=yes][delivery!=yes][inside("FR")]
        if ('delivery:covid19' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            'delivery:covid19')
                        == mapcss._value_capture(capture_tags, 0, 'yes') and
                        mapcss._tag_capture(capture_tags, 1, tags, 'delivery')
                        != mapcss._value_const_capture(capture_tags, 1, 'yes',
                                                       'yes')
                        and mapcss.inside(self.father.config.options, 'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"4010/202004/2"
                # throwWarning:tr("This store offered a delivery service during the lockdown. Does it still offer delivery in usual times")
                # fixChangeKey:"delivery:covid19=>delivery"
                err.append({
                    'class':
                    202004,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr('This store offered a delivery service during the lockdown. Does it still offer delivery in usual times'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+':
                        dict([[
                            'delivery',
                            mapcss.tag(tags, 'delivery:covid19')
                        ]]),
                        '-': (['delivery:covid19'])
                    }
                })

        # *[opening_hours:covid19][opening_hours:covid19=~/off|restricted/][inside("FR")]
        if ('opening_hours:covid19' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 'opening_hours:covid19')
                             and mapcss.regexp_test(
                                 mapcss._value_capture(capture_tags, 1,
                                                       self.re_3f390088),
                                 mapcss._tag_capture(capture_tags, 1, tags,
                                                     'opening_hours:covid19'))
                             and mapcss.inside(self.father.config.options,
                                               'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"4010/202004/2"
                # throwWarning:tr("The lockdown is over. Has this place reopened?")
                # fixRemove:"opening_hours:covid19"
                err.append({
                    'class':
                    202004,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(
                        'The lockdown is over. Has this place reopened?'),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-': (['opening_hours:covid19'])
                    }
                })

        # *[opening_hours:covid19][opening_hours:covid19!~/same|off|open|restricted/][!opening_hours][inside("FR")]
        if ('opening_hours:covid19' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 'opening_hours:covid19')
                             and not mapcss.regexp_test(
                                 mapcss._value_const_capture(
                                     capture_tags, 1, self.re_64916a2b,
                                     'same|off|open|restricted'),
                                 mapcss._tag_capture(capture_tags, 1, tags,
                                                     'opening_hours:covid19'))
                             and not mapcss._tag_capture(
                                 capture_tags, 2, tags, 'opening_hours') and
                             mapcss.inside(self.father.config.options, 'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"4010/202004/2"
                # throwWarning:tr("This store was on an adapted schedule during the lockdown. Are these opening hours still in effect?")
                # fixChangeKey:"opening_hours:covid19=>opening_hours"
                err.append({
                    'class':
                    202004,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr('This store was on an adapted schedule during the lockdown. Are these opening hours still in effect?'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+':
                        dict([[
                            'opening_hours',
                            mapcss.tag(tags, 'opening_hours:covid19')
                        ]]),
                        '-': (['opening_hours:covid19'])
                    }
                })

        return err
Example #31
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_pt_route = set_pt_route_master = False

        # relation[type=route][!route]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route') and not mapcss._tag_capture(capture_tags, 1, tags, u'route'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({'class': 9014009, 'subclass': 828849115, 'text': mapcss.tr(u'Missing transportation mode, add a tag route = bus/coach/tram/etc')})

        # relation[type=route_master][!route_master][!route]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route_master') and not mapcss._tag_capture(capture_tags, 1, tags, u'route_master') and not mapcss._tag_capture(capture_tags, 2, tags, u'route'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({'class': 9014009, 'subclass': 607011337, 'text': mapcss.tr(u'Missing transportation mode, add a tag route = bus/coach/tram/etc')})

        # relation[type=route_master][!route_master][route]
        if (u'route' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route_master') and not mapcss._tag_capture(capture_tags, 1, tags, u'route_master') and mapcss._tag_capture(capture_tags, 2, tags, u'route'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, change tag route to route_master")
                # fixChangeKey:"route=>route_master"
                err.append({'class': 9014010, 'subclass': 3385524, 'text': mapcss.tr(u'Missing transportation mode, change tag route to route_master'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'route_master', mapcss.tag(tags, u'route')]]),
                    '-': ([
                    u'route'])
                }})

        # relation[type=route][route=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus)$/]
        if (u'route' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_37f81db8), mapcss._tag_capture(capture_tags, 1, tags, u'route')))
                except mapcss.RuleAbort: pass
            if match:
                # setpt_route
                set_pt_route = True

        # relation[type=route_master][route_master=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus)$/]
        if (u'route_master' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route_master') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_37f81db8), mapcss._tag_capture(capture_tags, 1, tags, u'route_master')))
                except mapcss.RuleAbort: pass
            if match:
                # setpt_route_master
                set_pt_route_master = True

        # relation.pt_route[!public_transport:version]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'public_transport:version'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21401/3"
                # throwError:tr("Missing public_transport:version tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus public_transport:version=1"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21401, 'subclass': 0, 'text': mapcss.tr(u'Missing public_transport:version tag on a public_transport route relation')})

        # relation.pt_route[!network]
        # relation.pt_route_master[!network]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'network'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'network'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21402/3"
                # throwError:tr("Missing network tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus network=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21402, 'subclass': 0, 'text': mapcss.tr(u'Missing network tag on a public_transport relation')})

        # relation.pt_route[!operator]
        # relation.pt_route_master[!operator]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'operator'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'operator'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21403/3"
                # throwError:tr("Missing operator tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus operator=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21403, 'subclass': 0, 'text': mapcss.tr(u'Missing operator tag on a public_transport relation')})

        # relation.pt_route[!ref]
        # relation.pt_route_master[!ref]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'ref'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'ref'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21404/3"
                # throwError:tr("Missing ref tag for line number on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus ref=3"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21404, 'subclass': 0, 'text': mapcss.tr(u'Missing ref tag for line number on a public_transport relation')})

        # relation.pt_route[!from]
        # relation.pt_route[!to]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'from'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'to'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21405/3"
                # throwError:tr("Missing from/to tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus from=A to=B"
                # assertMatch:"relation type=route route=bus from=A"
                # assertMatch:"relation type=route route=bus to=B"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21405, 'subclass': 0, 'text': mapcss.tr(u'Missing from/to tag on a public_transport route relation')})

        # relation.pt_route["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if (u'operator' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'operator')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'operator')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Check the operator tag")
                err.append({'class': 9014013, 'subclass': 286137008, 'text': mapcss.tr(u'Check the operator tag')})

        # relation.pt_route["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if (u'network' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'network')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'network')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Check the network tag")
                err.append({'class': 9014014, 'subclass': 735027962, 'text': mapcss.tr(u'Check the network tag')})

        # relation.pt_route!.route_ok
        # Use undeclared class pt_route, route_ok

        return err
Example #32
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way["mtb:scale:uphill"][!incline]
        if (u'mtb:scale:uphill' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:uphill') and not mapcss._tag_capture(capture_tags, 1, tags, u'incline'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Way contains ''{0}'' but not ''{1}''.","{0.key}","{1.key}")
                err.append({'class': 9013001, 'subclass': 1368047539, 'text': mapcss.tr(u'Way contains \'\'{0}\'\' but not \'\'{1}\'\'.', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.key}'))})

        # way["mtb:scale:uphill"][highway][highway!~/path|track/]
        if (u'highway' in keys and u'mtb:scale:uphill' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:uphill') and mapcss._tag_capture(capture_tags, 1, tags, u'highway') and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 2, self.re_6937bec1), mapcss._tag_capture(capture_tags, 2, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Way contains ''{0}'' but is neither a track nor a path.","{0.key}")
                err.append({'class': 9013002, 'subclass': 139842783, 'text': mapcss.tr(u'Way contains \'\'{0}\'\' but is neither a track nor a path.', mapcss._tag_uncapture(capture_tags, u'{0.key}'))})

        # way["mtb:scale"]["mtb:scale"!~/^[0-6][-+]?$/]
        if (u'mtb:scale' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale') and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_1b95e3e9), mapcss._tag_capture(capture_tags, 1, tags, u'mtb:scale')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Invalid ''{0}'' value: ''{1}''","{0.key}","{0.value}")
                err.append({'class': 9013003, 'subclass': 1229830952, 'text': mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}'))})

        # way["mtb:scale:uphill"]["mtb:scale:uphill"!~/^[0-5]$/]
        if (u'mtb:scale:uphill' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:uphill') and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_3d3b0752), mapcss._tag_capture(capture_tags, 1, tags, u'mtb:scale:uphill')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Invalid ''{0}'' value: ''{1}''","{0.key}","{0.value}")
                err.append({'class': 9013003, 'subclass': 86930524, 'text': mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}'))})

        # way["mtb:scale:imba"]["mtb:scale:imba"!~/^[0-4]$/]
        if (u'mtb:scale:imba' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'mtb:scale:imba') and not mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_731f6ce6), mapcss._tag_capture(capture_tags, 1, tags, u'mtb:scale:imba')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Invalid ''{0}'' value: ''{1}''","{0.key}","{0.value}")
                err.append({'class': 9013003, 'subclass': 2005358544, 'text': mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}'))})

        return err
Example #33
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[building:colour][building:colour=~/^#/][building:colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[roof:colour][roof:colour=~/^#/][roof:colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[colour][colour=~/^#/][colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[ref:colour][ref:colour=~/^#/][ref:colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        if (u'building:colour' in keys) or (u'colour' in keys) or (u'ref:colour' in keys) or (u'roof:colour' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'building:colour')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 2, self.re_1b3f6ace, u'^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$'), mapcss._tag_capture(capture_tags, 2, tags, u'building:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'roof:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'roof:colour')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 2, self.re_1b3f6ace, u'^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$'), mapcss._tag_capture(capture_tags, 2, tags, u'roof:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'colour')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 2, self.re_1b3f6ace, u'^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$'), mapcss._tag_capture(capture_tags, 2, tags, u'colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'ref:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_30dca0d4), mapcss._tag_capture(capture_tags, 1, tags, u'ref:colour')) and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 2, self.re_1b3f6ace, u'^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$'), mapcss._tag_capture(capture_tags, 2, tags, u'ref:colour')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Colour code should start with '#' followed by 3 or 6 digits")
                # -osmoseItemClassLevel:"3091/30911:0/2"
                # throwWarning:tr("{0} colour code should start with '#' followed by 3 or 6 digits","{0.tag}")
                # assertNoMatch:"way building:colour=#123"
                # assertMatch:"way building:colour=#1234"
                # assertNoMatch:"way building:colour=#abcdef"
                # assertMatch:"way building:colour=#foobar9"
                # assertMatch:"way building:colour=#zzz"
                # assertNoMatch:"way roof:colour=#484443 building:colour=#8c6b57"
                err.append({'class': 30911, 'subclass': 0, 'text': mapcss.tr(u'{0} colour code should start with \'#\' followed by 3 or 6 digits', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # *[building:colour][building:colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[roof:colour][roof:colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[colour][colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        # *[ref:colour][ref:colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
        if (u'building:colour' in keys) or (u'colour' in keys) or (u'ref:colour' in keys) or (u'roof:colour' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'building:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'roof:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'roof:colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'colour')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'ref:colour') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_7d65c79d), mapcss._tag_capture(capture_tags, 1, tags, u'ref:colour')))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Colour code should start with '#' followed by 3 or 6 digits")
                # -osmoseItemClassLevel:"3091/30911:1/2"
                # throwWarning:tr("{0} colour code should start with '#' followed by 3 or 6 digits","{0.tag}")
                # fixAdd:"{0.key}=#{0.value}"
                # assertNoMatch:"way building:colour=#123"
                # assertMatch:"way building:colour=123"
                # assertMatch:"way building:colour=abcdef"
                # assertNoMatch:"way building:colour=red"
                # assertNoMatch:"way roof:colour=#484443 building:colour=#8c6b57"
                err.append({'class': 30911, 'subclass': 1, 'text': mapcss.tr(u'{0} colour code should start with \'#\' followed by 3 or 6 digits', mapcss._tag_uncapture(capture_tags, u'{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    (mapcss._tag_uncapture(capture_tags, u'{0.key}=#{0.value}')).split('=', 1)])
                }})

        return err
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # *[access][highway=proposed]
        # *[motor_vehicle?][vehicle!=no][access!=no][bicycle_road!=yes][highway=~/^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified|residential|service|living_street)$/]
        # *[bridge=no]
        # *[building=no]
        # *[elevation="0"]
        # *[layer="0"]
        if (u'access' in keys
                and u'highway' in keys) or (u'bridge' in keys) or (
                    u'building' in keys) or (u'elevation' in keys) or (
                        u'highway' in keys
                        and u'motor_vehicle' in keys) or (u'layer' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'access')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'highway')
                        == mapcss._value_capture(capture_tags, 1, u'proposed'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(
                            capture_tags, 0, tags,
                            u'motor_vehicle') in ('yes', 'true', '1') and
                        mapcss._tag_capture(capture_tags, 1, tags, u'vehicle')
                        != mapcss._value_capture(capture_tags, 1, u'no') and
                        mapcss._tag_capture(capture_tags, 2, tags, u'access')
                        != mapcss._value_capture(capture_tags, 2, u'no')
                        and mapcss._tag_capture(capture_tags, 3, tags,
                                                u'bicycle_road') !=
                        mapcss._value_capture(capture_tags, 3, u'yes')
                        and mapcss.regexp_test(
                            mapcss._value_capture(capture_tags, 4,
                                                  self.re_3ad9e1f5),
                            mapcss._tag_capture(capture_tags, 4, tags,
                                                u'highway')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'bridge') == mapcss._value_capture(
                            capture_tags, 0, u'no'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'building') == mapcss._value_capture(
                            capture_tags, 0, u'no'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'elevation') == mapcss._value_capture(
                            capture_tags, 0, u'0'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'layer') == mapcss._value_capture(
                            capture_tags, 0, u'0'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("unnecessary tag")
                # throwWarning:tr("{0} is unnecessary","{0.tag}")
                # fixRemove:"{0.key}"
                err.append({
                    'class':
                    9010001,
                    'subclass':
                    1949087363,
                    'text':
                    mapcss.tr(u'{0} is unnecessary',
                              mapcss._tag_uncapture(capture_tags, u'{0.tag}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-':
                        ([mapcss._tag_uncapture(capture_tags, u'{0.key}')])
                    }
                })

        # *[emergency=permissive]
        if (u'emergency' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'emergency') == mapcss._value_capture(
                            capture_tags, 0, u'permissive'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("{0} makes no sense","{0.tag")
                # fixAdd:"emergency=yes"
                err.append({
                    'class': 9010002,
                    'subclass': 325672362,
                    'text': mapcss.tr(u'{0} makes no sense', u'{0.tag'),
                    'allow_fix_override': True,
                    'fix': {
                        '+': dict([[u'emergency', u'yes']])
                    }
                })

        # *[payment:cash][payment:coins][payment:notes]
        if (u'payment:cash' in keys and u'payment:coins' in keys
                and u'payment:notes' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'payment:cash')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'payment:coins')
                             and mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'payment:notes'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("unnecessary tag")
                # throwWarning:tr("{0} together with {1} and {2}. Remove {0}.","{0.key}","{1.key}","{2.key}")
                # fixRemove:"payment:cash"
                err.append({
                    'class':
                    9010001,
                    'subclass':
                    1340792439,
                    'text':
                    mapcss.tr(u'{0} together with {1} and {2}. Remove {0}.',
                              mapcss._tag_uncapture(capture_tags, u'{0.key}'),
                              mapcss._tag_uncapture(capture_tags, u'{1.key}'),
                              mapcss._tag_uncapture(capture_tags, u'{2.key}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-': ([u'payment:cash'])
                    }
                })

        return err
Example #35
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_pt_route = set_pt_route_master = False

        # relation[type=route][!route]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'type')
                        == mapcss._value_capture(capture_tags, 0, u'route')
                        and not mapcss._tag_capture(capture_tags, 1, tags,
                                                    u'route'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({
                    'class':
                    9014009,
                    'subclass':
                    828849115,
                    'text':
                    mapcss.
                    tr(u'Missing transportation mode, add a tag route = bus/coach/tram/etc'
                       )
                })

        # relation[type=route_master][!route_master][!route]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'type') == mapcss._value_capture(
                            capture_tags, 0, u'route_master')
                             and not mapcss._tag_capture(
                                 capture_tags, 1, tags, u'route_master')
                             and not mapcss._tag_capture(
                                 capture_tags, 2, tags, u'route'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({
                    'class':
                    9014009,
                    'subclass':
                    607011337,
                    'text':
                    mapcss.
                    tr(u'Missing transportation mode, add a tag route = bus/coach/tram/etc'
                       )
                })

        # relation[type=route_master][!route_master][route]
        if (u'route' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'type') == mapcss._value_capture(
                            capture_tags, 0, u'route_master')
                             and not mapcss._tag_capture(
                                 capture_tags, 1, tags, u'route_master')
                             and mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'route'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwError:tr("Missing transportation mode, change tag route to route_master")
                # fixChangeKey:"route=>route_master"
                err.append({
                    'class':
                    9014010,
                    'subclass':
                    3385524,
                    'text':
                    mapcss.
                    tr(u'Missing transportation mode, change tag route to route_master'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+':
                        dict([[u'route_master',
                               mapcss.tag(tags, u'route')]]),
                        '-': ([u'route'])
                    }
                })

        # relation[type=route][route=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus)$/]
        if (u'route' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, u'type')
                        == mapcss._value_capture(capture_tags, 0, u'route')
                        and mapcss.regexp_test(
                            mapcss._value_capture(capture_tags, 1,
                                                  self.re_37f81db8),
                            mapcss._tag_capture(capture_tags, 1, tags,
                                                u'route')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setpt_route
                set_pt_route = True

        # relation[type=route_master][route_master=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus)$/]
        if (u'route_master' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'type') == mapcss._value_capture(
                            capture_tags, 0, u'route_master')
                             and mapcss.regexp_test(
                                 mapcss._value_capture(capture_tags, 1,
                                                       self.re_37f81db8),
                                 mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'route_master')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # setpt_route_master
                set_pt_route_master = True

        # relation.pt_route[!public_transport:version]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'public_transport:version'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"2140/21401/3"
                # throwError:tr("Missing public_transport:version tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus public_transport:version=1"
                # assertMatch:"relation type=route route=bus"
                err.append({
                    'class':
                    21401,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Missing public_transport:version tag on a public_transport route relation'
                       )
                })

        # relation.pt_route[!network]
        # relation.pt_route_master[!network]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'network'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route_master and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'network'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"2140/21402/3"
                # throwError:tr("Missing network tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus network=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({
                    'class':
                    21402,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(
                        u'Missing network tag on a public_transport relation')
                })

        # relation.pt_route[!operator]
        # relation.pt_route_master[!operator]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'operator'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route_master and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'operator'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"2140/21403/3"
                # throwError:tr("Missing operator tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus operator=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({
                    'class':
                    21403,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(
                        u'Missing operator tag on a public_transport relation')
                })

        # relation.pt_route[!ref]
        # relation.pt_route_master[!ref]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'ref'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route_master and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'ref'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"2140/21404/3"
                # throwError:tr("Missing ref tag for line number on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus ref=3"
                # assertMatch:"relation type=route route=bus"
                err.append({
                    'class':
                    21404,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Missing ref tag for line number on a public_transport relation'
                       )
                })

        # relation.pt_route[!from]
        # relation.pt_route[!to]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'from'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and not mapcss._tag_capture(
                        capture_tags, 0, tags, u'to'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseItemClassLevel:"2140/21405/3"
                # throwError:tr("Missing from/to tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus from=A to=B"
                # assertMatch:"relation type=route route=bus from=A"
                # assertMatch:"relation type=route route=bus to=B"
                # assertMatch:"relation type=route route=bus"
                err.append({
                    'class':
                    21405,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Missing from/to tag on a public_transport route relation'
                       )
                })

        # relation.pt_route["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if (u'operator' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_25554804),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'operator')) and
                             mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route_master and mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_25554804),
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'operator')) and
                             mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwError:tr("Check the operator tag")
                err.append({
                    'class': 9014013,
                    'subclass': 286137008,
                    'text': mapcss.tr(u'Check the operator tag')
                })

        # relation.pt_route["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if (u'network' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route and mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_25554804),
                        mapcss._tag_capture(capture_tags, 0, tags, u'network'))
                             and mapcss.inside(self.father.config.options,
                                               u'FR'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (set_pt_route_master and mapcss.regexp_test(
                        mapcss._value_capture(capture_tags, 0,
                                              self.re_25554804),
                        mapcss._tag_capture(capture_tags, 0, tags, u'network'))
                             and mapcss.inside(self.father.config.options,
                                               u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwError:tr("Check the network tag")
                err.append({
                    'class': 9014014,
                    'subclass': 735027962,
                    'text': mapcss.tr(u'Check the network tag')
                })

        # relation.pt_route!.route_ok
        # Use undeclared class pt_route, route_ok

        return err
Example #36
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *["addr:street"=~/.+;(.+)?/]
        # *[highway=~/.+;(.+)?/]
        # *[lanes=~/.+;(.+)?/]
        # *[maxspeed=~/.+;(.+)?/]
        # *[name=~/.+;(.+)?/]
        # *[surface=~/.+;(.+)?/]
        # *[water=~/.+;(.+)?/]
        if (u'addr:street' in keys) or (u'highway' in keys) or (u'lanes' in keys) or (u'maxspeed' in keys) or (u'name' in keys) or (u'surface' in keys) or (u'water' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'addr:street')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'highway')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'lanes')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'maxspeed')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'surface')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_53db61ac), mapcss._tag_capture(capture_tags, 0, tags, u'water')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} with multiple values","{0.key}")
                err.append({'class': 9005001, 'subclass': 1911063816, 'text': mapcss.tr(u'{0} with multiple values', mapcss._tag_uncapture(capture_tags, u'{0.key}'))})

        # *[source=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:addr"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:maxspeed"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:name"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:position"=~/^(;.*|.*;;.*|.*;)$/]
        # *["source:postcode"=~/^(;.*|.*;;.*|.*;)$/]
        # *[ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[int_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[old_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[source_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[route_ref=~/^(;.*|.*;;.*|.*;)$/]
        # *[attribution=~/^(;.*|.*;;.*|.*;)$/]
        # *[name=~/^(;.*|.*;;.*|.*;)$/]
        # *[alt_name=~/^(;.*|.*;;.*|.*;)$/]
        # *[note=~/^(;.*|.*;;.*|.*;)$/]
        # *[fixme=~/^(;.*|.*;;.*|.*;)$/]
        # *["addr:housenumber"=~/^(;.*|.*;;.*|.*;)$/]
        # *[destination=~/^(;.*|.*;;.*|.*;)$/]
        # *[exit_to=~/^(;.*|.*;;.*|.*;)$/]
        # *[surface=~/^(;.*|.*;;.*|.*;)$/]
        # *["building:use"=~/^(;.*|.*;;.*|.*;)$/]
        # *[traffic_sign=~/^(;.*|.*;;.*|.*;)$/]
        # *[voltage=~/^(;.*|.*;;.*|.*;)$/]
        # *[cuisine=~/^(;.*|.*;;.*|.*;)$/]
        if (u'addr:housenumber' in keys) or (u'alt_name' in keys) or (u'attribution' in keys) or (u'building:use' in keys) or (u'cuisine' in keys) or (u'destination' in keys) or (u'exit_to' in keys) or (u'fixme' in keys) or (u'int_ref' in keys) or (u'name' in keys) or (u'note' in keys) or (u'old_ref' in keys) or (u'ref' in keys) or (u'route_ref' in keys) or (u'source' in keys) or (u'source:addr' in keys) or (u'source:maxspeed' in keys) or (u'source:name' in keys) or (u'source:position' in keys) or (u'source:postcode' in keys) or (u'source_ref' in keys) or (u'surface' in keys) or (u'traffic_sign' in keys) or (u'voltage' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:addr')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:maxspeed')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:position')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source:postcode')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'int_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'old_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'source_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'route_ref')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'attribution')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'alt_name')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'note')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'fixme')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'addr:housenumber')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'destination')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'exit_to')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'surface')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'building:use')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'traffic_sign')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'voltage')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_579c7c6a), mapcss._tag_capture(capture_tags, 0, tags, u'cuisine')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("empty value in semicolon-separated ''{0}''","{0.key}")
                err.append({'class': 9005002, 'subclass': 978530936, 'text': mapcss.tr(u'empty value in semicolon-separated \'\'{0}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'))})

        return err
Example #37
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # way[line_attachment]
        # way[emergency=fire_hydrant]
        # way[entrance]
        # way[door]
        # way[railway=subway_entrance]
        # way[man_made=survey_point]
        # way[aeroway=holding_position]
        # way[power=transformer]
        # way[power=pole]
        # way[power=catenary_mast]
        # way[power=terminal]
        # way[power=tower]!:closed
        # way[amenity=vending_machine]
        # way[natural=peak]
        # way[natural=saddle]
        # way[natural=volcano]
        # way[natural=tree]
        # way[highway=give_way]
        # way[highway=milestone]
        # way[highway=mini_roundabout]
        # way[highway=stop]
        # way[highway=street_lamp]
        # way[highway=traffic_signals]
        # way[highway=turning_loop]
        # way[highway=turning_circle]
        # way[highway=motorway_junction]
        if (u'aeroway' in keys) or (u'amenity' in keys) or (u'door' in keys) or (u'emergency' in keys) or (u'entrance' in keys) or (u'highway' in keys) or (u'line_attachment' in keys) or (u'man_made' in keys) or (u'natural' in keys) or (u'power' in keys) or (u'railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'line_attachment'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'emergency') == mapcss._value_capture(capture_tags, 0, u'fire_hydrant'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'entrance'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'door'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'subway_entrance'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'survey_point'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'holding_position'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'transformer'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'pole'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'catenary_mast'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'terminal'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'tower') and nds[0] != nds[-1])
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'amenity') == mapcss._value_capture(capture_tags, 0, u'vending_machine'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'peak'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'saddle'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'volcano'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'tree'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'give_way'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'milestone'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'mini_roundabout'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'stop'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'street_lamp'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'traffic_signals'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'turning_loop'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'turning_circle'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'motorway_junction'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a way. Should be used on a node.","{0.tag}")
                err.append({'class': 9003007, 'subclass': 1746469597, 'text': mapcss.tr(u'{0} on a way. Should be used on a node.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # way[restriction][restriction=~/^(no_right_turn|no_left_turn|no_u_turn|no_straight_on|only_right_turn|only_left_turn|only_straight_on|no_entry|no_exit)$/]
        # way[type=multipolygon]
        # way[interval][route!=ferry]
        # way[route=bus]
        if (u'interval' in keys) or (u'restriction' in keys) or (u'route' in keys) or (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'restriction') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_22f56734), mapcss._tag_capture(capture_tags, 1, tags, u'restriction')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'multipolygon'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'interval') and mapcss._tag_capture(capture_tags, 1, tags, u'route') != mapcss._value_const_capture(capture_tags, 1, u'ferry', u'ferry'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'route') == mapcss._value_capture(capture_tags, 0, u'bus'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("{0} on a way. Should be used in a relation","{0.tag}")
                err.append({'class': 9003008, 'subclass': 665916193, 'text': mapcss.tr(u'{0} on a way. Should be used in a relation', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # way[place=island]!:closed
        if (u'place' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'place') == mapcss._value_capture(capture_tags, 0, u'island') and nds[0] != nds[-1])
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Way with {0} not closed.","{0.tag}")
                err.append({'class': 9003010, 'subclass': 167228643, 'text': mapcss.tr(u'Way with {0} not closed.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        return err
Example #38
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_pt_route = set_pt_route_master = False

        # relation[type=route][!route]
        if ('type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'type') == mapcss._value_capture(capture_tags, 0, 'route')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'route')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({'class': 9014009, 'subclass': 828849115, 'text': mapcss.tr('Missing transportation mode, add a tag route = bus/coach/tram/etc')})

        # relation[type=route_master][!route_master][!route]
        if ('type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'type') == mapcss._value_capture(capture_tags, 0, 'route_master')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'route_master')) and (not mapcss._tag_capture(capture_tags, 2, tags, 'route')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({'class': 9014009, 'subclass': 607011337, 'text': mapcss.tr('Missing transportation mode, add a tag route = bus/coach/tram/etc')})

        # relation[type=route_master][!route_master][route]
        if ('route' in keys and 'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'type') == mapcss._value_capture(capture_tags, 0, 'route_master')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'route_master')) and (mapcss._tag_capture(capture_tags, 2, tags, 'route')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, change tag route to route_master")
                # fixChangeKey:"route=>route_master"
                err.append({'class': 9014010, 'subclass': 3385524, 'text': mapcss.tr('Missing transportation mode, change tag route to route_master'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['route_master', mapcss.tag(tags, 'route')]]),
                    '-': ([
                    'route'])
                }})

        # relation[type=route][route=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus|walking_bus)$/]
        if ('route' in keys and 'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'type') == mapcss._value_capture(capture_tags, 0, 'route')) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_6194d2a4), mapcss._tag_capture(capture_tags, 1, tags, 'route'))))
                except mapcss.RuleAbort: pass
            if match:
                # setpt_route
                set_pt_route = True

        # relation[type=route_master][route_master=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus|walking_bus)$/]
        if ('route_master' in keys and 'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'type') == mapcss._value_capture(capture_tags, 0, 'route_master')) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_6194d2a4), mapcss._tag_capture(capture_tags, 1, tags, 'route_master'))))
                except mapcss.RuleAbort: pass
            if match:
                # setpt_route_master
                set_pt_route_master = True

        # relation.pt_route[!public_transport:version]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (not mapcss._tag_capture(capture_tags, 0, tags, 'public_transport:version')))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21401/3"
                # throwError:tr("Missing public_transport:version tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus public_transport:version=1"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21401, 'subclass': 0, 'text': mapcss.tr('Missing public_transport:version tag on a public_transport route relation')})

        # relation.pt_route[!network]
        # relation.pt_route_master[!network]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (not mapcss._tag_capture(capture_tags, 0, tags, 'network')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (not mapcss._tag_capture(capture_tags, 0, tags, 'network')))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21402/3"
                # throwError:tr("Missing network tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus network=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21402, 'subclass': 0, 'text': mapcss.tr('Missing network tag on a public_transport relation')})

        # relation.pt_route[!operator]
        # relation.pt_route_master[!operator]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (not mapcss._tag_capture(capture_tags, 0, tags, 'operator')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (not mapcss._tag_capture(capture_tags, 0, tags, 'operator')))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21403/3"
                # throwError:tr("Missing operator tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus operator=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21403, 'subclass': 0, 'text': mapcss.tr('Missing operator tag on a public_transport relation')})

        # relation.pt_route[!from]
        # relation.pt_route[!to]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (not mapcss._tag_capture(capture_tags, 0, tags, 'from')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (not mapcss._tag_capture(capture_tags, 0, tags, 'to')))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21405/3"
                # throwError:tr("Missing from/to tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus from=A to=B"
                # assertMatch:"relation type=route route=bus from=A"
                # assertMatch:"relation type=route route=bus to=B"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21405, 'subclass': 0, 'text': mapcss.tr('Missing from/to tag on a public_transport route relation')})

        # relation.pt_route[tag(network)!=parent_tag(network)]
        # Part of rule not implemented

        # relation.pt_route[tag(operator)!=parent_tag(operator)]
        # Part of rule not implemented

        # relation.pt_route[tag(ref)!=parent_tag(ref)]
        # Part of rule not implemented

        # relation.pt_route[tag(colour)!=parent_tag(colour)]
        # Part of rule not implemented

        # relation.pt_route[tag(route)!=parent_tag(route_master)]
        # Part of rule not implemented

        # relation.pt_route[!colour][color]
        # relation.pt_route_master[!colour][color]
        if ('color' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (not mapcss._tag_capture(capture_tags, 0, tags, 'colour')) and (mapcss._tag_capture(capture_tags, 1, tags, 'color')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (not mapcss._tag_capture(capture_tags, 0, tags, 'colour')) and (mapcss._tag_capture(capture_tags, 1, tags, 'color')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("The color of the public transport line should be in a colour tag")
                # fixChangeKey:"color=>colour"
                err.append({'class': 9014020, 'subclass': 218794881, 'text': mapcss.tr('The color of the public transport line should be in a colour tag'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['colour', mapcss.tag(tags, 'color')]]),
                    '-': ([
                    'color'])
                }})

        # relation.pt_route["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if ('operator' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, 'operator'))) and (mapcss.inside(self.father.config.options, 'FR')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, 'operator'))) and (mapcss.inside(self.father.config.options, 'FR')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Check the operator tag : this operator does not exist, it may be a typo")
                err.append({'class': 9014025, 'subclass': 286137008, 'text': mapcss.tr('Check the operator tag : this operator does not exist, it may be a typo')})

        # relation.pt_route["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if ('network' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, 'network'))) and (mapcss.inside(self.father.config.options, 'FR')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, 'network'))) and (mapcss.inside(self.father.config.options, 'FR')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Check the network tag : this network does not exist, it may be a typo")
                err.append({'class': 9014026, 'subclass': 735027962, 'text': mapcss.tr('Check the network tag : this network does not exist, it may be a typo')})

        # relation[highway=bus_stop]
        if ('highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'highway') == mapcss._value_capture(capture_tags, 0, 'bus_stop')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("A bus stop is supposed to be a node")
                err.append({'class': 9014019, 'subclass': 1590282811, 'text': mapcss.tr('A bus stop is supposed to be a node')})

        # relation.pt_route!.route_ok
        if True:
            match = False
            # Skip selector using undeclared class pt_route, route_ok
            if match:
                # throwError:tr("The line variant does not belong to any line, add it to the route_master relation")
                err.append({'class': 9014028, 'subclass': 1286525207, 'text': mapcss.tr('The line variant does not belong to any line, add it to the route_master relation')})

        # relation.pt_route[interval][interval!~/^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
        # relation.pt_route_master[interval][interval!~/^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
        if ('interval' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (mapcss._tag_capture(capture_tags, 0, tags, 'interval')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_2fe0817d, '^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$'), mapcss._tag_capture(capture_tags, 1, tags, 'interval'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (mapcss._tag_capture(capture_tags, 0, tags, 'interval')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_2fe0817d, '^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$'), mapcss._tag_capture(capture_tags, 1, tags, 'interval'))))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("The interval is invalid (try a number of minutes)")
                # assertNoMatch:"relation type=route route=bus interval=00:05"
                # assertNoMatch:"relation type=route route=bus interval=00:10:00"
                # assertMatch:"relation type=route route=bus interval=00:70:00"
                # assertNoMatch:"relation type=route route=bus interval=02:00:00"
                # assertNoMatch:"relation type=route route=bus interval=10"
                # assertNoMatch:"relation type=route route=bus interval=120"
                # assertNoMatch:"relation type=route route=bus interval=5"
                # assertMatch:"relation type=route route=bus interval=irregular"
                # assertMatch:"relation type=route route=ferry interval=2heures"
                # assertMatch:"relation type=route_master route_master=bus interval=1240"
                err.append({'class': 9014021, 'subclass': 170114261, 'text': mapcss.tr('The interval is invalid (try a number of minutes)')})

        # relation.pt_route[duration][duration!~/^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
        # relation.pt_route_master[duration][duration!~/^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
        if ('duration' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (mapcss._tag_capture(capture_tags, 0, tags, 'duration')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_2fe0817d, '^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$'), mapcss._tag_capture(capture_tags, 1, tags, 'duration'))))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (mapcss._tag_capture(capture_tags, 0, tags, 'duration')) and (not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_2fe0817d, '^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$'), mapcss._tag_capture(capture_tags, 1, tags, 'duration'))))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("The duration is invalid (try a number of minutes)")
                # assertMatch:"relation type=route route=bus duration=20minutes"
                # assertNoMatch:"relation type=route route=bus duration=25:00"
                # assertNoMatch:"relation type=route route=ferry duration=120"
                # assertMatch:"relation type=route route=ferry duration=1240"
                # assertNoMatch:"relation type=route route=ferry duration=20"
                # assertNoMatch:"relation type=route_master route=bus duration=02:00:00"
                # assertNoMatch:"relation type=route_master route_master=bus duration=5"
                err.append({'class': 9014022, 'subclass': 317647061, 'text': mapcss.tr('The duration is invalid (try a number of minutes)')})

        # relation.pt_route["interval:conditional"][!interval]
        # relation.pt_route_master["interval:conditional"][!interval]
        if ('interval:conditional' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (mapcss._tag_capture(capture_tags, 0, tags, 'interval:conditional')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'interval')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (mapcss._tag_capture(capture_tags, 0, tags, 'interval:conditional')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'interval')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing interval tag to specify the main interval")
                err.append({'class': 9014023, 'subclass': 1710360237, 'text': mapcss.tr('Missing interval tag to specify the main interval')})

        # relation.pt_route["interval:conditional"][!opening_hours]
        # relation.pt_route_master["interval:conditional"][!opening_hours]
        if ('interval:conditional' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route) and (mapcss._tag_capture(capture_tags, 0, tags, 'interval:conditional')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'opening_hours')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((set_pt_route_master) and (mapcss._tag_capture(capture_tags, 0, tags, 'interval:conditional')) and (not mapcss._tag_capture(capture_tags, 1, tags, 'opening_hours')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing opening_hours tag")
                err.append({'class': 9014024, 'subclass': 210081506, 'text': mapcss.tr('Missing opening_hours tag')})

        # relation[railway=subway_entrance]
        # relation[railway=train_station_entrance]
        if ('railway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'railway') == mapcss._value_capture(capture_tags, 0, 'subway_entrance')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'railway') == mapcss._value_capture(capture_tags, 0, 'train_station_entrance')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Subway entrances should be mapped as nodes")
                err.append({'class': 9014027, 'subclass': 569512108, 'text': mapcss.tr('Subway entrances should be mapped as nodes')})

        return err
Example #39
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []

        # way[highway][destination][destination*="|"]
        # way[highway][/^destination:/][!/^destination:lanes/][!/^destination:.*:lanes/][/^destination:/=~/\|/]
        # way[waterway][destination][destination*="|"]
        # way[waterway][/^destination:/][!/^destination:lanes/][!/^destination:.*:lanes/][/^destination:/=~/\|/]
        if (u'destination' in keys and u'highway' in keys) or (
                u'destination' in keys
                and u'waterway' in keys) or (u'highway'
                                             in keys) or (u'waterway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'highway')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'destination')
                             and mapcss.string_contains(
                                 mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'destination'),
                                 mapcss._value_capture(capture_tags, 2, u'|')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'highway')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     self.re_53d7e349)
                             and not mapcss._tag_capture(
                                 capture_tags, 2, tags, self.re_49b44b3d)
                             and not mapcss._tag_capture(
                                 capture_tags, 3, tags, self.re_60b51c01)
                             and mapcss.regexp_test(
                                 self.re_262d3d80,
                                 mapcss._match_regex(tags, self.re_53d7e349)))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'waterway')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'destination')
                             and mapcss.string_contains(
                                 mapcss._tag_capture(capture_tags, 2, tags,
                                                     u'destination'),
                                 mapcss._value_capture(capture_tags, 2, u'|')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'waterway')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     self.re_53d7e349)
                             and not mapcss._tag_capture(
                                 capture_tags, 2, tags, self.re_49b44b3d)
                             and not mapcss._tag_capture(
                                 capture_tags, 3, tags, self.re_60b51c01)
                             and mapcss.regexp_test(
                                 self.re_262d3d80,
                                 mapcss._match_regex(tags, self.re_53d7e349)))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("Pipe characters should not be used in destination tag, only in destination:lanes")
                # -osmoseItemClassLevel:"3160/316010:0/3"
                # suggestAlternative:tr("In case of multiple values, use instead a semicolon to separate values")
                # throwError:tr("{0} contains a pipe character","{1.tag}")
                # fixAdd:concat("{1.key}=",replace("{1.value}","|",";"))
                # assertNoMatch:"way highway=primary destination:colour=Red"
                # assertMatch:"way highway=primary destination:colour=Red|Yellow"
                # assertNoMatch:"way highway=primary destination:lanes:backward=A8|Centre|Plage"
                # assertNoMatch:"way highway=primary destination:lanes=A8|Centre|Plage"
                # assertNoMatch:"way highway=primary destination:ref:lanes=A8|A10|A23"
                # assertNoMatch:"way highway=primary destination=A8"
                # assertMatch:"way highway=primary destination=A8|Centre|Plage"
                # assertNoMatch:"way highway=tertiary destination:ref:lanes:backward=B 3|B 3"
                # assertNoMatch:"way highway=tertiary destination:ref:to:lanes=A 7|"
                # assertNoMatch:"way waterway=river destination=East"
                # assertMatch:"way waterway=river destination=East|West"
                err.append({
                    'class':
                    316010,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(u'{0} contains a pipe character',
                              mapcss._tag_uncapture(capture_tags, u'{1.tag}')),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+':
                        dict([(mapcss.concat(
                            mapcss._tag_uncapture(capture_tags, u'{1.key}='),
                            mapcss.replace(
                                mapcss._tag_uncapture(capture_tags,
                                                      u'{1.value}'), u'|',
                                u';'))).split('=', 1)])
                    }
                })

        return err
Example #40
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_pt_route = set_pt_route_master = False

        # relation[type=route][!route]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route') and not mapcss._tag_capture(capture_tags, 1, tags, u'route'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({'class': 9014009, 'subclass': 828849115, 'text': mapcss.tr(u'Missing transportation mode, add a tag route = bus/coach/tram/etc')})

        # relation[type=route_master][!route_master][!route]
        if (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route_master') and not mapcss._tag_capture(capture_tags, 1, tags, u'route_master') and not mapcss._tag_capture(capture_tags, 2, tags, u'route'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, add a tag route = bus/coach/tram/etc")
                err.append({'class': 9014009, 'subclass': 607011337, 'text': mapcss.tr(u'Missing transportation mode, add a tag route = bus/coach/tram/etc')})

        # relation[type=route_master][!route_master][route]
        if (u'route' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route_master') and not mapcss._tag_capture(capture_tags, 1, tags, u'route_master') and mapcss._tag_capture(capture_tags, 2, tags, u'route'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing transportation mode, change tag route to route_master")
                # fixChangeKey:"route=>route_master"
                err.append({'class': 9014010, 'subclass': 3385524, 'text': mapcss.tr(u'Missing transportation mode, change tag route to route_master'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'route_master', mapcss.tag(tags, u'route')]]),
                    '-': ([
                    u'route'])
                }})

        # relation[type=route][route=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus|walking_bus)$/]
        if (u'route' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_6194d2a4), mapcss._tag_capture(capture_tags, 1, tags, u'route')))
                except mapcss.RuleAbort: pass
            if match:
                # setpt_route
                set_pt_route = True

        # relation[type=route_master][route_master=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus|walking_bus)$/]
        if (u'route_master' in keys and u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'route_master') and mapcss.regexp_test(mapcss._value_capture(capture_tags, 1, self.re_6194d2a4), mapcss._tag_capture(capture_tags, 1, tags, u'route_master')))
                except mapcss.RuleAbort: pass
            if match:
                # setpt_route_master
                set_pt_route_master = True

        # relation.pt_route[!public_transport:version]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'public_transport:version'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21401/3"
                # throwError:tr("Missing public_transport:version tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus public_transport:version=1"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21401, 'subclass': 0, 'text': mapcss.tr(u'Missing public_transport:version tag on a public_transport route relation')})

        # relation.pt_route[!network]
        # relation.pt_route_master[!network]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'network'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'network'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21402/3"
                # throwError:tr("Missing network tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus network=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21402, 'subclass': 0, 'text': mapcss.tr(u'Missing network tag on a public_transport relation')})

        # relation.pt_route[!operator]
        # relation.pt_route_master[!operator]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'operator'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'operator'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21403/3"
                # throwError:tr("Missing operator tag on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus operator=BiBiBus"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21403, 'subclass': 0, 'text': mapcss.tr(u'Missing operator tag on a public_transport relation')})

        # relation.pt_route[!ref]
        # relation.pt_route_master[!ref]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'ref'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'ref'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21404/3"
                # throwError:tr("Missing ref tag for line number on a public_transport relation")
                # assertNoMatch:"relation type=route route=bus ref=3"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21404, 'subclass': 0, 'text': mapcss.tr(u'Missing ref tag for line number on a public_transport relation')})

        # relation.pt_route[!from]
        # relation.pt_route[!to]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'from'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'to'))
                except mapcss.RuleAbort: pass
            if match:
                # -osmoseItemClassLevel:"2140/21405/3"
                # throwError:tr("Missing from/to tag on a public_transport route relation")
                # assertNoMatch:"relation type=route route=bus from=A to=B"
                # assertMatch:"relation type=route route=bus from=A"
                # assertMatch:"relation type=route route=bus to=B"
                # assertMatch:"relation type=route route=bus"
                err.append({'class': 21405, 'subclass': 0, 'text': mapcss.tr(u'Missing from/to tag on a public_transport route relation')})

        # relation.pt_route[tag(network)!=parent_tag(network)]
        # Part of rule not implemented

        # relation.pt_route[tag(operator)!=parent_tag(operator)]
        # Part of rule not implemented

        # relation.pt_route[tag(ref)!=parent_tag(ref)]
        # Part of rule not implemented

        # relation.pt_route[tag(colour)!=parent_tag(colour)]
        # Part of rule not implemented

        # relation.pt_route[tag(route)!=parent_tag(route_master)]
        # Part of rule not implemented

        # relation.pt_route[!colour][color]
        # relation.pt_route_master[!colour][color]
        if (u'color' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and not mapcss._tag_capture(capture_tags, 0, tags, u'colour') and mapcss._tag_capture(capture_tags, 1, tags, u'color'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and not mapcss._tag_capture(capture_tags, 0, tags, u'colour') and mapcss._tag_capture(capture_tags, 1, tags, u'color'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("The color of the public transport line should be in a colour tag")
                # fixChangeKey:"color=>colour"
                err.append({'class': 9014020, 'subclass': 218794881, 'text': mapcss.tr(u'The color of the public transport line should be in a colour tag'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'colour', mapcss.tag(tags, u'color')]]),
                    '-': ([
                    u'color'])
                }})

        # relation.pt_route["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if (u'operator' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'operator')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'operator')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Check the operator tag : this operator does not exist, it may be a typo")
                err.append({'class': 9014025, 'subclass': 286137008, 'text': mapcss.tr(u'Check the operator tag : this operator does not exist, it may be a typo')})

        # relation.pt_route["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        # relation.pt_route_master["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
        if (u'network' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'network')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_25554804), mapcss._tag_capture(capture_tags, 0, tags, u'network')) and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Check the network tag : this network does not exist, it may be a typo")
                err.append({'class': 9014026, 'subclass': 735027962, 'text': mapcss.tr(u'Check the network tag : this network does not exist, it may be a typo')})

        # relation[highway=bus_stop]
        if (u'highway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') == mapcss._value_capture(capture_tags, 0, u'bus_stop'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("A bus stop is supposed to be a node")
                err.append({'class': 9014019, 'subclass': 1590282811, 'text': mapcss.tr(u'A bus stop is supposed to be a node')})

        # relation.pt_route!.route_ok
        # Use undeclared class pt_route, route_ok

        # relation.pt_route[interval][interval!~/^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
        # relation.pt_route_master[interval][interval!~/^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
        if (u'interval' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss._tag_capture(capture_tags, 0, tags, u'interval') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_2fe0817d, u'^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$'), mapcss._tag_capture(capture_tags, 1, tags, u'interval')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss._tag_capture(capture_tags, 0, tags, u'interval') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_2fe0817d, u'^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$'), mapcss._tag_capture(capture_tags, 1, tags, u'interval')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("The interval is invalid (try a number of minutes)")
                # assertNoMatch:"relation type=route route=bus interval=00:05"
                # assertNoMatch:"relation type=route route=bus interval=00:10:00"
                # assertMatch:"relation type=route route=bus interval=00:70:00"
                # assertNoMatch:"relation type=route route=bus interval=02:00:00"
                # assertNoMatch:"relation type=route route=bus interval=10"
                # assertNoMatch:"relation type=route route=bus interval=120"
                # assertNoMatch:"relation type=route route=bus interval=5"
                # assertMatch:"relation type=route route=bus interval=irregular"
                # assertMatch:"relation type=route route=ferry interval=2heures"
                # assertMatch:"relation type=route_master route_master=bus interval=1240"
                err.append({'class': 9014021, 'subclass': 170114261, 'text': mapcss.tr(u'The interval is invalid (try a number of minutes)')})

        # relation.pt_route[duration][duration!~/^([0-9][0-9]?[0-9]?|(PT)?[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?|P(?!$)((\d+Y)|(\d+\.\d+Y$))?((\d+M)|(\d+\.\d+M$))?((\d+W)|(\d+\.\d+W$))?((\d+D)|(\d+\.\d+D$))?(T(?=\d)((\d+H)|(\d+\.\d+H$))?((\d+M)|(\d+\.\d+M$))?(\d+(\.\d+)?S)?)??)$/]
        # relation.pt_route_master[duration][duration!~/^([0-9][0-9]?[0-9]?|(PT)?[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?|P(?!$)((\d+Y)|(\d+\.\d+Y$))?((\d+M)|(\d+\.\d+M$))?((\d+W)|(\d+\.\d+W$))?((\d+D)|(\d+\.\d+D$))?(T(?=\d)((\d+H)|(\d+\.\d+H$))?((\d+M)|(\d+\.\d+M$))?(\d+(\.\d+)?S)?)??)$/]
        if (u'duration' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss._tag_capture(capture_tags, 0, tags, u'duration') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_181de9b6, u'^([0-9][0-9]?[0-9]?|(PT)?[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?|P(?!$)((\d+Y)|(\d+\.\d+Y$))?((\d+M)|(\d+\.\d+M$))?((\d+W)|(\d+\.\d+W$))?((\d+D)|(\d+\.\d+D$))?(T(?=\d)((\d+H)|(\d+\.\d+H$))?((\d+M)|(\d+\.\d+M$))?(\d+(\.\d+)?S)?)??)$'), mapcss._tag_capture(capture_tags, 1, tags, u'duration')))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss._tag_capture(capture_tags, 0, tags, u'duration') and not mapcss.regexp_test(mapcss._value_const_capture(capture_tags, 1, self.re_181de9b6, u'^([0-9][0-9]?[0-9]?|(PT)?[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?|P(?!$)((\d+Y)|(\d+\.\d+Y$))?((\d+M)|(\d+\.\d+M$))?((\d+W)|(\d+\.\d+W$))?((\d+D)|(\d+\.\d+D$))?(T(?=\d)((\d+H)|(\d+\.\d+H$))?((\d+M)|(\d+\.\d+M$))?(\d+(\.\d+)?S)?)??)$'), mapcss._tag_capture(capture_tags, 1, tags, u'duration')))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("The duration is invalid (try a number of minutes)")
                # assertMatch:"relation type=route route=bus duration=20minutes"
                # assertNoMatch:"relation type=route route=bus duration=25:00"
                # assertNoMatch:"relation type=route route=ferry duration=120"
                # assertMatch:"relation type=route route=ferry duration=1240"
                # assertNoMatch:"relation type=route route=ferry duration=20"
                # assertNoMatch:"relation type=route route=ferry duration=P0.5D"
                # assertNoMatch:"relation type=route route=ferry duration=PT02:25:06"
                # assertNoMatch:"relation type=route route=ferry duration=PT120M"
                # assertNoMatch:"relation type=route route=ferry duration=PT20M"
                # assertNoMatch:"relation type=route route=ferry duration=PT2H25M6S"
                # assertNoMatch:"relation type=route route=ferry duration=PT50S"
                # assertNoMatch:"relation type=route_master route=bus duration=02:00:00"
                # assertNoMatch:"relation type=route_master route=ferry duration=PT4H"
                # assertNoMatch:"relation type=route_master route_master=bus duration=5"
                err.append({'class': 9014022, 'subclass': 305414991, 'text': mapcss.tr(u'The duration is invalid (try a number of minutes)')})

        # relation.pt_route["interval:conditional"][!interval]
        # relation.pt_route_master["interval:conditional"][!interval]
        if (u'interval:conditional' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss._tag_capture(capture_tags, 0, tags, u'interval:conditional') and not mapcss._tag_capture(capture_tags, 1, tags, u'interval'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss._tag_capture(capture_tags, 0, tags, u'interval:conditional') and not mapcss._tag_capture(capture_tags, 1, tags, u'interval'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing interval tag to specify the main interval")
                err.append({'class': 9014023, 'subclass': 1710360237, 'text': mapcss.tr(u'Missing interval tag to specify the main interval')})

        # relation.pt_route["interval:conditional"][!opening_hours]
        # relation.pt_route_master["interval:conditional"][!opening_hours]
        if (u'interval:conditional' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (set_pt_route and mapcss._tag_capture(capture_tags, 0, tags, u'interval:conditional') and not mapcss._tag_capture(capture_tags, 1, tags, u'opening_hours'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (set_pt_route_master and mapcss._tag_capture(capture_tags, 0, tags, u'interval:conditional') and not mapcss._tag_capture(capture_tags, 1, tags, u'opening_hours'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Missing opening_hours tag")
                err.append({'class': 9014024, 'subclass': 210081506, 'text': mapcss.tr(u'Missing opening_hours tag')})

        return err