-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translate schema geometry type to a linear type (#1313)
* Failing test for #1311 Adds a small multi-curve GML file and Makefile, Dockerfile for local testing. * Use an OGR method to translate schema geometry types. Resolves #1311. * Update CHANGES.txt --------- Co-authored-by: Sean Gillies <seangillies@Seans-MacBook-Air.local>
- Loading branch information
Showing
9 changed files
with
177 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG GDAL=ubuntu-small-3.6.4 | ||
FROM ghcr.io/osgeo/gdal:${GDAL} AS gdal | ||
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 | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
g++ \ | ||
gdb \ | ||
make \ | ||
python3-pip \ | ||
python${PYTHON_VERSION} \ | ||
python${PYTHON_VERSION}-dev \ | ||
python${PYTHON_VERSION}-venv \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
COPY requirements*.txt ./ | ||
RUN python${PYTHON_VERSION} -m venv /venv && \ | ||
/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 | ||
|
||
FROM gdal | ||
COPY . . | ||
RUN /venv/bin/python -m build | ||
ENTRYPOINT ["/venv/bin/fio"] | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
PYTHON_VERSION ?= 3.10 | ||
GDAL ?= ubuntu-small-3.6.4 | ||
all: deps clean install test | ||
|
||
.PHONY: docs | ||
|
||
install: | ||
python setup.py build_ext | ||
pip install -e .[all] | ||
|
||
deps: | ||
pip install -r requirements-dev.txt | ||
|
||
clean: | ||
pip uninstall -y fiona || echo "no need to uninstall" | ||
python setup.py clean --all | ||
find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print | ||
touch fiona/*.pyx | ||
|
||
sdist: | ||
python setup.py sdist | ||
|
||
test: | ||
py.test --maxfail 1 -v --cov fiona --cov-report html --pdb tests | ||
|
||
docs: | ||
cd docs && make apidocs && make html | ||
|
||
doctest: | ||
py.test --doctest-modules fiona --doctest-glob='*.rst' docs/*.rst | ||
|
||
dockertestimage: | ||
docker build --build-arg GDAL=$(GDAL) --build-arg PYTHON_VERSION=$(PYTHON_VERSION) --target gdal -t fiona:$(GDAL)-py$(PYTHON_VERSION) . | ||
|
||
dockertest: 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 -e . && /venv/bin/python -B -m pytest -m "not wheel" --cov fiona --cov-report term-missing $(OPTS)' | ||
|
||
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 build && /venv/bin/python -m pip install --pre -f dist fiona && /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' | ||
|
||
dockergdb: 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 setup.py develop && gdb -ex=r --args /venv/bin/python -B -m pytest -m "not wheel" --cov fiona --cov-report term-missing $(OPTS)' | ||
|
||
dockerdocs: dockertestimage | ||
docker run -it -v $(shell pwd):/app --entrypoint=/bin/bash fiona:$(GDAL)-py$(PYTHON_VERSION) -c 'source /venv/bin/activate && python -m pip install . && cd docs && make clean && make html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters