Skip to content

Commit

Permalink
ADRG: remove write support
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 28, 2025
1 parent 28654a8 commit 0ee2281
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 1,269 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Supported Formats: (ro:read-only, rw:read-write, +:update, v:virtual-I/O s:subda
HDF5Image -raster- (rov): HDF5 Dataset
NWT_GRD -raster- (rw+v): Northwood Numeric Grid Format .grd/.tab (*.grd)
NWT_GRC -raster- (rov): Northwood Classified Grid Format .grc/.tab (*.grc)
ADRG -raster- (rw+vs): ARC Digitized Raster Graphics (*.gen)
ADRG -raster- (rovs): ARC Digitized Raster Graphics (*.gen)
SRP -raster- (rovs): Standard Raster Product (ASRP/USRP) (*.img)
BLX -raster- (rwv): Magellan topo (.blx) (*.blx)
GeoRaster -raster- (rw+s): Oracle Spatial GeoRaster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Supported Formats: (ro:read-only, rw:read-write, +:update, v:virtual-I/O s:subda
HDF5Image -raster- (rov): HDF5 Dataset
NWT_GRD -raster- (rw+v): Northwood Numeric Grid Format .grd/.tab (*.grd)
NWT_GRC -raster- (rov): Northwood Classified Grid Format .grc/.tab (*.grc)
ADRG -raster- (rw+vs): ARC Digitized Raster Graphics (*.gen)
ADRG -raster- (rovs): ARC Digitized Raster Graphics (*.gen)
SRP -raster- (rovs): Standard Raster Product (ASRP/USRP) (*.img)
BLX -raster- (rwv): Magellan topo (.blx) (*.blx)
PostGISRaster -raster- (rws): PostGIS Raster driver
Expand Down
88 changes: 0 additions & 88 deletions autotest/gdrivers/adrg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# SPDX-License-Identifier: MIT
###############################################################################

import os
import shutil

import gdaltest
import pytest

Expand Down Expand Up @@ -58,91 +55,6 @@ def test_adrg_read_subdataset_img():
tst.testOpen()


###############################################################################
# Test copying.


def test_adrg_copy():

drv = gdal.GetDriverByName("ADRG")
srcds = gdal.Open("data/adrg/SMALL_ADRG/ABCDEF01.GEN")

dstds = drv.CreateCopy("tmp/ABCDEF01.GEN", srcds)

chksum = dstds.GetRasterBand(1).Checksum()

assert chksum == 62833, "Wrong checksum"

dstds = None

drv.Delete("tmp/ABCDEF01.GEN")


###############################################################################
# Test creating a fake 2 subdataset image and reading it.


def test_adrg_2subdatasets():

drv = gdal.GetDriverByName("ADRG")
srcds = gdal.Open("data/adrg/SMALL_ADRG/ABCDEF01.GEN")

with gdal.config_option("ADRG_SIMULATE_MULTI_IMG", "ON"):
dstds = drv.CreateCopy("tmp/XXXXXX01.GEN", srcds)
del dstds

shutil.copy("tmp/XXXXXX01.IMG", "tmp/XXXXXX02.IMG")

ds = gdal.Open("tmp/TRANSH01.THF")
assert ds.RasterCount == 0, "did not expected non 0 RasterCount"
ds = None

ds = gdal.Open("ADRG:tmp/XXXXXX01.GEN,tmp/XXXXXX02.IMG")
chksum = ds.GetRasterBand(1).Checksum()

assert chksum == 62833, "Wrong checksum"

md = ds.GetMetadata("")
assert md["ADRG_NAM"] == "XXXXXX02", "metadata wrong."

ds = None

os.remove("tmp/XXXXXX01.GEN")
os.remove("tmp/XXXXXX01.GEN.aux.xml")
os.remove("tmp/XXXXXX01.IMG")
os.remove("tmp/XXXXXX02.IMG")
os.remove("tmp/TRANSH01.THF")


###############################################################################
# Test creating an in memory copy.


def test_adrg_copy_vsimem():

drv = gdal.GetDriverByName("ADRG")
srcds = gdal.Open("data/adrg/SMALL_ADRG/ABCDEF01.GEN")

dstds = drv.CreateCopy("/vsimem/ABCDEF01.GEN", srcds)

chksum = dstds.GetRasterBand(1).Checksum()

assert chksum == 62833, "Wrong checksum"

dstds = None

# Reopen file
ds = gdal.Open("/vsimem/ABCDEF01.GEN")

chksum = ds.GetRasterBand(1).Checksum()
assert chksum == 62833, "Wrong checksum"

ds = None

drv.Delete("/vsimem/ABCDEF01.GEN")
gdal.Unlink("/vsimem/TRANSH01.THF")


###############################################################################
# Test reading a fake North Polar dataset (#6560)

Expand Down
9 changes: 1 addition & 8 deletions doc/source/drivers/raster/adrg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ ADRG -- ADRG/ARC Digitized Raster Graphics (.gen/.thf)

.. built_in_by_default::

Supported by GDAL for read access. Creation is possible, but it must be
considered as experimental and a means of testing read access (although
files created by the driver can be read successfully on another GIS
software)
Supported by GDAL for read access.

An ADRG dataset is made of several files. The file recognised by GDAL is
the General Information File (.GEN). GDAL will also need the image file
Expand All @@ -32,10 +29,6 @@ See also : the `ADRG specification
Driver capabilities
-------------------

.. supports_createcopy::

.. supports_create::

.. supports_georeferencing::

.. supports_virtualio::
Loading

0 comments on commit 0ee2281

Please sign in to comment.