Esempio n. 1
0
 def test_intersects(self):
     key = 'intersects'
     poly = geos.Polygon.from_bbox((0, 0, 10, 10))
     expected = {key: poly}
     data = {key: poly.geojson}
     form = forms.SpatialQueryForm(data)
     self._assert_form_data(form, key, expected)
Esempio n. 2
0
 def test_intersects(self):
     poly = geos.Polygon.from_bbox((0, 0, 10, 10))
     self.expected = {'intersects': poly}
     data = {'intersects': poly.geojson}
     form = forms.SpatialQueryForm(data)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.cleaned_data, self.expected)
Esempio n. 3
0
 def test_data(self):
     data = {'bbox': '-120,38,-118,42'}
     poly = geos.Polygon.from_bbox(data['bbox'].split(','))
     key = 'bboverlaps'
     expected = {key: poly}
     form = forms.SpatialQueryForm(data)
     self._assert_form_data(form, key, expected)
Esempio n. 4
0
 def test_data(self):
     data = {'bbox': '-120,38,-118,42'}
     poly = geos.Polygon.from_bbox(data['bbox'].split(','))
     self.expected = {'bboverlaps': poly}
     form = forms.SpatialQueryForm(data)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.cleaned_data, self.expected)
Esempio n. 5
0
 def test_intersects_invalid(self):
     data = {'intersects': '{"type":"Point","coordinates":[0]}'}
     form = forms.SpatialQueryForm(data)
     self.assertFalse(form.is_valid())