Skip to content

Commit

Permalink
Merge pull request #12 from OSGeo/master
Browse files Browse the repository at this point in the history
refresh with MRF/brunsli
  • Loading branch information
lucianpls authored Jun 22, 2021
2 parents 06abdf4 + 2c1586f commit e91f17c
Show file tree
Hide file tree
Showing 29 changed files with 579 additions and 237 deletions.
14 changes: 7 additions & 7 deletions autotest/ogr/ogr_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ def test_ogr_csv_27():
feat.DumpReadable()
pytest.fail()


###############################################################################
# Check that we don't rewrite erroneously a file that has no header (#5161).

Expand Down Expand Up @@ -1197,7 +1197,7 @@ def test_ogr_csv_32():
f.DumpReadable()
pytest.fail()


###############################################################################
# Test Boolean, Int16 and Float32 support

Expand Down Expand Up @@ -1968,10 +1968,10 @@ def test_ogr_csv_47():

def test_ogr_csv_48():

gdal.FileFromMemBuffer('/vsimem/ogr_csv_48.csvt', 'JsonStringList,JsonIntegerList,JsonInteger64List,JsonRealList\n')
gdal.FileFromMemBuffer('/vsimem/ogr_csv_48.csvt', 'JsonStringList,JsonStringList,JsonIntegerList,JsonInteger64List,JsonRealList\n')
gdal.FileFromMemBuffer('/vsimem/ogr_csv_48.csv',
"""stringlist,intlist,int64list,reallist
"[""a"",null]","[1]","[1234567890123]","[0.125]"
"""stringlist,emptystringlist,intlist,int64list,reallist
"[""a"",null]",[],"[1]","[1234567890123]","[0.125]"
""")

gdal.VectorTranslate('/vsimem/ogr_csv_48_out.csv', '/vsimem/ogr_csv_48.csv', format='CSV', layerCreationOptions=['CREATE_CSVT=YES', 'LINEFORMAT=LF'])
Expand All @@ -1980,13 +1980,13 @@ def test_ogr_csv_48():
data = gdal.VSIFReadL(1, 10000, f).decode('ascii')
gdal.VSIFCloseL(f)

assert data.startswith('stringlist,intlist,int64list,reallist\n"[ ""a"", """" ]",[ 1 ],[ 1234567890123 ],[ 0.125')
assert data.startswith('stringlist,emptystringlist,intlist,int64list,reallist\n"[ ""a"", """" ]",[],[ 1 ],[ 1234567890123 ],[ 0.125')

f = gdal.VSIFOpenL('/vsimem/ogr_csv_48_out.csvt', 'rb')
data = gdal.VSIFReadL(1, 10000, f).decode('ascii')
gdal.VSIFCloseL(f)

assert data.startswith('JSonStringList,JSonIntegerList,JSonInteger64List,JSonRealList')
assert data.startswith('JSonStringList,JSonStringList,JSonIntegerList,JSonInteger64List,JSonRealList')

gdal.Unlink('/vsimem/ogr_csv_48.csv')
gdal.Unlink('/vsimem/ogr_csv_48.csvt')
Expand Down
25 changes: 9 additions & 16 deletions autotest/ogr/ogr_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3400,16 +3400,17 @@ def test_ogr_gpkg_46():
f = ogr.Feature(lyr.GetLayerDefn())
f.SetGeometry(ogr.CreateGeometryFromWkt('POINT(1 1)'))
lyr.CreateFeature(f)
# Note: those definitions of views are non conformant with GPKG 1.3 clarifications on views
# Note: this definition of a view is non conformant with GPKG 1.3 clarifications on views
ds.ExecuteSQL('CREATE VIEW my_view AS SELECT geom AS my_geom, fid AS my_fid FROM foo')
ds.ExecuteSQL("INSERT INTO gpkg_contents (table_name, identifier, data_type, srs_id) VALUES ( 'my_view', 'my_view', 'features', 0 )")
ds.ExecuteSQL("INSERT INTO gpkg_geometry_columns (table_name, column_name, geometry_type_name, srs_id, z, m) values ('my_view', 'my_geom', 'GEOMETRY', 0, 0, 0)")

# Note: this definition of a view is non conformant with GPKG 1.3 clarifications on views
ds.ExecuteSQL("CREATE VIEW my_view2 AS SELECT geom, fid AS OGC_FID, 'bla' as another_column FROM foo")
ds.ExecuteSQL("INSERT INTO gpkg_contents (table_name, identifier, data_type, srs_id) VALUES ( 'my_view2', 'my_view2', 'features', 0 )")
ds.ExecuteSQL("INSERT INTO gpkg_geometry_columns (table_name, column_name, geometry_type_name, srs_id, z, m) values ('my_view2', 'geom', 'GEOMETRY', 0, 0, 0)")

ds.ExecuteSQL('CREATE VIEW my_view3 AS SELECT a.fid, a.geom, b.fid as fid2 FROM foo a, foo b')
ds.ExecuteSQL('CREATE VIEW my_view3 AS SELECT a.fid * 10000 + b.fid as my_fid, a.fid as fid1, a.geom, b.fid as fid2 FROM foo a, foo b')
ds.ExecuteSQL("INSERT INTO gpkg_contents (table_name, identifier, data_type, srs_id) VALUES ( 'my_view3', 'my_view3', 'features', 0 )")
ds.ExecuteSQL("INSERT INTO gpkg_geometry_columns (table_name, column_name, geometry_type_name, srs_id, z, m) values ('my_view3', 'geom', 'GEOMETRY', 0, 0, 0)")

Expand Down Expand Up @@ -3447,7 +3448,7 @@ def test_ogr_gpkg_46():
f = lyr.GetNextFeature()
assert f is None

# View with FID
# View with FID in non-first position
lyr = ds.GetLayerByName('my_view2')
assert lyr.GetLayerDefn().GetFieldCount() == 1
assert lyr.GetFIDColumn() == 'OGC_FID'
Expand All @@ -3456,23 +3457,15 @@ def test_ogr_gpkg_46():
f.DumpReadable()
pytest.fail()

# View without valid rowid
# View with FID in first position
lyr = ds.GetLayerByName('my_view3')
assert lyr.GetLayerDefn().GetFieldCount() == 2
f = lyr.GetNextFeature()
if f.GetFID() != 0:
f.DumpReadable()
pytest.fail()
assert f.GetFID() == 10001
f = lyr.GetNextFeature()
if f.GetFID() != 1:
f.DumpReadable()
pytest.fail()
f2 = lyr.GetFeature(1)
if not f.Equal(f2):
f.DumpReadable()
f2.DumpReadable()
pytest.fail()

assert f.GetFID() == 10002
f2 = lyr.GetFeature(10002)
assert f.Equal(f2)
ds = None

gdaltest.gpkg_dr.DeleteDataSource('/vsimem/ogr_gpkg_46.gpkg')
Expand Down
9 changes: 5 additions & 4 deletions autotest/ogr/ogr_plscenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_ogr_plscenes_data_v1_nominal():
assert ext == (-180.0, 180.0, -90.0, 90.0)

field_count = lyr.GetLayerDefn().GetFieldCount()
assert field_count == 78
assert field_count == 106

# Regular /items/ fetching
gdal.FileFromMemBuffer("""/vsimem/data_v1/quick-search?_page_size=250&POSTFIELDS={"item_types":["PSOrthoTile"],"filter":{"type":"AndFilter","config":[]}}""",
Expand Down Expand Up @@ -517,7 +517,7 @@ def test_ogr_plscenes_data_v1_nominal():
for filename in fl:
gdal.Unlink(filename)


###############################################################################
# Test robustness to errors in Data V1 API

Expand Down Expand Up @@ -700,8 +700,9 @@ def test_ogr_plscenes_data_v1_live():

ds = None

ds = gdal.Open('PLScenes:version=data_v1,itemtypes=%s,scene=%s,asset=%s' % (catalog, scene, asset_name))
assert ds is not None
dsname = 'PLScenes:version=data_v1,itemtypes=%s,scene=%s,asset=%s' % (catalog, scene, asset_name)
ds = gdal.Open(dsname)
assert ds is not None, dsname
assert ds.RasterCount != 0


Expand Down
7 changes: 7 additions & 0 deletions autotest/ogr/ogr_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3105,6 +3105,13 @@ def test_ogr_sqlite_view_type():
assert lyr.GetLayerDefn().GetFieldCount() == 1
assert lyr.GetLayerDefn().GetFieldDefn(0).GetType() == ogr.OFTInteger

ds.ExecuteSQL('INSERT INTO t VALUES(1)')
f = lyr.GetNextFeature()
assert f['c'] == 1
lyr.ResetReading()
f = lyr.GetNextFeature()
assert f['c'] == 1

###############################################################################
#

Expand Down
10 changes: 9 additions & 1 deletion gdal/GDALmake.opt.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ INSTALL_DIR = $(GDAL_ROOT)/install-sh -d

LIBS = @LIBS@ $(KAK_LIBS) $(DWG_LIBS) $(CURL_LIB) \
$(MRSID_LIBS) $(MRSID_LIDAR_LIBS) $(ECW_LIBS) $(INGRES_LIB) \
$(PCIDSK_LIB) $(RASDAMAN_LIB) $(SOSI_LIB) \
$(PCIDSK_LIB) $(RASDAMAN_LIB) $(SOSI_LIB) $(BRUNSLI_LIB) \
$(OPENCL_LIB) $(JVM_LIB) $(LIBICONV) $(FGDB_LIB) $(LIBXML2_LIB) $(MONGODB_LIB) \
$(MONGOCXXV3_LIBS) $(JNI_LIB) $(HDFS_LIB)

Expand Down Expand Up @@ -459,6 +459,14 @@ RASDAMAN_ENABLED = @RASDAMAN_ENABLED@
RASDAMAN_INC = @RASDAMAN_INC@
RASDAMAN_LIB = @RASDAMAN_LIB@


#
# BRUNSLI (JPEG XL)
#
BRUNSLI_ENABLED = @BRUNSLI_ENABLED@
BRUNSLI_INCLUDE = @BRUNSLI_INCLUDE@
BRUNSLI_LIB = @BRUNSLI_LIB@

#
# PDF stuff
#
Expand Down
29 changes: 29 additions & 0 deletions gdal/configure
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ USE_ONLY_CRYPTODLL_ALG
HAVE_CRYPTOPP
HAVE_ARMADILLO
RDB_SETTING
BRUNSLI_LIB
BRUNSLI_INCLUDE
BRUNSLI_ENABLED
RASDAMAN_LIB
RASDAMAN_INC
RASDAMAN_ENABLED
Expand Down Expand Up @@ -1216,6 +1219,7 @@ with_mdb
with_jvm_lib
with_jvm_lib_add_rpath
with_rasdaman
with_brunsli
with_rdb
with_armadillo
with_cryptopp
Expand Down Expand Up @@ -2227,6 +2231,7 @@ Optional Packages:
--with-jvm-lib=ARG ARG is dlopen or points to Java libjvm path
--with-jvm-lib-add-rpath Add the libjvm path to the RPATH (no by default)
--with-rasdaman=DIR Include rasdaman support (DIR is rasdaman's install dir).
--with-brunsli Include brunsli support via libbrunsli library
--with-rdb=ARG Include RDB support (ARG=no, yes or RDB SDK root path)
--with-armadillo=ARG Include Armadillo support for faster TPS transform computation (ARG=yes/no/path to armadillo install root) [default=no]
--with-cryptopp=ARG Include cryptopp support (ARG=yes, no or path)
Expand Down Expand Up @@ -41354,6 +41359,27 @@ RASDAMAN_LIB=$RASDAMAN_LIB




# Check whether --with-brunsli was given.
if test "${with_brunsli+set}" = set; then :
withval=$with_brunsli;
fi


BRUNSLI_ENABLED=no

if test "$with_brunsli" != "" -a "$with_brunsli" != "no" ; then
BRUNSLI_ENABLED="yes"
BRUNSLI_ENABLED=$BRUNSLI_ENABLED

BRUNSLI_INCLUDE=-I$prefix/include

BRUNSLI_LIB="-lbrunslicommon -lbrunslienc -lbrunslidec -lbrotlicommon -lbrotlienc -lbrotlidec"

fi



# Check whether --with-rdb was given.
if test "${with_rdb+set}" = set; then :
withval=$with_rdb;
Expand Down Expand Up @@ -45054,6 +45080,9 @@ echo " Kea support: ${HAVE_KEA}"
echo " LERC support: ${HAVE_LERC}"


echo " libbrunsli support: ${BRUNSLI_ENABLED}"


echo " libdeflate support: ${LIBDEFLATE_SETTING}"


Expand Down
17 changes: 17 additions & 0 deletions gdal/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5594,6 +5594,22 @@ AC_SUBST(RASDAMAN_ENABLED,$RASDAMAN_ENABLED)
AC_SUBST(RASDAMAN_INC, $RASDAMAN_INC)
AC_SUBST(RASDAMAN_LIB, $RASDAMAN_LIB)


dnl ---------------------------------------------------------------------------
dnl brunsli support
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(brunsli,[ --with-brunsli Include brunsli support via libbrunsli library],,)

BRUNSLI_ENABLED=no

if test "$with_brunsli" != "" -a "$with_brunsli" != "no" ; then
BRUNSLI_ENABLED="yes"
AC_SUBST(BRUNSLI_ENABLED, $BRUNSLI_ENABLED)
AC_SUBST(BRUNSLI_INCLUDE, -I$prefix/include)
AC_SUBST(BRUNSLI_LIB, "-lbrunslicommon -lbrunslienc -lbrunslidec -lbrotlicommon -lbrotlienc -lbrotlidec")
fi

dnl ---------------------------------------------------------------------------
dnl RDB support
dnl ---------------------------------------------------------------------------
Expand Down Expand Up @@ -6093,6 +6109,7 @@ LOC_MSG([ JPEG-Lossless/CharLS: ${HAVE_CHARLS}])
LOC_MSG([ Kakadu support: ${HAVE_KAKADU}])
LOC_MSG([ Kea support: ${HAVE_KEA}])
LOC_MSG([ LERC support: ${HAVE_LERC}])
LOC_MSG([ libbrunsli support: ${BRUNSLI_ENABLED}])
LOC_MSG([ libdeflate support: ${LIBDEFLATE_SETTING}])
LOC_MSG([ LIBGEOTIFF support: ${GEOTIFF_SETTING}])
LOC_MSG([ LIBGIF support: ${GIF_SETTING}])
Expand Down
Loading

0 comments on commit e91f17c

Please sign in to comment.