Exemplo n.º 1
0
def test_near_min_max():
    query = NearQuery(geometry=slf_pt(), min_distance=10, max_distance=20)
    expected = \
        f"(not ST_DWithin(location_centroid, {wkt_pt()}, 0.00009) " + \
        f"and ST_DWithin(location_centroid, {wkt_pt()}, 0.00018))"

    assert expected == from_ngsi_query(query)
Exemplo n.º 2
0
 def _get_geo_clause(self, geo_query: SlfQuery = None) -> Optional[str]:
     return from_ngsi_query(geo_query)
Exemplo n.º 3
0
def test_equals():
    query = EqualsQuery(slf_pt())
    expected = f"ST_Equals(location, {wkt_pt()})"

    assert expected == from_ngsi_query(query)
Exemplo n.º 4
0
def test_disjoint():
    query = DisjointQuery(slf_pt())
    expected = f"ST_Disjoint(location, {wkt_pt()})"

    assert expected == from_ngsi_query(query)
Exemplo n.º 5
0
def test_intersects():
    query = IntersectsQuery(slf_pt())
    expected = f"ST_Intersects(location, {wkt_pt()})"

    assert expected == from_ngsi_query(query)
Exemplo n.º 6
0
def test_covered_by():
    query = CoveredByQuery(slf_pt())
    expected = f"ST_Within(location, {wkt_pt()})"

    assert expected == from_ngsi_query(query)
Exemplo n.º 7
0
def test_near_max():
    query = NearQuery(geometry=slf_pt(), min_distance=None, max_distance=20)
    expected = f"ST_DWithin(location_centroid, {wkt_pt()}, 0.00018)"

    assert expected == from_ngsi_query(query)