Skip to content

Commit 6cdae8b

Browse files
authored
Merge pull request OSGeo#11703 from rouault/remove_ili_write_support
Remove Interlis 1 and 2 write support
2 parents 4770117 + 8e6a84e commit 6cdae8b

12 files changed

+11
-1123
lines changed

.github/workflows/ubuntu_24.04/expected_ogrinfo_formats.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Supported Formats: (ro:read-only, rw:read-write, +:update, v:virtual-I/O s:subda
2929
GeoJSONSeq -vector- (rw+v): GeoJSON Sequence (*.geojsonl, *.geojsons)
3030
ESRIJSON -vector- (rov): ESRIJSON (*.json)
3131
TopoJSON -vector- (rov): TopoJSON (*.json, *.topojson)
32-
Interlis 1 -vector- (rw+v): Interlis 1 (*.itf, *.ili)
33-
Interlis 2 -vector- (rw+v): Interlis 2 (*.xtf, *.xml, *.ili)
32+
Interlis 1 -vector- (rov): Interlis 1 (*.itf, *.ili)
33+
Interlis 2 -vector- (rov): Interlis 2 (*.xtf, *.xml, *.ili)
3434
OGR_GMT -vector- (rw+v): GMT ASCII Vectors (.gmt) (*.gmt)
3535
GPKG -raster,vector- (rw+vs): GeoPackage (*.gpkg, *.gpkg.zip)
3636
SQLite -raster,vector- (rw+v): SQLite / Spatialite / RasterLite2 (*.sqlite, *.db)

.github/workflows/windows_conda_expected_ogrinfo_formats.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Supported Formats: (ro:read-only, rw:read-write, +:update, v:virtual-I/O s:subda
2929
GeoJSONSeq -vector- (rw+v): GeoJSON Sequence (*.geojsonl, *.geojsons)
3030
ESRIJSON -vector- (rov): ESRIJSON (*.json)
3131
TopoJSON -vector- (rov): TopoJSON (*.json, *.topojson)
32-
Interlis 1 -vector- (rw+v): Interlis 1 (*.itf, *.ili)
33-
Interlis 2 -vector- (rw+v): Interlis 2 (*.xtf, *.xml, *.ili)
32+
Interlis 1 -vector- (rov): Interlis 1 (*.itf, *.ili)
33+
Interlis 2 -vector- (rov): Interlis 2 (*.xtf, *.xml, *.ili)
3434
OGR_GMT -vector- (rw+v): GMT ASCII Vectors (.gmt) (*.gmt)
3535
GPKG -raster,vector- (rw+vs): GeoPackage (*.gpkg, *.gpkg.zip)
3636
SQLite -vector- (rw+v): SQLite / Spatialite (*.sqlite, *.db)

autotest/ogr/ogr_ili.py

-272
Original file line numberDiff line numberDiff line change
@@ -146,88 +146,6 @@ def test_ogr_interlis1_4():
146146
pytest.fail("field value wrong.")
147147

148148

149-
###############################################################################
150-
# Write Ili1 transfer file without model.
151-
152-
153-
def test_ogr_interlis1_5(tmp_path):
154-
155-
ds = ogr.Open("data/ili/format-default.itf,data/ili/format-default.imd")
156-
157-
lyr = ds.GetLayerByName("FormatTests__FormatTable")
158-
feat = lyr.GetNextFeature()
159-
160-
driver = ogr.GetDriverByName("Interlis 1")
161-
outfile = tmp_path / "interlis1_5.itf"
162-
163-
with gdal.quiet_errors():
164-
dst_ds = driver.CreateDataSource(outfile)
165-
166-
dst_lyr = dst_ds.CreateLayer("FormatTests__FormatTable")
167-
168-
layer_defn = lyr.GetLayerDefn()
169-
for i in range(layer_defn.GetFieldCount()):
170-
dst_lyr.CreateField(layer_defn.GetFieldDefn(i))
171-
dst_feat = ogr.Feature(feature_def=dst_lyr.GetLayerDefn())
172-
dst_feat.SetFrom(feat)
173-
dst_lyr.CreateFeature(dst_feat)
174-
175-
dst_ds = None
176-
177-
with open(outfile) as f:
178-
itf = f.read()
179-
expected = """MTID INTERLIS1
180-
MODL OGR
181-
ETOP
182-
TOPI FormatTests
183-
TABL FormatTable
184-
OBJE 0 0 aa_bb cc^dd @ 1
185-
ETAB
186-
ETOP
187-
EMOD
188-
ENDE"""
189-
assert expected in itf, "Interlis output doesn't match."
190-
191-
192-
###############################################################################
193-
# Write Ili1 transfer file.
194-
195-
196-
def test_ogr_interlis1_6(tmp_path):
197-
198-
ds = ogr.Open("data/ili/format-default.itf,data/ili/format-default.imd")
199-
lyr = ds.GetLayerByName("FormatTests__FormatTable")
200-
feat = lyr.GetNextFeature()
201-
202-
driver = ogr.GetDriverByName("Interlis 1")
203-
outfile = tmp_path / "interlis1_6.itf"
204-
dst_ds = driver.CreateDataSource(f"{outfile},data/ili/format-default.imd")
205-
206-
dst_lyr = dst_ds.CreateLayer("test")
207-
208-
layer_defn = lyr.GetLayerDefn()
209-
for i in range(layer_defn.GetFieldCount()):
210-
dst_lyr.CreateField(layer_defn.GetFieldDefn(i))
211-
dst_feat = ogr.Feature(feature_def=dst_lyr.GetLayerDefn())
212-
dst_feat.SetFrom(feat)
213-
dst_lyr.CreateFeature(dst_feat)
214-
215-
dst_ds = None
216-
217-
with open(outfile) as f:
218-
itf = f.read()
219-
expected = """MTID INTERLIS1
220-
MODL FormatDefault
221-
TOPI FormatTests
222-
TABL test
223-
OBJE 1 0 aa_bb cc^dd @ 1
224-
ETAB
225-
ETOP
226-
EMOD
227-
ENDE"""
228-
assert expected in itf, "Interlis output doesn't match."
229-
230-
231149
###############################################################################
232150
# Ili1 character encoding test.
233151

@@ -260,43 +178,6 @@ def test_ogr_interlis1_7(tmp_path):
260178
print(feat.GetFieldAsString(i))
261179
pytest.fail("field value wrong.")
262180

263-
# Write back
264-
driver = ogr.GetDriverByName("Interlis 1")
265-
outfile = tmp_path / "interlis1_7.itf"
266-
dst_ds = driver.CreateDataSource(f"{outfile},data/ili/format-default.imd")
267-
268-
dst_lyr = dst_ds.CreateLayer("FormatTests__FormatTable")
269-
270-
layer_defn = lyr.GetLayerDefn()
271-
for i in range(layer_defn.GetFieldCount()):
272-
dst_lyr.CreateField(layer_defn.GetFieldDefn(i))
273-
dst_feat = ogr.Feature(feature_def=dst_lyr.GetLayerDefn())
274-
dst_feat.SetFrom(feat)
275-
dst_lyr.CreateFeature(dst_feat)
276-
277-
dst_ds = None
278-
279-
try:
280-
# Python 3
281-
f = open(outfile, encoding="iso-8859-1")
282-
except TypeError:
283-
f = open(outfile)
284-
itf = f.read()
285-
expected = """MTID INTERLIS1
286-
MODL FormatDefault
287-
TABL FormatTable
288-
OBJE 2 0 äöü ÄÖÜ @ 1
289-
ETAB
290-
ETOP
291-
EMOD
292-
ENDE"""
293-
try:
294-
# Python 2
295-
expected = expected.decode("utf8").encode("iso-8859-1")
296-
except Exception:
297-
pass
298-
assert expected in itf, "Interlis output doesn't match."
299-
300181

301182
###############################################################################
302183
# Ili1 VRT rename
@@ -801,51 +682,6 @@ def test_ogr_interlis1_13_linear():
801682
ogrtest.check_feature_geometry(geom, geom_field_values[i])
802683

803684

804-
###############################################################################
805-
# Write Ili1 Arcs.
806-
807-
808-
def test_ogr_interlis1_14(tmp_path):
809-
810-
ds = ogr.Open("data/ili/Beispiel.itf,data/ili/Beispiel.imd")
811-
lyr = ds.GetLayerByName("Bodenbedeckung__Strasse")
812-
feat = lyr.GetNextFeature()
813-
814-
driver = ogr.GetDriverByName("Interlis 1")
815-
outfile = tmp_path / "interlis1_14.itf"
816-
dst_ds = driver.CreateDataSource(f"{outfile},data/ili/Beispiel.imd")
817-
818-
dst_lyr = dst_ds.CreateLayer("Bodenbedeckung__Strasse", None, ogr.wkbMultiCurve)
819-
820-
layer_defn = lyr.GetLayerDefn()
821-
for i in range(layer_defn.GetFieldCount()):
822-
dst_lyr.CreateField(layer_defn.GetFieldDefn(i))
823-
dst_feat = ogr.Feature(feature_def=dst_lyr.GetLayerDefn())
824-
dst_feat.SetFrom(feat)
825-
dst_lyr.CreateFeature(dst_feat)
826-
827-
dst_ds = None
828-
829-
with open(outfile) as f:
830-
itf = f.read()
831-
expected = """////
832-
MTID INTERLIS1
833-
MODL Beispiel
834-
TABL Strasse
835-
OBJE 3 100
836-
STPT 190.26 208
837-
ARCP 187 186
838-
LIPT 173.1 171
839-
LIPT 141.08 152.94
840-
ELIN
841-
ETAB
842-
ETOP
843-
EMOD
844-
ENDE
845-
"""
846-
assert expected in itf, "Interlis output doesn't match."
847-
848-
849685
###############################################################################
850686
# Reading Ili2 without model
851687

@@ -950,95 +786,6 @@ def test_ogr_interlis2_2():
950786
ogrtest.check_feature_geometry(geom, geom_field_values[i])
951787

952788

953-
###############################################################################
954-
# Write Ili2 transfer file.
955-
956-
957-
def test_ogr_interlis2_3(tmp_path):
958-
959-
ds = ogr.Open("data/ili/RoadsExdm2ien.xml,data/ili/RoadsExdm2ien.imd")
960-
961-
lyr = ds.GetLayerByName("RoadsExdm2ien.RoadsExtended.RoadSign")
962-
feat = lyr.GetNextFeature()
963-
964-
driver = ogr.GetDriverByName("Interlis 2")
965-
outfile = tmp_path / "interlis2_3.xtf"
966-
dst_ds = driver.CreateDataSource(f"{outfile},data/ili/RoadsExdm2ien.imd")
967-
968-
dst_lyr = dst_ds.CreateLayer("RoadsExdm2ien.RoadsExtended.RoadSign")
969-
970-
dst_feat = ogr.Feature(feature_def=dst_lyr.GetLayerDefn())
971-
dst_feat.SetFrom(feat)
972-
dst_lyr.CreateFeature(dst_feat)
973-
974-
lyr = ds.GetLayerByName("RoadsExdm2ben.Roads.LandCover")
975-
feat = lyr.GetNextFeature()
976-
977-
dst_lyr = dst_ds.CreateLayer("RoadsExdm2ben.Roads.LandCover")
978-
979-
dst_feat = ogr.Feature(feature_def=dst_lyr.GetLayerDefn())
980-
dst_feat.SetFrom(feat)
981-
dst_lyr.CreateFeature(dst_feat)
982-
983-
dst_ds = None
984-
985-
with open(outfile) as f:
986-
xtf = f.read()
987-
expected = """<?xml version="1.0" encoding="utf-8" ?>
988-
<TRANSFER xmlns="http://www.interlis.ch/INTERLIS2.3">
989-
<HEADERSECTION SENDER="OGR/GDAL"""
990-
assert expected in xtf, "Interlis output doesn't match."
991-
expected = """<MODELS>
992-
<MODEL NAME="RoadsExdm2ben" URI="http://www.interlis.ch/models" VERSION="2005-06-16"/>
993-
<MODEL NAME="RoadsExdm2ien" URI="http://www.interlis.ch/models" VERSION="2005-06-16"/>
994-
</MODELS>
995-
</HEADERSECTION>
996-
<DATASECTION>
997-
<RoadsExdm2ien.RoadsExtended BID="RoadsExdm2ien.RoadsExtended">
998-
<RoadsExdm2ien.RoadsExtended.RoadSign TID="501">
999-
<Position>
1000-
<COORD><C1>69.389</C1><C2>92.056</C2></COORD>
1001-
</Position>
1002-
<Type>prohibition.noparking</Type>
1003-
</RoadsExdm2ien.RoadsExtended.RoadSign>
1004-
<RoadsExdm2ben.Roads.LandCover TID="16">
1005-
<Geometry>
1006-
<SURFACE>
1007-
<BOUNDARY>
1008-
<POLYLINE>
1009-
<COORD><C1>39.038</C1><C2>60.315</C2></COORD>
1010-
<COORD><C1>41.2</C1><C2>59.302</C2></COORD>
1011-
<COORD><C1>43.362</C1><C2>60.315</C2></COORD>
1012-
<COORD><C1>44.713</C1><C2>66.268</C2></COORD>
1013-
<COORD><C1>45.794</C1><C2>67.66200000000001</C2></COORD>
1014-
<COORD><C1>48.766</C1><C2>67.408</C2></COORD>
1015-
<COORD><C1>53.36</C1><C2>64.11499999999999</C2></COORD>
1016-
<COORD><C1>56.197</C1><C2>62.595</C2></COORD>
1017-
<COORD><C1>57.818</C1><C2>63.862</C2></COORD>
1018-
<COORD><C1>58.899</C1><C2>68.928</C2></COORD>
1019-
<COORD><C1>55.927</C1><C2>72.348</C2></COORD>
1020-
<COORD><C1>47.955</C1><C2>75.515</C2></COORD>
1021-
<COORD><C1>42.281</C1><C2>75.38800000000001</C2></COORD>
1022-
<COORD><C1>39.308</C1><C2>73.235</C2></COORD>
1023-
<COORD><C1>36.741</C1><C2>69.688</C2></COORD>
1024-
<COORD><C1>35.525</C1><C2>66.268</C2></COORD>
1025-
<COORD><C1>35.661</C1><C2>63.735</C2></COORD>
1026-
<COORD><C1>37.957</C1><C2>61.455</C2></COORD>
1027-
<COORD><C1>39.038</C1><C2>60.315</C2></COORD>
1028-
</POLYLINE>
1029-
</BOUNDARY>
1030-
</SURFACE>
1031-
</Geometry>
1032-
<Type>water</Type>
1033-
</RoadsExdm2ben.Roads.LandCover>
1034-
</RoadsExdm2ien.RoadsExtended>
1035-
</DATASECTION>
1036-
</TRANSFER>"""
1037-
expected = expected.replace(".11499999999999", ".115")
1038-
xtf = xtf.replace(".11499999999999", ".115")
1039-
assert expected in xtf, "Interlis output doesn't match."
1040-
1041-
1042789
###############################################################################
1043790
# Ili2 Oereb model
1044791

@@ -1199,22 +946,3 @@ def test_ogr_interlis_arc2():
1199946
for i in range(feat.GetGeomFieldCount()):
1200947
geom = feat.GetGeomFieldRef(i)
1201948
ogrtest.check_feature_geometry(geom, geom_field_values[i])
1202-
1203-
1204-
###############################################################################
1205-
# Test failure in creation of ILI2 dataset
1206-
1207-
1208-
def test_ogr_interlis2_create_file_error():
1209-
1210-
with pytest.raises(
1211-
Exception, match="model file not specified in destination filename"
1212-
):
1213-
ogr.GetDriverByName("Interlis 2").CreateDataSource("tmp/out.xtf")
1214-
1215-
with pytest.raises(
1216-
Exception, match="Failed to create XTF file /i_do/not/exist/out.xtf"
1217-
):
1218-
ogr.GetDriverByName("Interlis 2").CreateDataSource(
1219-
"/i_do/not/exist/out.xtf,data/ili/ch.bazl.sicherheitszonenplan.oereb_20131118.imd"
1220-
)

doc/source/drivers/vector/ili.rst

+2-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
.. build_dependencies:: Xerces
1111

12-
| OGR has support for INTERLIS reading and writing.
12+
| OGR has support for INTERLIS reading.
1313
| `INTERLIS <http://www.interlis.ch/>`__ is a standard which has been
1414
especially composed in order to fulfill the requirements of modeling
1515
and the integration of geodata into contemporary and future geographic
@@ -37,16 +37,14 @@ limitations:
3737
Driver capabilities
3838
-------------------
3939

40-
.. supports_create::
41-
4240
.. supports_georeferencing::
4341

4442
.. supports_virtualio::
4543

4644
Model support
4745
-------------
4846

49-
Data is read and written into transfer files which have different
47+
Data is read from transfer files which have different
5048
formats in INTERLIS 1 (.itf) and INTERLIS 2 (.xtf). Models are passed in
5149
IlisMeta format by using "a_filename.xtf,models.imd" as a connection
5250
string.
@@ -84,12 +82,6 @@ Some possible transformations using :ref:`ogr2ogr`.
8482

8583
ogr2ogr --config OGR_STROKE_CURVE TRUE -SQL 'SELECT Rechtsstatus,publiziertAb,MetadatenGeobasisdaten,Eigentumsbeschraenkung,ZustaendigeStelle,Flaeche FROM "OeREBKRM09trsfr.Transferstruktur.Geometrie"' shpdir ch.bazl.sicherheitszonenplan.oereb_20131118.xtf,OeREBKRM09vs.imd OeREBKRM09trsfr.Transferstruktur.Geometrie
8684

87-
- Shape -> Interlis 2:
88-
89-
::
90-
91-
ogr2ogr -f "Interlis 2" LandCover.xml,RoadsExdm2ien.imd RoadsExdm2ben.Roads.LandCover.shp
92-
9385
- Importing multiple Interlis 1 files into PostGIS:
9486

9587
::

0 commit comments

Comments
 (0)