Skip to content

Commit

Permalink
Merge branch 'maint-1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Mar 8, 2024
2 parents f47e27f + 2f38e7e commit 42af94d
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ tests/data/coutwildrnp.gpkg
.ipynb_checkpoints
.pytest_cache
MANIFEST
wheels/
18 changes: 14 additions & 4 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Bug fixes:
- gzip, tar, and zip archive URIs containing drive letters were not always
parsed properly on Windows, but are now (#1334).

1.9.6 (2024-03-07)
------------------

- Ensure that geometry types in a schema are translated to a linear type, as
geometry instances are (#1313).
- Fix broken stable API documentation on Read The Docs (#).
- Remove install requirement of setuptools, a regression introduced in 1.9.5.

1.9.5 (2023-10-11)
------------------

Expand All @@ -54,10 +62,12 @@ Bug fixes:

Packaging:

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

1.9.4.post1 (2023-05-23)
------------------------
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GDAL=ubuntu-small-3.6.4
FROM ghcr.io/osgeo/gdal:${GDAL} AS gdal
ARG PYTHON_VERSION=3.9
ARG PYTHON_VERSION=3.10
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8"
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
Expand All @@ -18,7 +18,8 @@ RUN apt-get update && \
WORKDIR /app
COPY requirements*.txt ./
RUN python${PYTHON_VERSION} -m venv /venv && \
/venv/bin/python -m pip install -U build pip && \
/venv/bin/python -m pip install -U pip && \
/venv/bin/python -m pip install build && \
/venv/bin/python -m pip install -r requirements-dev.txt && \
/venv/bin/python -m pip list

Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ exclude *.txt *.py
recursive-include docs *.rst *.txt
recursive-include tests *.py
recursive-include tests/data *
exclude tests/data/coutwildrnp.gpkg
exclude tests/data/coutwildrnp.json
exclude tests/data/coutwildrnp.tar
recursive-include fiona *.pyx *.pxd *.pxi
recursive-exclude fiona *.c *.cpp
include CHANGES.txt CITATION.cff CREDITS.txt LICENSE.txt README.rst
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PYTHON_VERSION ?= 3.9
PYTHON_VERSION ?= 3.10
GDAL ?= ubuntu-small-3.6.4
all: deps clean install test

Expand Down Expand Up @@ -37,7 +37,6 @@ dockertest: dockertestimage

dockershell: dockertestimage
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'

dockersdist: dockertestimage
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'

Expand Down
4 changes: 4 additions & 0 deletions fiona/_geometry.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ cdef object normalize_geometry_type_code(unsigned int code):
# Normalize 'ZM' types to 3D types.
elif 3000 < code < 4000:
code = (code % 1000) | 0x80000000

# Normalize to a linear type.
code = OGR_GT_GetLinear(<OGRwkbGeometryType>code)

if code not in GEOMETRY_TYPES:
raise UnsupportedGeometryTypeError(code)

Expand Down
1 change: 1 addition & 0 deletions fiona/gdal.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ cdef extern from "ogr_api.h" nogil:
long long OGR_F_GetFieldAsInteger64 (void *feature, int n)
void OGR_F_SetFieldInteger64 (void *feature, int n, long long value)
int OGR_F_IsFieldNull(void *feature, int n)
OGRwkbGeometryType OGR_GT_GetLinear(OGRwkbGeometryType eType)


cdef extern from "gdalwarper.h" nogil:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ dependencies = [
]

[project.optional-dependencies]
all = ["Fiona[calc,s3,test]"]
all = ["fiona[calc,s3,test]"]
calc = ["shapely"]
s3 = ["boto3>=1.3.1"]
test = [
"Fiona[s3]",
"fiona[s3]",
"pytest>=7",
"pytest-cov",
"pytz",
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def path_curves_line_csv(data_dir):
return os.path.join(data_dir, "curves_line.csv")


@pytest.fixture(scope="session")
def path_multicurve_gml(data_dir):
"""Path to ```multicurve.gml``"""
return os.path.join(data_dir, "multicurve.gml")


@pytest.fixture(scope="session")
def path_test_tin_shp(data_dir):
"""Path to ```test_tin.shp``"""
Expand Down
18 changes: 18 additions & 0 deletions tests/data/multicurve.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
gml:id="aFeatureCollection"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ multicurve.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml/3.2">
<gml:boundedBy><gml:Envelope><gml:lowerCorner>-0.9243407 46.2718257505296</gml:lowerCorner><gml:upperCorner>2.70658958605966 47.6054714507864</gml:upperCorner></gml:Envelope></gml:boundedBy>

<ogr:featureMember>
<ogr:multicurve gml:id="multicurve.0">
<gml:boundedBy><gml:Envelope><gml:lowerCorner>-0.9243407 46.2718257505296</gml:lowerCorner><gml:upperCorner>2.70658958605966 47.6054714507864</gml:upperCorner></gml:Envelope></gml:boundedBy>
<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>
<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>
<ogr:SHAPE_Length>8.39459167219456</ogr:SHAPE_Length>
</ogr:multicurve>
</ogr:featureMember>
</ogr:FeatureCollection>
59 changes: 59 additions & 0 deletions tests/data/multicurve.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="http://ogr.maptools.org/"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:gmlsf="http://www.opengis.net/gmlsf/2.0"
elementFormDefault="qualified"
version="1.0">
<xs:annotation>
<xs:appinfo source="http://schemas.opengis.net/gmlsfProfile/2.0/gmlsfLevels.xsd">
<gmlsf:ComplianceLevel>0</gmlsf:ComplianceLevel>
</xs:appinfo>
</xs:annotation>
<xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
<xs:import namespace="http://www.opengis.net/gmlsf/2.0" schemaLocation="http://schemas.opengis.net/gmlsfProfile/2.0/gmlsfLevels.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:AbstractFeature"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="featureMember">
<xs:complexType>
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureMemberType">
<xs:sequence>
<xs:element ref="gml:AbstractFeature"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="multicurve" type="ogr:multicurve_Type" substitutionGroup="gml:AbstractFeature"/>
<xs:complexType name="multicurve_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:MultiCurvePropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> <!-- contains non-linear MultiCurve -->
<xs:element name="WKT" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SHAPE_Length" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
13 changes: 9 additions & 4 deletions tests/test_curve_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

import fiona

from .conftest import requires_gdal2


@requires_gdal2
def test_line_curve_conversion(path_curves_line_csv):
"""Convert curved geometries to linear approximations"""
with fiona.open(path_curves_line_csv) as col:
assert col.schema['geometry'] == 'Unknown'
assert col.schema["geometry"] == "Unknown"
features = list(col)
assert len(features) == 9


def test_multicurve_conversion(path_multicurve_gml):
"""Convert curved geometries to linear approximations"""
with fiona.open(path_multicurve_gml) as col:
assert col.schema["geometry"] == "MultiLineString"
features = list(col)
assert len(features) == 1
5 changes: 5 additions & 0 deletions tests/test_fio_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import re
import sys

if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points

from click.testing import CliRunner
import pytest

Expand Down

0 comments on commit 42af94d

Please sign in to comment.