Пример #1
0
    def setUp(self):

        for s in range(0, SERVICE_NUMBER):
            service = Service(
                url='http://%s.fakeurl.com' % s,
                title='Title %s' % s,
                type='OGC_WMS',
            )
            service.save()
            for l in range(0, 20):
                layer = Layer(
                    name='Layer %s, from service %s' % (l, s),
                    bbox_x0=-179,
                    bbox_x1=179,
                    bbox_y0=-89,
                    bbox_y1=89,
                    service=service
                )
                layer.save()
                service.layer_set.add(layer)
        for c in range(0, TIMES_TO_CHECK):
            for s in range(0, SERVICE_NUMBER):
                service = Service.objects.all()[s]
                service.check()
                for layer in service.layer_set.all():
                    layer.check()
Пример #2
0
    def post(self, request):
        vector_layer = request.data['layer']
        features = request.data['features']

        name = request.data['name']
        schema = {'geometry': 'Polygon', 'properties': {'shaid': 'str'}}
        layer = Layer(name=name, field_names=['shaid'], schema=schema)
        layer.save()

        django_rq.enqueue(vector_catalog_save_layer,
                          request.tenant.schema_name,
                          layer,
                          vector_layer,
                          features,
                          timeout=4800)

        return Response({'result': 'success'})
Пример #3
0
    def post(self, request, *args, **kwargs):

        layers = request.POST.getlist('layer')

        for lay in layers:
            layer = json.loads(lay)
            # see if it's already in here. assume 'url' and 'layer' attributes make it unique
            l = Layer.objects.filter(url=layer['url'], layer=layer['layer'])
            if not l:
                # add the layer
                new_layer = Layer()
                for key, value in layer.iteritems():
                    if key == 'layer_params':
                        # TODO: need to pass json object here
                        pass
                    else:
                        setattr(new_layer, key, value)

                new_layer.save()

        return HttpResponseRedirect(reverse('layer-list'))
Пример #4
0
    def post(self, request, *args, **kwargs):

        layers = request.POST.getlist('layer')

        for lay in layers:
            layer = json.loads(lay)
            # see if it's already in here. assume 'url' and 'layer' attributes make it unique
            l = Layer.objects.filter( url=layer['url'], layer=layer['layer'] )
            if not l:
                # add the layer
                new_layer = Layer()
                for key,value in layer.iteritems():
                    if key == 'layer_params':
                        # TODO: need to pass json object here
                        pass
                    else:
                        setattr(new_layer,key,value)

                new_layer.save()

        return HttpResponseRedirect(reverse('layer-list'))
Пример #5
0
    def setUp(self):

        for s in range(0, SERVICE_NUMBER):
            service = Service(
                url='http://%s.fakeurl.com' % s,
                title='Title %s' % s,
                type='OGC_WMS',
            )
            service.save()
            for l in range(0, 20):
                layer = Layer(name='Layer %s, from service %s' % (l, s),
                              bbox_x0=-179,
                              bbox_x1=179,
                              bbox_y0=-89,
                              bbox_y1=89,
                              service=service)
                layer.save()
                service.layer_set.add(layer)
        for c in range(0, TIMES_TO_CHECK):
            for s in range(0, SERVICE_NUMBER):
                service = Service.objects.all()[s]
                service.check()
                for layer in service.layer_set.all():
                    layer.check()