Пример #1
0
    class Parameters(common.CommonParameters):
        layers = utils.MultipleValueField()
        bbox = utils.BBoxField()
        width = f.IntegerField()
        height = f.IntegerField()
        i = f.IntegerField()
        j = f.IntegerField()
        srs = f.CharField(required=False)
        callback = f.CharField(required=False)
        format = f.CharField()
        feature_count = f.IntegerField(required=False)
        filter = f.CharField(required=False)

        @classmethod
        def from_request(cls, request):
            request['layers'] = request.get('layers', '').split(',')
            request['bbox'] = request.get('bbox')
            request['width'] = int(request.get('width'))
            request['height'] = int(request.get('height'))
            request['i'] = int(request.get('i', request.get('y')))
            request['j'] = int(request.get('j', request.get('x')))
            request['srs'] = request.get('srs', None)
            request['format'] = request.get(
                'info_format', request.get('format', 'application/json'))
            request['callback'] = request.get('callback', None)
            request['filter'] = request.get('filter', None)
            if not request['callback']:
                request['callback'] = request.get('jsonp', None)
            request['feature_count'] = request.get('feature_count', None)
Пример #2
0
    class Parameters(common.CommonParameters):
        layers = utils.MultipleValueField()
        srs = f.CharField(required=False)
        bbox = utils.BBoxField()
        width = f.IntegerField()
        height = f.IntegerField()
        styles = utils.MultipleValueField(required=False)
        format = f.CharField()
        bgcolor = f.CharField(required=False)
        transparent = f.BooleanField(required=False)
        time = f.DateTimeField(required=False)
        filter = f.CharField(required=False)
        elevation = f.FloatField(required=False)
        v = f.CharField(required=False)
        fresh = f.BooleanField(required=False)

        @classmethod
        def from_request(cls, request):
            request['layers'] = request.get('layers').split(',')
            request['srs'] = request.get('srs', None)
            request['filter'] = request.get('filter')
            request['bbox'] = request.get('bbox')
            request['width'] = int(request.get('width'))
            request['height'] = int(request.get('height'))
            request['styles'] = request.get('styles').split(',')
            request['format'] = request.get('format', 'png')
            request['bgcolor'] = request.get('bgcolor')
            request['transparent'] = request.get('transparent',
                                                 False) == 'true'
            request['time'] = utils.parsetime(request.get('time'))
            request['elevation'] = request.get('elevation', None)
            request['v'] = request.get('v', None)
            request['fresh'] = request.get('fresh', False)