Ejemplo n.º 1
0
    def relation(self, data, tags, members):
        capture_tags = {}
        keys = tags.keys()
        err = []


        # *[religion=catholic]
        if ('religion' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'religion') == mapcss._value_capture(capture_tags, 0, 'catholic')))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0}","{0.tag}")
                # suggestAlternative:"religion=christian + denomination=catholic"
                # fixChangeKey:"religion => denomination"
                # fixAdd:"religion=christian"
                err.append({'class': 9008005, 'subclass': 97466527, 'text': mapcss.tr('{0}', mapcss._tag_uncapture(capture_tags, '{0.tag}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    ['denomination', mapcss.tag(tags, 'religion')],
                    ['religion','christian']]),
                    '-': ([
                    'religion'])
                }})

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

        # *[addr:housenumber][addr:housename]["addr:housenumber"=*"addr:housename"]
        if (u'addr:housename' in keys and u'addr:housenumber' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 u'addr:housenumber')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     u'addr:housename')
                             and mapcss._tag_capture(
                                 capture_tags, 2, tags,
                                 u'addr:housenumber') == mapcss._value_capture(
                                     capture_tags, 2,
                                     mapcss.tag(tags, u'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(u'Same value of {0} and {1}',
                              mapcss._tag_uncapture(capture_tags, u'{0.key}'),
                              mapcss._tag_uncapture(capture_tags, u'{1.key}'))
                })

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


        # node[area=no]
        # node[oneway]
        # node[bridge]
        # node[sidewalk]
        # node[footway][footway!=crossing]
        # node[man_made=embankment]
        # node[man_made=groyne]
        # node[man_made=cutline]
        # node[power=line]
        # node[cutline]
        # node[aerialway=cable_car]
        # node[aerialway=gondola]
        # node[aerialway=chair_lift]
        # node[aerialway=mixed_lift]
        # node[aerialway=drag_lift]
        # node[aerialway=t-bar]
        # node[aerialway=j-bar]
        # node[aerialway=platter]
        # node[aerialway=magic_carpet]
        # node[aerialway=rope_tow]
        # node[aerialway=goods]
        # node[aeroway=taxiway]
        # node[aeroway=runway]
        # node[railway=rail]
        # node[railway=narrow_gauge]
        # node[railway=monorail]
        # node[railway=preserved]
        # node[railway=light_rail]
        # node[railway=subway]
        # node[railway=tram]
        # node[railway=disused]
        # node[railway=abandoned]
        # node[waterway=river]
        # node[waterway=canal]
        # node[waterway=stream]
        # node[waterway=ditch]
        # node[waterway=drain]
        # node[natural=coastline]
        # node[natural=ridge]
        # node[natural=valley]
        # node[natural=tree_row]
        if (u'aerialway' in keys) or (u'aeroway' in keys) or (u'area' in keys) or (u'bridge' in keys) or (u'cutline' in keys) or (u'footway' in keys) or (u'man_made' in keys) or (u'natural' in keys) or (u'oneway' in keys) or (u'power' in keys) or (u'railway' in keys) or (u'sidewalk' in keys) or (u'waterway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'area') == mapcss._value_capture(capture_tags, 0, u'no'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'oneway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'bridge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'sidewalk'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway') and mapcss._tag_capture(capture_tags, 1, tags, u'footway') != mapcss._value_const_capture(capture_tags, 1, u'crossing', u'crossing'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'embankment'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'groyne'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'cutline'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'line'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'cutline'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'cable_car'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'gondola'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'chair_lift'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'mixed_lift'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'drag_lift'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u't-bar'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'j-bar'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'platter'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'magic_carpet'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'rope_tow'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'goods'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'taxiway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'runway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'rail'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'narrow_gauge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'monorail'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'preserved'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'light_rail'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'subway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'tram'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'disused'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'abandoned'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'river'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'canal'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'stream'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'ditch'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'drain'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'coastline'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'ridge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'valley'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'tree_row'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node. Should be used on a way.","{0.tag}")
                # assertMatch:"node bridge=viaduct"
                # assertMatch:"node bridge=yes"
                # assertMatch:"node oneway=-1"
                err.append({'class': 9003001, 'subclass': 431750003, 'text': mapcss.tr(u'{0} on a node. Should be used on a way.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[boundary=administrative]
        if (u'boundary' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'boundary') == mapcss._value_capture(capture_tags, 0, u'administrative'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node. Should be used on a way or relation.","{0.tag}")
                err.append({'class': 9003002, 'subclass': 1005532536, 'text': mapcss.tr(u'{0} on a node. Should be used on a way or relation.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[golf=green]
        # node[golf=bunker]
        # node[golf=fairway]
        # node[area=yes]
        # node[area:highway]
        # node[landuse]
        # node[natural=scree]
        # node[natural=scrub]
        # node[natural=fell]
        # node[natural=heath]
        # node[natural=wood]
        # node[natural=grassland]
        # node[natural=wetland]
        # node[natural=water]
        # node[natural=mud]
        # node[natural=beach]
        # node[natural=sand]
        # node[natural=wood]
        # node[natural=bare_rock]
        # node[natural=glacier]
        # node[leisure=park][natural!=tree]
        # node[leisure=nature_reserve]
        # node[waterway=riverbank]
        # node[man_made=bridge]
        # node[man_made=breakwater]
        # node[aeroway=apron]
        # node[power=plant]
        # node[power=switchgear]
        # node[building:part]
        # node[source:outline]
        if (u'aeroway' in keys) or (u'area' in keys) or (u'area:highway' in keys) or (u'building:part' in keys) or (u'golf' in keys) or (u'landuse' in keys) or (u'leisure' in keys) or (u'man_made' in keys) or (u'natural' in keys) or (u'power' in keys) or (u'source:outline' in keys) or (u'waterway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'golf') == mapcss._value_capture(capture_tags, 0, u'green'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'golf') == mapcss._value_capture(capture_tags, 0, u'bunker'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'golf') == mapcss._value_capture(capture_tags, 0, u'fairway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'area') == mapcss._value_capture(capture_tags, 0, u'yes'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'area:highway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'landuse'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'scree'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'scrub'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'fell'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'heath'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'wood'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'grassland'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'wetland'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'water'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'mud'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'beach'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'sand'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'wood'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'bare_rock'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'glacier'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'leisure') == mapcss._value_capture(capture_tags, 0, u'park') and mapcss._tag_capture(capture_tags, 1, tags, u'natural') != mapcss._value_const_capture(capture_tags, 1, u'tree', u'tree'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'leisure') == mapcss._value_capture(capture_tags, 0, u'nature_reserve'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'riverbank'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'bridge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'breakwater'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'apron'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'plant'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'switchgear'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building:part'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'source:outline'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node. Should be drawn as an area.","{0.tag}")
                err.append({'class': 9003003, 'subclass': 1633038746, 'text': mapcss.tr(u'{0} on a node. Should be drawn as an area.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[type=multipolygon]
        # node[interval]
        # node[route]
        # node[restriction]
        if (u'interval' in keys) or (u'restriction' in keys) or (u'route' in keys) or (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'multipolygon'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'interval'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'route'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'restriction'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("{0} on a node. Should be used in a relation","{0.tag}")
                err.append({'class': 9003004, 'subclass': 104835602, 'text': mapcss.tr(u'{0} on a node. Should be used in a relation', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[man_made!=monitoring_station][at(0.0,0.0)]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') != mapcss._value_const_capture(capture_tags, 0, u'monitoring_station', u'monitoring_station') and mapcss.at(data['lat'], data['lon'], 0.0, 0.0))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Object at Position 0.00E 0.00N. There is nothing at this position except an already mapped weather buoy.")
                # fixDeleteObject:this
                err.append({'class': 9003009, 'subclass': 829325630, 'text': mapcss.tr(u'Object at Position 0.00E 0.00N. There is nothing at this position except an already mapped weather buoy.')})

        # node[source:geometry]
        if (u'source:geometry' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'source:geometry'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node","{0.key}")
                # fixChangeKey:"source:geometry => source:position"
                err.append({'class': 9003006, 'subclass': 1287904360, 'text': mapcss.tr(u'{0} on a node', mapcss._tag_uncapture(capture_tags, u'{0.key}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'source:position', mapcss.tag(tags, u'source:geometry')]]),
                    '-': ([
                    u'source:geometry'])
                }})

        return err
Ejemplo n.º 4
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
Ejemplo n.º 5
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

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

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

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

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

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

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

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

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

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

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

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

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

        return err
Ejemplo n.º 6
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.º 7
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

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

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

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

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

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

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

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

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

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

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

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

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

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

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


        # node[area=no]
        # node[oneway]
        # node[bridge]
        # node[sidewalk]
        # node[footway]
        # node[man_made=embankment]
        # node[man_made=groyne]
        # node[man_made=cutline]
        # node[power=line]
        # node[cutline]
        # node[aerialway=cable_car]
        # node[aerialway=gondola]
        # node[aerialway=chair_lift]
        # node[aerialway=mixed_lift]
        # node[aerialway=drag_lift]
        # node[aerialway=t-bar]
        # node[aerialway=j-bar]
        # node[aerialway=platter]
        # node[aerialway=magic_carpet]
        # node[aerialway=rope_tow]
        # node[aerialway=goods]
        # node[aeroway=taxiway]
        # node[aeroway=runway]
        # node[railway=rail]
        # node[railway=narrow_gauge]
        # node[railway=monorail]
        # node[railway=preserved]
        # node[railway=light_rail]
        # node[railway=subway]
        # node[railway=tram]
        # node[railway=disused]
        # node[railway=abandoned]
        # node[waterway=river]
        # node[waterway=canal]
        # node[waterway=stream]
        # node[waterway=ditch]
        # node[waterway=drain]
        # node[natural=coastline]
        # node[natural=ridge]
        # node[natural=valley]
        # node[natural=tree_row]
        if (u'aerialway' in keys) or (u'aeroway' in keys) or (u'area' in keys) or (u'bridge' in keys) or (u'cutline' in keys) or (u'footway' in keys) or (u'man_made' in keys) or (u'natural' in keys) or (u'oneway' in keys) or (u'power' in keys) or (u'railway' in keys) or (u'sidewalk' in keys) or (u'waterway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'area') == mapcss._value_capture(capture_tags, 0, u'no'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'oneway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'bridge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'sidewalk'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'footway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'embankment'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'groyne'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'cutline'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'line'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'cutline'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'cable_car'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'gondola'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'chair_lift'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'mixed_lift'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'drag_lift'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u't-bar'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'j-bar'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'platter'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'magic_carpet'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'rope_tow'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aerialway') == mapcss._value_capture(capture_tags, 0, u'goods'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'taxiway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'runway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'rail'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'narrow_gauge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'monorail'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'preserved'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'light_rail'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'subway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'tram'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'disused'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'railway') == mapcss._value_capture(capture_tags, 0, u'abandoned'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'river'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'canal'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'stream'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'ditch'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'drain'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'coastline'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'ridge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'valley'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'tree_row'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node. Should be used on a way.","{0.tag}")
                # assertMatch:"node bridge=viaduct"
                # assertMatch:"node bridge=yes"
                # assertMatch:"node oneway=-1"
                err.append({'class': 9003001, 'subclass': 2132549655, 'text': mapcss.tr(u'{0} on a node. Should be used on a way.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[boundary=administrative]
        if (u'boundary' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'boundary') == mapcss._value_capture(capture_tags, 0, u'administrative'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node. Should be used on a way or relation.","{0.tag}")
                err.append({'class': 9003002, 'subclass': 1005532536, 'text': mapcss.tr(u'{0} on a node. Should be used on a way or relation.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[golf=green]
        # node[golf=bunker]
        # node[golf=fairway]
        # node[area=yes]
        # node[area:highway]
        # node[landuse]
        # node[natural=scree]
        # node[natural=scrub]
        # node[natural=fell]
        # node[natural=heath]
        # node[natural=wood]
        # node[natural=grassland]
        # node[natural=wetland]
        # node[natural=water]
        # node[natural=mud]
        # node[natural=beach]
        # node[natural=sand]
        # node[natural=wood]
        # node[natural=bare_rock]
        # node[natural=glacier]
        # node[leisure=park][natural!=tree]
        # node[leisure=nature_reserve]
        # node[waterway=riverbank]
        # node[man_made=bridge]
        # node[man_made=breakwater]
        # node[aeroway=apron]
        # node[power=plant]
        # node[power=switchgear]
        # node[building:part]
        # node[source:outline]
        if (u'aeroway' in keys) or (u'area' in keys) or (u'area:highway' in keys) or (u'building:part' in keys) or (u'golf' in keys) or (u'landuse' in keys) or (u'leisure' in keys) or (u'man_made' in keys) or (u'natural' in keys) or (u'power' in keys) or (u'source:outline' in keys) or (u'waterway' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'golf') == mapcss._value_capture(capture_tags, 0, u'green'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'golf') == mapcss._value_capture(capture_tags, 0, u'bunker'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'golf') == mapcss._value_capture(capture_tags, 0, u'fairway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'area') == mapcss._value_capture(capture_tags, 0, u'yes'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'area:highway'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'landuse'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'scree'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'scrub'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'fell'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'heath'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'wood'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'grassland'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'wetland'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'water'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'mud'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'beach'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'sand'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'wood'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'bare_rock'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'natural') == mapcss._value_capture(capture_tags, 0, u'glacier'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'leisure') == mapcss._value_capture(capture_tags, 0, u'park') and mapcss._tag_capture(capture_tags, 1, tags, u'natural') != mapcss._value_capture(capture_tags, 1, u'tree'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'leisure') == mapcss._value_capture(capture_tags, 0, u'nature_reserve'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') == mapcss._value_capture(capture_tags, 0, u'riverbank'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'bridge'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') == mapcss._value_capture(capture_tags, 0, u'breakwater'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'aeroway') == mapcss._value_capture(capture_tags, 0, u'apron'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'plant'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'power') == mapcss._value_capture(capture_tags, 0, u'switchgear'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'building:part'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'source:outline'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node. Should be drawn as an area.","{0.tag}")
                err.append({'class': 9003003, 'subclass': 1633038746, 'text': mapcss.tr(u'{0} on a node. Should be drawn as an area.', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[type=multipolygon]
        # node[interval]
        # node[route]
        # node[restriction]
        if (u'interval' in keys) or (u'restriction' in keys) or (u'route' in keys) or (u'type' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'type') == mapcss._value_capture(capture_tags, 0, u'multipolygon'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'interval'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'route'))
                except mapcss.RuleAbort: pass
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'restriction'))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("{0} on a node. Should be used in a relation","{0.tag}")
                err.append({'class': 9003004, 'subclass': 104835602, 'text': mapcss.tr(u'{0} on a node. Should be used in a relation', mapcss._tag_uncapture(capture_tags, u'{0.tag}'))})

        # node[man_made!=monitoring_station][at(0.0,0.0)]
        if True:
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'man_made') != mapcss._value_capture(capture_tags, 0, u'monitoring_station') and mapcss.at(data['lat'], data['lon'], 0.0, 0.0))
                except mapcss.RuleAbort: pass
            if match:
                # throwError:tr("Object at Position 0.00E 0.00N. There is nothing at this position except an already mapped weather buoy.")
                # fixDeleteObject:this
                err.append({'class': 9003009, 'subclass': 829325630, 'text': mapcss.tr(u'Object at Position 0.00E 0.00N. There is nothing at this position except an already mapped weather buoy.')})

        # node[source:geometry]
        if (u'source:geometry' in keys):
            match = False
            if not match:
                capture_tags = {}
                try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'source:geometry'))
                except mapcss.RuleAbort: pass
            if match:
                # throwWarning:tr("{0} on a node","{0.key}")
                # fixChangeKey:"source:geometry => source:position"
                err.append({'class': 9003006, 'subclass': 1287904360, 'text': mapcss.tr(u'{0} on a node', mapcss._tag_uncapture(capture_tags, u'{0.key}')), 'allow_fix_override': True, 'fix': {
                    '+': dict([
                    [u'source:position', mapcss.tag(tags, u'source:geometry')]]),
                    '-': ([
                    u'source:geometry'])
                }})

        return err
Ejemplo n.º 11
0
    def way(self, data, tags, nds):
        capture_tags = {}
        keys = tags.keys()
        err = []
        set_fixable_footway = set_link_road = set_major_road = set_minor_road = set_not_fixable_footway = False

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

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

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

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

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

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

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

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

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

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

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

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

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

        # *[phone][contact:phone][contact:phone!=tag(phone)]
        # *[fax][contact:fax][contact:fax!=tag(fax)]
        # *[email][contact:email][contact:email!=tag(email)]
        # *[website][contact:website][contact:website!=tag(website)]
        if ('contact:email' in keys and 'email' in keys) or (
                'contact:fax' in keys
                and 'fax' in keys) or ('contact:phone' in keys and 'phone'
                                       in keys) or ('contact:website' in keys
                                                    and 'website' in keys):
            match = False
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 'phone')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     'contact:phone')
                             and mapcss._tag_capture(capture_tags, 2, tags,
                                                     'contact:phone') !=
                             mapcss._value_capture(capture_tags, 2,
                                                   mapcss.tag(tags, 'phone')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags, 'fax')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     'contact:fax')
                             and mapcss._tag_capture(
                                 capture_tags, 2, tags,
                                 'contact:fax') != mapcss._value_capture(
                                     capture_tags, 2, mapcss.tag(tags, 'fax')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 'email')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     'contact:email')
                             and mapcss._tag_capture(capture_tags, 2, tags,
                                                     'contact:email') !=
                             mapcss._value_capture(capture_tags, 2,
                                                   mapcss.tag(tags, 'email')))
                except mapcss.RuleAbort:
                    pass
            if not match:
                capture_tags = {}
                try:
                    match = (mapcss._tag_capture(capture_tags, 0, tags,
                                                 'website')
                             and mapcss._tag_capture(capture_tags, 1, tags,
                                                     'contact:website')
                             and mapcss._tag_capture(capture_tags, 2, tags,
                                                     'contact:website')
                             != mapcss._value_capture(
                                 capture_tags, 2, mapcss.tag(tags, 'website')))
                except mapcss.RuleAbort:
                    pass
            if match:
                # group:tr("Different value of tag contact:* and *")
                # -osmoseItemClassLevel:"3092/3097/2"
                # throwWarning:tr("Different values of {0} and of {1}","{0.key}","{1.key}")
                err.append({
                    'class':
                    3097,
                    'subclass':
                    0,
                    'text':
                    mapcss.tr('Different values of {0} and of {1}',
                              mapcss._tag_uncapture(capture_tags, '{0.key}'),
                              mapcss._tag_uncapture(capture_tags, '{1.key}'))
                })

        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 = []


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

        return err
Ejemplo n.º 15
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