Skip to content

Commit 42af94d

Browse files
committed
Merge branch 'maint-1.9'
2 parents f47e27f + 2f38e7e commit 42af94d

13 files changed

+126
-14
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ tests/data/coutwildrnp.gpkg
7474
.ipynb_checkpoints
7575
.pytest_cache
7676
MANIFEST
77+
wheels/

CHANGES.txt

+14-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ Bug fixes:
4343
- gzip, tar, and zip archive URIs containing drive letters were not always
4444
parsed properly on Windows, but are now (#1334).
4545

46+
1.9.6 (2024-03-07)
47+
------------------
48+
49+
- Ensure that geometry types in a schema are translated to a linear type, as
50+
geometry instances are (#1313).
51+
- Fix broken stable API documentation on Read The Docs (#).
52+
- Remove install requirement of setuptools, a regression introduced in 1.9.5.
53+
4654
1.9.5 (2023-10-11)
4755
------------------
4856

@@ -54,10 +62,12 @@ Bug fixes:
5462

5563
Packaging:
5664

57-
* Builds now require Cython >= 3.0.2 (#1276).
58-
* PyPI wheels include GDAL 3.6.4, PROJ 9.0.1, and GEOS 3.11.2.
59-
* PyPI wheels include curl 8.4.0, addressing CVE-2023-38545 and CVE-38546.
60-
* PyPI wheels are now available for Python 3.12.
65+
- The distribution name is now officially "fiona", not "Fiona". The import
66+
name remains "fiona".
67+
- Builds now require Cython >= 3.0.2 (#1276).
68+
- PyPI wheels include GDAL 3.6.4, PROJ 9.0.1, and GEOS 3.11.2.
69+
- PyPI wheels include curl 8.4.0, addressing CVE-2023-38545 and CVE-38546.
70+
- PyPI wheels are now available for Python 3.12.
6171

6272
1.9.4.post1 (2023-05-23)
6373
------------------------

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG GDAL=ubuntu-small-3.6.4
22
FROM ghcr.io/osgeo/gdal:${GDAL} AS gdal
3-
ARG PYTHON_VERSION=3.9
3+
ARG PYTHON_VERSION=3.10
44
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8"
55
RUN apt-get update && apt-get install -y software-properties-common
66
RUN add-apt-repository -y ppa:deadsnakes/ppa
@@ -18,7 +18,8 @@ RUN apt-get update && \
1818
WORKDIR /app
1919
COPY requirements*.txt ./
2020
RUN python${PYTHON_VERSION} -m venv /venv && \
21-
/venv/bin/python -m pip install -U build pip && \
21+
/venv/bin/python -m pip install -U pip && \
22+
/venv/bin/python -m pip install build && \
2223
/venv/bin/python -m pip install -r requirements-dev.txt && \
2324
/venv/bin/python -m pip list
2425

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ exclude *.txt *.py
88
recursive-include docs *.rst *.txt
99
recursive-include tests *.py
1010
recursive-include tests/data *
11+
exclude tests/data/coutwildrnp.gpkg
12+
exclude tests/data/coutwildrnp.json
13+
exclude tests/data/coutwildrnp.tar
1114
recursive-include fiona *.pyx *.pxd *.pxi
1215
recursive-exclude fiona *.c *.cpp
1316
include CHANGES.txt CITATION.cff CREDITS.txt LICENSE.txt README.rst

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PYTHON_VERSION ?= 3.9
1+
PYTHON_VERSION ?= 3.10
22
GDAL ?= ubuntu-small-3.6.4
33
all: deps clean install test
44

@@ -37,7 +37,6 @@ dockertest: dockertestimage
3737

3838
dockershell: dockertestimage
3939
docker run -it -v $(shell pwd):/app --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash fiona:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python -m pip install --editable . --no-build-isolation && /bin/bash'
40-
4140
dockersdist: dockertestimage
4241
docker run -it -v $(shell pwd):/app --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash fiona:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python -m build --sdist'
4342

fiona/_geometry.pyx

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ cdef object normalize_geometry_type_code(unsigned int code):
5454
# Normalize 'ZM' types to 3D types.
5555
elif 3000 < code < 4000:
5656
code = (code % 1000) | 0x80000000
57+
58+
# Normalize to a linear type.
59+
code = OGR_GT_GetLinear(<OGRwkbGeometryType>code)
60+
5761
if code not in GEOMETRY_TYPES:
5862
raise UnsupportedGeometryTypeError(code)
5963

fiona/gdal.pxi

+1
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ cdef extern from "ogr_api.h" nogil:
651651
long long OGR_F_GetFieldAsInteger64 (void *feature, int n)
652652
void OGR_F_SetFieldInteger64 (void *feature, int n, long long value)
653653
int OGR_F_IsFieldNull(void *feature, int n)
654+
OGRwkbGeometryType OGR_GT_GetLinear(OGRwkbGeometryType eType)
654655

655656

656657
cdef extern from "gdalwarper.h" nogil:

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ dependencies = [
3838
]
3939

4040
[project.optional-dependencies]
41-
all = ["Fiona[calc,s3,test]"]
41+
all = ["fiona[calc,s3,test]"]
4242
calc = ["shapely"]
4343
s3 = ["boto3>=1.3.1"]
4444
test = [
45-
"Fiona[s3]",
45+
"fiona[s3]",
4646
"pytest>=7",
4747
"pytest-cov",
4848
"pytz",

tests/conftest.py

+6
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ def path_curves_line_csv(data_dir):
110110
return os.path.join(data_dir, "curves_line.csv")
111111

112112

113+
@pytest.fixture(scope="session")
114+
def path_multicurve_gml(data_dir):
115+
"""Path to ```multicurve.gml``"""
116+
return os.path.join(data_dir, "multicurve.gml")
117+
118+
113119
@pytest.fixture(scope="session")
114120
def path_test_tin_shp(data_dir):
115121
"""Path to ```test_tin.shp``"""

tests/data/multicurve.gml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
gml:id="aFeatureCollection"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://ogr.maptools.org/ multicurve.xsd"
6+
xmlns:ogr="http://ogr.maptools.org/"
7+
xmlns:gml="http://www.opengis.net/gml/3.2">
8+
<gml:boundedBy><gml:Envelope><gml:lowerCorner>-0.9243407 46.2718257505296</gml:lowerCorner><gml:upperCorner>2.70658958605966 47.6054714507864</gml:upperCorner></gml:Envelope></gml:boundedBy>
9+
10+
<ogr:featureMember>
11+
<ogr:multicurve gml:id="multicurve.0">
12+
<gml:boundedBy><gml:Envelope><gml:lowerCorner>-0.9243407 46.2718257505296</gml:lowerCorner><gml:upperCorner>2.70658958605966 47.6054714507864</gml:upperCorner></gml:Envelope></gml:boundedBy>
13+
<ogr:geometryProperty><gml:MultiCurve gml:id="multicurve.geom.0"><gml:curveMember><gml:CompositeCurve gml:id="multicurve.geom.0.0"><gml:curveMember><gml:LineString gml:id="multicurve.geom.0.0.0"><gml:posList>-0.9105691 47.21951 1.414634 47.17073</gml:posList></gml:LineString></gml:curveMember><gml:curveMember><gml:Curve gml:id="multicurve.geom.0.0.1"><gml:segments><gml:ArcString><gml:posList>1.414634 47.17073 2.423818 47.48377 1.407531 46.72668</gml:posList></gml:ArcString></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:LineString gml:id="multicurve.geom.0.0.2"><gml:posList>1.407531 46.72668 -0.9243407 46.72668</gml:posList></gml:LineString></gml:curveMember></gml:CompositeCurve></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
14+
<ogr:WKT>MULTICURVE (COMPOUNDCURVE ((-0.9105691 47.21951,1.414634 47.17073),CIRCULARSTRING (1.414634 47.17073,2.423818 47.48377,1.407531 46.72668),(1.407531 46.72668,-0.9243407 46.72668)))</ogr:WKT>
15+
<ogr:SHAPE_Length>8.39459167219456</ogr:SHAPE_Length>
16+
</ogr:multicurve>
17+
</ogr:featureMember>
18+
</ogr:FeatureCollection>

tests/data/multicurve.xsd

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema
3+
targetNamespace="http://ogr.maptools.org/"
4+
xmlns:ogr="http://ogr.maptools.org/"
5+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
6+
xmlns:gml="http://www.opengis.net/gml/3.2"
7+
xmlns:gmlsf="http://www.opengis.net/gmlsf/2.0"
8+
elementFormDefault="qualified"
9+
version="1.0">
10+
<xs:annotation>
11+
<xs:appinfo source="http://schemas.opengis.net/gmlsfProfile/2.0/gmlsfLevels.xsd">
12+
<gmlsf:ComplianceLevel>0</gmlsf:ComplianceLevel>
13+
</xs:appinfo>
14+
</xs:annotation>
15+
<xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
16+
<xs:import namespace="http://www.opengis.net/gmlsf/2.0" schemaLocation="http://schemas.opengis.net/gmlsfProfile/2.0/gmlsfLevels.xsd"/>
17+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:AbstractFeature"/>
18+
<xs:complexType name="FeatureCollectionType">
19+
<xs:complexContent>
20+
<xs:extension base="gml:AbstractFeatureType">
21+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
22+
<xs:element name="featureMember">
23+
<xs:complexType>
24+
<xs:complexContent>
25+
<xs:extension base="gml:AbstractFeatureMemberType">
26+
<xs:sequence>
27+
<xs:element ref="gml:AbstractFeature"/>
28+
</xs:sequence>
29+
</xs:extension>
30+
</xs:complexContent>
31+
</xs:complexType>
32+
</xs:element>
33+
</xs:sequence>
34+
</xs:extension>
35+
</xs:complexContent>
36+
</xs:complexType>
37+
<xs:element name="multicurve" type="ogr:multicurve_Type" substitutionGroup="gml:AbstractFeature"/>
38+
<xs:complexType name="multicurve_Type">
39+
<xs:complexContent>
40+
<xs:extension base="gml:AbstractFeatureType">
41+
<xs:sequence>
42+
<xs:element name="geometryProperty" type="gml:MultiCurvePropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> <!-- contains non-linear MultiCurve -->
43+
<xs:element name="WKT" nillable="true" minOccurs="0" maxOccurs="1">
44+
<xs:simpleType>
45+
<xs:restriction base="xs:string">
46+
</xs:restriction>
47+
</xs:simpleType>
48+
</xs:element>
49+
<xs:element name="SHAPE_Length" nillable="true" minOccurs="0" maxOccurs="1">
50+
<xs:simpleType>
51+
<xs:restriction base="xs:string">
52+
</xs:restriction>
53+
</xs:simpleType>
54+
</xs:element>
55+
</xs:sequence>
56+
</xs:extension>
57+
</xs:complexContent>
58+
</xs:complexType>
59+
</xs:schema>

tests/test_curve_geometries.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55

66
import fiona
77

8-
from .conftest import requires_gdal2
98

10-
11-
@requires_gdal2
129
def test_line_curve_conversion(path_curves_line_csv):
1310
"""Convert curved geometries to linear approximations"""
1411
with fiona.open(path_curves_line_csv) as col:
15-
assert col.schema['geometry'] == 'Unknown'
12+
assert col.schema["geometry"] == "Unknown"
1613
features = list(col)
1714
assert len(features) == 9
15+
16+
17+
def test_multicurve_conversion(path_multicurve_gml):
18+
"""Convert curved geometries to linear approximations"""
19+
with fiona.open(path_multicurve_gml) as col:
20+
assert col.schema["geometry"] == "MultiLineString"
21+
features = list(col)
22+
assert len(features) == 1

tests/test_fio_info.py

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import re
66
import sys
77

8+
if sys.version_info < (3, 10):
9+
from importlib_metadata import entry_points
10+
else:
11+
from importlib.metadata import entry_points
12+
813
from click.testing import CliRunner
914
import pytest
1015

0 commit comments

Comments
 (0)