Пример #1
0
def test_intersects_attr_point_ewkt():
    result = parse('INTERSECTS(geometry, SRID=4326;POINT(1 1))')
    assert result.rhs.geometry['crs']['properties']['name'] == \
        "urn:ogc:def:crs:EPSG::4326"
    assert result == ast.GeometryIntersects(
        ast.Attribute('geometry'),
        values.Geometry(geometry.Point(1, 1).__geo_interface__),
    )
Пример #2
0
def test_intersects_attr_point():
    result = parse([
        'intersects', ['geometry'], {
            'type': 'Point',
            'coordinates': [1, 1],
        }
    ])
    assert result == ast.GeometryIntersects(
        ast.Attribute('geometry'),
        values.Geometry(normalize_geom(geometry.Point(1,
                                                      1).__geo_interface__)),
    )
Пример #3
0
def test_intersects_attr_geometrycollection():
    result = parse('INTERSECTS(geometry, GEOMETRYCOLLECTION(POINT(1 1),'
                   'LINESTRING(1 1,2 2),'
                   'POLYGON((1 1,2 2,0 3,1 1))'
                   '))')
    assert result == ast.GeometryIntersects(
        ast.Attribute('geometry'),
        values.Geometry(
            geometry.GeometryCollection([
                geometry.Point(1, 1),
                geometry.LineString([(1, 1), (2, 2)]),
                geometry.Polygon([(1, 1), (2, 2), (0, 3), (1, 1)])
            ]).__geo_interface__),
    )
Пример #4
0
def test_intersects_attr_point():
    result = parse({
        "intersects": [
            {"property": "geometry"},
            {
                "type": "Point",
                "coordinates": [1, 1],
            }
        ]
    })
    assert result == ast.GeometryIntersects(
        ast.Attribute('geometry'),
        values.Geometry(
            normalize_geom(
                geometry.Point(1, 1).__geo_interface__
            )
        ),
    )
Пример #5
0
def test_geom_intersects():
    result = parse('''
    <fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema-datatypes">
      <fes:Intersects>
        <fes:ValueReference>attr</fes:ValueReference>
        <georss:box xmlns:georss="http://www.georss.org/georss">
            1.0 0.5 2.0 1.5
        </georss:box>
      </fes:Intersects>
    </fes:Filter>
    ''')
    assert result == ast.GeometryIntersects(
        ast.Attribute('attr'),
        values.Geometry({
            'type':
            'Polygon',
            'bbox': (0.5, 1.0, 1.5, 2.0),
            'coordinates': [[(0.5, 1.0), (0.5, 2.0), (1.5, 2.0), (1.5, 1.0),
                             (0.5, 1.0)]]
        }))
Пример #6
0
def test_intersects_attr_point():
    result = parse('INTERSECTS(geometry, POINT(1 1))')
    assert result == ast.GeometryIntersects(
        ast.Attribute('geometry'),
        values.Geometry(geometry.Point(1, 1).__geo_interface__),
    )