Пример #1
0
def test_geom_touches():
    result = parse('''
    <fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema-datatypes">
      <fes:Touches>
        <fes:ValueReference>attr</fes:ValueReference>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml">
            <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>
      </fes:Touches>
    </fes:Filter>
    ''')
    assert result == ast.GeometryTouches(
        ast.Attribute('attr'),
        values.Geometry({
            'type':
            'Polygon',
            '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)],
            ]
        }))
Пример #2
0
def test_touches_attr_multilinestring():
    result = parse(
        {
            "op": "s_touches",
            "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.GeometryTouches(
        ast.Attribute("geometry"),
        values.Geometry(
            normalize_geom(
                geometry.MultiLineString(
                    [
                        geometry.LineString([(1, 1), (2, 2)]),
                        geometry.LineString([(0, 3), (1, 1)]),
                    ]
                ).__geo_interface__
            ),
        ),
    )
Пример #3
0
def test_touches_attr_multilinestring():
    result = parse('TOUCHES(geometry, MULTILINESTRING((1 1,2 2),(0 3,1 1)))')
    assert result == ast.GeometryTouches(
        ast.Attribute('geometry'),
        values.Geometry(
            geometry.MultiLineString([
                geometry.LineString([(1, 1), (2, 2)]),
                geometry.LineString([(0, 3), (1, 1)]),
            ]).__geo_interface__, ),
    )