Exemplo n.º 1
0
def test_overlaps_attr_multilinestring():
    result = parse(
        {
            "op": "s_overlaps",
            "args": [
                {"property": "geometry"},
                {
                    "type": "MultiLineString",
                    "coordinates": [[[1, 1], [2, 2]], [[0, 3], [1, 1]]],
                    "bbox": [0.0, 1.0, 2.0, 3.0],
                },
            ],
        }
    )
    assert result == ast.GeometryOverlaps(
        ast.Attribute("geometry"),
        values.Geometry(
            normalize_geom(
                geometry.MultiLineString(
                    [
                        geometry.LineString([(1, 1), (2, 2)]),
                        geometry.LineString([(0, 3), (1, 1)]),
                    ]
                ).__geo_interface__
            ),
        ),
    )
Exemplo n.º 2
0
def test_overlaps_attr_multilinestring():
    result = parse('OVERLAPS(geometry, MULTILINESTRING((1 1,2 2),(0 3,1 1)))')
    assert result == ast.GeometryOverlaps(
        ast.Attribute('geometry'),
        values.Geometry(
            geometry.MultiLineString([
                geometry.LineString([(1, 1), (2, 2)]),
                geometry.LineString([(0, 3), (1, 1)]),
            ]).__geo_interface__, ),
    )
Exemplo n.º 3
0
def test_geom_overlaps():
    result = parse('''
    <fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema-datatypes">
      <fes:Overlaps>
        <fes:ValueReference>attr</fes:ValueReference>
        <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml">
            <gml:surfaceMember>
                <gml:Polygon>
                    <gml:exterior>
                        <gml:LinearRing>
                            <gml:posList>0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0
                            </gml:posList>
                        </gml:LinearRing>
                    </gml:exterior>
                    <gml:interior>
                        <gml:LinearRing>
                            <gml:posList>0.2 0.2 0.5 0.2 0.2 0.5 0.2 0.2
                            </gml:posList>
                        </gml:LinearRing>
                    </gml:interior>
                </gml:Polygon>
            </gml:surfaceMember>
            <gml:surfaceMember>
                <gml:Polygon>
                    <gml:exterior>
                        <gml:LinearRing>
                            <gml:posList>
                                10.0 10.0 11.0 10.0 10.0 11.0 10.0 10.0
                            </gml:posList>
                        </gml:LinearRing>
                    </gml:exterior>
                    <gml:interior>
                        <gml:LinearRing>
                            <gml:posList>
                                10.2 10.2 10.5 10.2 10.2 10.5 10.2 10.2
                            </gml:posList>
                        </gml:LinearRing>
                    </gml:interior>
                </gml:Polygon>
            </gml:surfaceMember>
        </gml:MultiSurface>
      </fes:Overlaps>
    </fes:Filter>
    ''')
    assert result == ast.GeometryOverlaps(
        ast.Attribute('attr'),
        values.Geometry({
            'type':
            'MultiPolygon',
            'coordinates': [[
                [(0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.0)],
                [(0.2, 0.2), (0.5, 0.2), (0.2, 0.5), (0.2, 0.2)],
            ],
                            [
                                [(10.0, 10.0), (11.0, 10.0), (10.0, 11.0),
                                 (10.0, 10.0)],
                                [(10.2, 10.2), (10.5, 10.2), (10.2, 10.5),
                                 (10.2, 10.2)],
                            ]]
        }))