def test_limit(self, vector_client): limit = 10 fc = FeatureCollection('foo', vector_client=vector_client).limit(limit) self.assertEqual(list(fc.features()), []) vector_client.search_features.assert_called_once_with(geometry=None, query_limit=10, product_id='foo', query_expr=None)
def test_limit(self, vector_client): vector_client.search_features = mock.Mock(return_value=iter([])) limit = 10 fc = FeatureCollection("foo", vector_client=vector_client).limit(limit) assert list(fc.features()) == [] vector_client.search_features.assert_called_once_with(geometry=None, query_limit=10, product_id="foo", query_expr=None)
aoi = { "type": "Polygon", "coordinates": [ [ [-105.194091796875, 36.88181755936464], [-104.765625, 36.88181755936464], [-104.765625, 37.13404537126446], [-105.194091796875, 37.13404537126446], [-105.194091796875, 36.88181755936464], ] ], } fc = fc.filter(geometry=aoi) print(list(fc.features())) # this returns an iterator ################################################ # Search for :class:`Feature <descarteslabs.vectors.feature.Feature>` in this # :class:`FeatureCollection <descarteslabs.vectors.featurecollection.FeatureCollection>` # intersecting the aoi where ``foo=bar``. print(list(fc.filter(properties=(p.foo == "bar")).features())) ################################################ # Search for :class:`Feature <descarteslabs.vectors.feature.Feature>` where property ``foo=foo``. # There should be no results. print(list(fc.filter(properties=(p.foo == "foo")).features())) ################################################ # And cleanup