예제 #1
0
 def setUp(self):
     self.layer = LayerFactory.create()
     self.client = APIClient()
     self.user = UserFactory(permissions=[
         'geostore.can_manage_layers',
     ])
     self.client.force_authenticate(user=self.user)
예제 #2
0
    def setUp(self):
        self.fake_geometry = {"type": "Point", "coordinates": [2., 45.]}
        self.intersect_geometry = {
            "type":
            "LineString",
            "coordinates": [[1.3839340209960938, 43.602521593464054],
                            [1.4869308471679688, 43.60376465190968]]
        }
        self.intersect_ref_geometry = {
            "type":
            "LineString",
            "coordinates": [[1.440925598144531, 43.64750394449096],
                            [1.440582275390625, 43.574421623084234]]
        }
        self.fake_linestring = {
            "type": "LineString",
            "coordinates": [
                [1.3839340209960938, 43.602521593464054],
            ]
        }
        self.fake_polygon = {
            "type":
            "Polygon",
            "coordinates": [[[1.3839340209960938, 43.602521593464054],
                             [1.440582275390625, 43.574421623084234]]]
        }

        self.layer = LayerFactory.create(add_features=5)
        self.group = LayerGroup.objects.create(name='mygroup', slug='mygroup')
        self.group.layers.add(self.layer)

        self.user = UserFactory()
        self.client.force_authenticate(self.user)
예제 #3
0
 def setUp(self):
     self.user = UserFactory(permissions=['geostore.can_manage_layers', ])
     self.client.force_authenticate(user=self.user)
     self.valid_schema = {
         "properties": {
             "name": {
                 "type": "string"
             },
             "age": {
                 "type": "integer"
             }
         }
     }
     self.property_schema_layer = LayerFactory(
         name="tree",
         schema=self.valid_schema
     )
     Feature.objects.bulk_create([
         Feature(layer=self.property_schema_layer,
                 properties={'name': '1',
                             'age': 1},
                 geom='POINT(0 0)'),
         Feature(layer=self.property_schema_layer,
                 properties={'name': '2',
                             'age': 2},
                 geom='POINT(0 0)'),
         Feature(layer=self.property_schema_layer,
                 properties={'name': '10',
                             'age': 10},
                 geom='POINT(0 0)')
     ])
예제 #4
0
    def setUp(self):
        self.client = APIClient()
        self.user = UserFactory(permissions=['geostore.can_manage_layers', ])
        self.client.force_authenticate(user=self.user)

        self.point_layer = LayerFactory(name="no schema point geom",
                                        geom_type=GeometryTypes.Point)
        self.null_layer = LayerFactory(name="no schema null geom", geom_type=None)
예제 #5
0
 def setUp(self):
     self.layer = Layer.objects.create(name='test_layer', routable=True)
     self.user = UserFactory(is_superuser=True)
     self.client.force_login(self.user)
     self.other_feature = Feature.objects.create(layer=self.layer, geom="SRID=4326;LINESTRING(5 40, 6 40)")
     self.feature1 = Feature.objects.create(layer=self.layer, geom="SRID=4326;LINESTRING(0 40, 1 40)")
     self.feature2 = Feature.objects.create(layer=self.layer, geom="SRID=4326;LINESTRING(1 40, 9 40)")
     self.feature3 = Feature.objects.create(layer=self.layer, geom="SRID=4326;LINESTRING(9 40, 10 40)")
     self.feature4 = Feature.objects.create(layer=self.layer, geom="SRID=4326;LINESTRING(1 40, 1 41, 9 41, 9 40)")
     self.assertTrue(Routing.update_topology(self.layer, tolerance=0.0001))
예제 #6
0
 def setUp(self):
     # from http://wiki.geojson.org/GeoJSON_draft_version_6#Polygon
     self.polygon = {
         "type":
         "Polygon",
         "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
                          [100.0, 1.0], [100.0, 0.0]]]
     }
     self.user = UserFactory()
     self.client.force_authenticate(user=self.user)
예제 #7
0
    def setUpTestData(cls):
        cls.layer = Layer.objects.create(name='test_layer', geom_type=GeometryTypes.LineString, routable=True)
        cls.user = UserFactory(is_superuser=True)

        geojson_path = get_files_tests('toulouse.geojson')

        with open(geojson_path,
                  mode='r',
                  encoding="utf-8") as geojson:
            cls.layer.from_geojson(geojson.read())

        Routing.update_topology(cls.layer, tolerance=0.0001)
예제 #8
0
    def setUpTestData(cls):
        cls.layer = Layer.objects.create(name='test_layer', geom_type=GeometryTypes.LineString, routable=True)
        cls.user = UserFactory(is_superuser=True)
        cls.point_1 = Point(cls.points[0]["coordinates"])
        cls.point_2 = Point(cls.points[1]["coordinates"])

        cls.out_point_1 = Point(cls.out_points[0]["coordinates"])
        cls.out_point_2 = Point(cls.out_points[1]["coordinates"])
        cls.out_point_3 = Point(cls.out_points[2]["coordinates"])

        cls.point_second_line_1 = Point(cls.points_second_line[0]["coordinates"])
        cls.point_second_line_2 = Point(cls.points_second_line[1]["coordinates"])

        cls.feature = FeatureFactory.create(geom=LineString([cls.point_1, cls.point_2]), layer=cls.layer)
        cls.feature_2 = FeatureFactory.create(geom=LineString([cls.point_second_line_1,
                                                               cls.point_second_line_2]), layer=cls.layer)
        Routing.update_topology(cls.layer, tolerance=0.0001)
예제 #9
0
 def setUp(self):
     self.user = UserFactory(permissions=[
         'geostore.can_manage_layers',
     ])
     self.client.force_authenticate(user=self.user)
     self.no_schema_layer = LayerFactory(name="no schema", geom_type=None)
     self.valid_schema = {
         "properties": {
             "name": {
                 "type": "string"
             },
             "age": {
                 "type": "integer"
             }
         }
     }
     self.property_schema_layer = LayerFactory(name="tree",
                                               schema=self.valid_schema)
예제 #10
0
 def setUp(self) -> None:
     self.layer_trek = LayerSchemaFactory(
         geom_type=GeometryTypes.LineString)
     self.layer_city = LayerSchemaFactory(geom_type=GeometryTypes.Polygon)
     self.trek = FeatureFactory(layer=self.layer_trek,
                                geom='LINESTRING(0 0, 1 1, 2 2, 3 3)')
     self.city_uncover = FeatureFactory(
         layer=self.layer_city,
         geom='POLYGON((4 4, 4 7, 7 7, 7 4, 4 4))',
         properties={
             "name": "Cahors",
             "age": 50000
         })
     self.detail_url = reverse('feature-detail',
                               args=(
                                   self.layer_city.pk,
                                   self.city_uncover.identifier,
                               ))
     self.super_user = UserFactory(is_superuser=True)
     self.client.force_authenticate(self.super_user)
예제 #11
0
 def setUp(self):
     self.client = APIClient()
     self.layer = LayerFactory()
     self.user = UserFactory()
     self.client.force_authenticate(self.user)
예제 #12
0
 def setUp(self):
     self.layer = LayerFactory()
     self.user = UserFactory()
     self.client.force_login(self.user)
예제 #13
0
 def setUp(self):
     self.layer = LayerFactory()
     self.layer_group = LayerGroup.objects.create(name='layer group')
     self.layer_group.layers.add(self.layer)
     self.user = UserFactory()
     self.client.force_authenticate(self.user)
예제 #14
0
 def setUp(self):
     self.layer = LayerFactory()
     self.user = UserFactory(permissions=[])
     self.client.force_authenticate(user=self.user)