diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-06 18:58:53 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | 48c85a2ec2c3f1e534040d7af96bf8ccc09ec2eb (patch) | |
tree | f2478c7d1b61a49b491a7f6f31f05dce3e68b829 /archaeological_finds | |
parent | 82917b095c874106fc96a6aa147045e17d8cb1b7 (diff) | |
download | Ishtar-48c85a2ec2c3f1e534040d7af96bf8ccc09ec2eb.tar.bz2 Ishtar-48c85a2ec2c3f1e534040d7af96bf8ccc09ec2eb.zip |
test + geo_get_items
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 8cac07812..51da0d879 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -2535,6 +2535,20 @@ class GeomaticTest(FindInit, TestCase): base_find = models.BaseFind.objects.get(pk=base_find.pk) + # with point + geom = GEOSGeometry("POINT({} {} {})".format(2, 43, 1), srid=4326) + base_find.point = geom + base_find.multi_polygon = None + base_find.save() + base_find = models.BaseFind.objects.get(pk=base_find.pk) + dic = {"centroid": (2.0, 43.0)} + res = base_find.get_geo_items(get_polygons=True) + self.assertEqual(dic, res) + res = base_find.get_geo_items(get_polygons=False) + self.assertEqual(dic, res) + + # with multi-polygon + base_find = models.BaseFind.objects.get(pk=base_find.pk) limit = ( "MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))," "((6 3,9 2,9 4,6 3)))" |