Ejemplo n.º 1
0
    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
Ejemplo n.º 2
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.")
                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 = []

        # *[amenity=pharmacy][!dispensing][inside("IT")]
        if ('amenity' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags, 'amenity')
                        == mapcss._value_capture(capture_tags, 0, 'pharmacy')
                        and not mapcss._tag_capture(capture_tags, 1, tags,
                                                    'dispensing')
                        and mapcss.inside(self.father.config.options, 'IT'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # -osmoseTags:list("fix:chair")
                # -osmoseItemClassLevel:"2100/21001/3"
                # throwWarning:tr("{0} without {1}","{0.tag}","{1.key}")
                err.append({
                    'class':
                    21001,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr('{0} without {1}',
                              mapcss._tag_uncapture(capture_tags, '{0.tag}'),
                              mapcss._tag_uncapture(capture_tags, '{1.key}'))
                })

        return err
Ejemplo n.º 4
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_pt_route = set_pt_route_master = False

        # node[highway=bus_stop][amenity=bus_station]
        if (u'amenity' 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'bus_stop')
                        and mapcss._tag_capture(
                            capture_tags, 1, tags,
                            u'amenity') == mapcss._value_capture(
                                capture_tags, 1, u'bus_station'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwError:tr("Is it a bus stop or a bus station?")
                # fixRemove:"amenity"
                err.append({
                    'class':
                    9014002,
                    'subclass':
                    1676203359,
                    'text':
                    mapcss.tr(u'Is it a bus stop or a bus station?'),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-': ([u'amenity'])
                    }
                })

        # node[highway=bus_stop][!public_transport]
        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')
                        and not mapcss._tag_capture(capture_tags, 1, tags,
                                                    u'public_transport'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("Missing public_transport tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21411:0/3"
                # throwError:tr("Specify if it is a stop (platform) or a location on the road (stop_position)")
                # fixAdd:"public_transport=platform"
                # assertNoMatch:"node highway=bus_stop public_transport=platform"
                # assertNoMatch:"node highway=bus_stop public_transport=stop_position"
                # assertMatch:"node highway=bus_stop"
                err.append({
                    'class':
                    21411,
                    'subclass':
                    0,
                    'text':
                    mapcss.
                    tr(u'Specify if it is a stop (platform) or a location on the road (stop_position)'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+': dict([[u'public_transport', u'platform']])
                    }
                })

        # node[railway=tram_stop][!public_transport]
        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'tram_stop')
                        and not mapcss._tag_capture(capture_tags, 1, tags,
                                                    u'public_transport'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("Missing public_transport tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21411:1/3"
                # throwError:tr("Specify if it is a stop (platform) or a location on the rails (stop_position)")
                # fixAdd:"public_transport=stop_position"
                # assertNoMatch:"node railway=tram_stop public_transport=platform"
                # assertNoMatch:"node railway=tram_stop public_transport=stop_position"
                # assertMatch:"node railway=tram_stop"
                err.append({
                    'class':
                    21411,
                    'subclass':
                    1,
                    'text':
                    mapcss.
                    tr(u'Specify if it is a stop (platform) or a location on the rails (stop_position)'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+': dict([[u'public_transport', u'stop_position']])
                    }
                })

        # node[public_transport=platform][!highway][!railway][!bus][!shelter]
        if (u'public_transport' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'public_transport')
                        == mapcss._value_capture(capture_tags, 0, u'platform')
                        and not mapcss._tag_capture(capture_tags, 1, tags,
                                                    u'highway')
                        and not mapcss._tag_capture(capture_tags, 2, tags,
                                                    u'railway') and
                        not mapcss._tag_capture(capture_tags, 3, tags, u'bus')
                        and not mapcss._tag_capture(capture_tags, 4, tags,
                                                    u'shelter'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("Missing legacy tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21412:1/3"
                # throwError:tr("The legacy tag is missing, add the tag highway=bus_stop / railway=tram_stop")
                err.append({
                    'class':
                    21412,
                    'subclass':
                    1,
                    'text':
                    mapcss.
                    tr(u'The legacy tag is missing, add the tag highway=bus_stop / railway=tram_stop'
                       )
                })

        # node[public_transport=platform][!highway][!railway][bus=yes]
        # node[public_transport=platform][!highway][!railway][shelter]
        if (u'bus' in keys and u'public_transport' in keys) or (
                u'public_transport' in keys and u'shelter' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (
                        mapcss._tag_capture(capture_tags, 0, tags,
                                            u'public_transport')
                        == mapcss._value_capture(capture_tags, 0, u'platform')
                        and not mapcss._tag_capture(capture_tags, 1, tags,
                                                    u'highway')
                        and not mapcss._tag_capture(capture_tags, 2, tags,
                                                    u'railway')
                        and mapcss._tag_capture(capture_tags, 3, tags, u'bus')
                        == mapcss._value_capture(capture_tags, 3, u'yes'))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(
                        capture_tags, 0, tags,
                        u'public_transport') == mapcss._value_capture(
                            capture_tags, 0, u'platform')
                             and not mapcss._tag_capture(
                                 capture_tags, 1, tags, u'highway')
                             and not mapcss._tag_capture(
                                 capture_tags, 2, tags, u'railway')
                             and mapcss._tag_capture(capture_tags, 3, tags,
                                                     u'shelter'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("Missing legacy tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21412:0/3"
                # throwError:tr("Is this a bus stop? add the tag highway=bus_stop")
                # fixAdd:"highway=bus_stop"
                # assertMatch:"node public_transport=platform shelter=yes"
                err.append({
                    'class':
                    21412,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr(
                        u'Is this a bus stop? add the tag highway=bus_stop'),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '+': dict([[u'highway', u'bus_stop']])
                    }
                })

        # node[highway=bus_stop][note]
        # node[highway=bus_stop][note:fr][inside("FR")]
        if (u'highway' in keys
                and u'note' in keys) or (u'highway' in keys
                                         and u'note:fr' 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')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'note'))
                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'bus_stop')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'note:fr')
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("Check if the note can be deleted")
                err.append({
                    'class':
                    9014006,
                    'subclass':
                    673170504,
                    'text':
                    mapcss.tr(u'Check if the note can be deleted')
                })

        # node[highway=bus_stop][network][inside("FR")]
        if (u'highway' in keys and u'network' 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')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'network')
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("The network should be on the transport lines and not on the stops")
                # fixRemove:"network"
                err.append({
                    'class':
                    9014007,
                    'subclass':
                    1428913922,
                    'text':
                    mapcss.
                    tr(u'The network should be on the transport lines and not on the stops'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-': ([u'network'])
                    }
                })

        # node[highway=bus_stop][operator][inside("FR")]
        if (u'highway' in keys and u'operator' 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')
                        and mapcss._tag_capture(capture_tags, 1, tags,
                                                u'operator')
                        and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort:
                    pass
            if match:
                # throwWarning:tr("The operator should be on the transport lines and not on the stops")
                # fixRemove:"operator"
                err.append({
                    'class':
                    9014008,
                    'subclass':
                    210603856,
                    'text':
                    mapcss.
                    tr(u'The operator should be on the transport lines and not on the stops'
                       ),
                    'allow_fix_override':
                    True,
                    'fix': {
                        '-': ([u'operator'])
                    }
                })

        return err
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
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
Ejemplo n.º 8
0
    def node(self, data, tags):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_pt_route = set_pt_route_master = False

        # node[highway=bus_stop][amenity=bus_station]
        if (u'amenity' 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'bus_stop') and mapcss._tag_capture(capture_tags, 1, tags, u'amenity') == mapcss._value_capture(capture_tags, 1, u'bus_station'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Is it a bus stop or a bus station?")
                # fixRemove:"amenity"
                err.append({'class': 9014002, 'subclass': 1676203359, 'text': mapcss.tr(u'Is it a bus stop or a bus station?'), 'allow_fix_override': True, 'fix': {
                    '-': ([
                    u'amenity'])
                }})

        # node[highway=bus_stop][!public_transport]
        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') and not mapcss._tag_capture(capture_tags, 1, tags, u'public_transport'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Missing public_transport tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21411:0/3"
                # throwError:tr("Specify if it is a stop (platform) or a location on the road (stop_position)")
                # fixAdd:"public_transport=platform"
                # assertNoMatch:"node highway=bus_stop public_transport=platform"
                # assertNoMatch:"node highway=bus_stop public_transport=stop_position"
                # assertMatch:"node highway=bus_stop"
                err.append({'class': 21411, 'subclass': 0, 'text': mapcss.tr(u'Specify if it is a stop (platform) or a location on the road (stop_position)'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'public_transport',u'platform']])
                }})

        # node[railway=tram_stop][!public_transport]
        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'tram_stop') and not mapcss._tag_capture(capture_tags, 1, tags, u'public_transport'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Missing public_transport tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21411:1/3"
                # throwError:tr("Specify if it is a stop (platform) or a location on the rails (stop_position)")
                # fixAdd:"public_transport=stop_position"
                # assertNoMatch:"node railway=tram_stop public_transport=platform"
                # assertNoMatch:"node railway=tram_stop public_transport=stop_position"
                # assertMatch:"node railway=tram_stop"
                err.append({'class': 21411, 'subclass': 1, 'text': mapcss.tr(u'Specify if it is a stop (platform) or a location on the rails (stop_position)'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'public_transport',u'stop_position']])
                }})

        # node[public_transport=platform][!highway][!railway][!bus][!shelter]
        if (u'public_transport' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'public_transport') == mapcss._value_capture(capture_tags, 0, u'platform') and not mapcss._tag_capture(capture_tags, 1, tags, u'highway') and not mapcss._tag_capture(capture_tags, 2, tags, u'railway') and not mapcss._tag_capture(capture_tags, 3, tags, u'bus') and not mapcss._tag_capture(capture_tags, 4, tags, u'shelter'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Missing legacy tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21412:1/3"
                # throwError:tr("The legacy tag is missing, add the tag highway=bus_stop / railway=tram_stop")
                err.append({'class': 21412, 'subclass': 1, 'text': mapcss.tr(u'The legacy tag is missing, add the tag highway=bus_stop / railway=tram_stop')})

        # node[public_transport=platform][!highway][!railway][bus=yes]
        # node[public_transport=platform][!highway][!railway][shelter]
        if (u'bus' in keys and u'public_transport' in keys) or (u'public_transport' in keys and u'shelter' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'public_transport') == mapcss._value_capture(capture_tags, 0, u'platform') and not mapcss._tag_capture(capture_tags, 1, tags, u'highway') and not mapcss._tag_capture(capture_tags, 2, tags, u'railway') and mapcss._tag_capture(capture_tags, 3, tags, u'bus') == mapcss._value_capture(capture_tags, 3, u'yes'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'public_transport') == mapcss._value_capture(capture_tags, 0, u'platform') and not mapcss._tag_capture(capture_tags, 1, tags, u'highway') and not mapcss._tag_capture(capture_tags, 2, tags, u'railway') and mapcss._tag_capture(capture_tags, 3, tags, u'shelter'))
                except mapcss.RuleAbort: pass
            if match:
                # group:tr("Missing legacy tag on a public transport stop")
                # -osmoseItemClassLevel:"2140/21412:0/3"
                # throwError:tr("Is this a bus stop? add the tag highway=bus_stop")
                # fixAdd:"highway=bus_stop"
                # assertMatch:"node public_transport=platform shelter=yes"
                err.append({'class': 21412, 'subclass': 0, 'text': mapcss.tr(u'Is this a bus stop? add the tag highway=bus_stop'), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'highway',u'bus_stop']])
                }})

        # node[highway=bus_stop][note]
        # node[highway=bus_stop][note:fr][inside("FR")]
        if (u'highway' in keys and u'note' in keys) or (u'highway' in keys and u'note:fr' 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') and mapcss._tag_capture(capture_tags, 1, tags, u'note'))
                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'bus_stop') and mapcss._tag_capture(capture_tags, 1, tags, u'note:fr') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("Check if the note can be deleted")
                err.append({'class': 9014006, 'subclass': 673170504, 'text': mapcss.tr(u'Check if the note can be deleted')})

        # node[highway=bus_stop][network][inside("FR")]
        if (u'highway' in keys and u'network' 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') and mapcss._tag_capture(capture_tags, 1, tags, u'network') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("The network should be on the transport lines and not on the stops")
                # fixRemove:"network"
                err.append({'class': 9014007, 'subclass': 1428913922, 'text': mapcss.tr(u'The network should be on the transport lines and not on the stops'), 'allow_fix_override': True, 'fix': {
                    '-': ([
                    u'network'])
                }})

        # node[highway=bus_stop][operator][inside("FR")]
        if (u'highway' in keys and u'operator' 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') and mapcss._tag_capture(capture_tags, 1, tags, u'operator') and mapcss.inside(self.father.config.options, u'FR'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("The operator should be on the transport lines and not on the stops")
                # fixRemove:"operator"
                err.append({'class': 9014008, 'subclass': 210603856, 'text': mapcss.tr(u'The operator should be on the transport lines and not on the stops'), 'allow_fix_override': True, 'fix': {
                    '-': ([
                    u'operator'])
                }})

        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
Ejemplo n.º 10
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
Ejemplo n.º 11
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
    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
Ejemplo n.º 13
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
Ejemplo n.º 14
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
    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("Tag gauge manquant sur 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'Tag gauge manquant sur rail')})

        return err
Ejemplo n.º 16
0
    def way(self, data, tags, nds):
        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")
                # 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
Ejemplo n.º 17
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
    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
Ejemplo n.º 19
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