[gdal] 01/10: New upstream version 2.2.3~rc1+dfsg
Bas Couwenberg
sebastic at debian.org
Mon Nov 20 16:33:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch experimental
in repository gdal.
commit 82dd6a1795604f58c7305887240dcf7766b9adc9
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Mon Nov 20 14:18:35 2017 +0100
New upstream version 2.2.3~rc1+dfsg
---
GDALmake.opt.in | 2 +-
HOWTO-RELEASE | 2 -
NEWS | 158 ++++++++++++++++
VERSION | 2 +-
alg/delaunay.c | 13 +-
alg/gdal_rpc.cpp | 6 +-
alg/gdalgrid.cpp | 12 +-
alg/gdalproximity.cpp | 55 +++---
apps/gdal_contour.cpp | 13 +-
apps/gdal_translate_lib.cpp | 10 +-
apps/gdalwarp_lib.cpp | 16 +-
apps/ogrtindex.cpp | 8 +-
configure | 101 +++++++++--
configure.ac | 33 +++-
data/plscenesconf.json | 33 ++++
frmts/georaster/georaster_dataset.cpp | 87 +++++----
frmts/georaster/georaster_priv.h | 11 +-
frmts/georaster/georaster_rasterband.cpp | 6 +-
frmts/georaster/georaster_wrapper.cpp | 162 +++++++++++++----
frmts/georaster/oci_wrapper.cpp | 201 +++++++++++++++------
frmts/georaster/oci_wrapper.h | 18 +-
frmts/grib/gribdataset.cpp | 23 ++-
frmts/gsg/gsagdataset.cpp | 25 ++-
frmts/gtiff/geotiff.cpp | 85 ++++++++-
frmts/gtiff/gt_wkt_srs.cpp | 64 +++++--
frmts/gtiff/libtiff/tif_jpeg.c | 22 ++-
frmts/jp2kak/jp2kak.lst | 6 +
frmts/jp2kak/jp2kakdataset.cpp | 64 +++++--
frmts/jpeg/jpgdataset.cpp | 22 ++-
frmts/netcdf/netcdfdataset.cpp | 142 ++++++++++-----
frmts/openjpeg/openjpegdataset.cpp | 6 +-
frmts/pdf/pdfcreatecopy.cpp | 6 +-
frmts/sentinel2/sentinel2dataset.cpp | 25 ++-
frmts/vrt/vrtrawrasterband.cpp | 5 +-
frmts/wcs/httpdriver.cpp | 6 +-
gcore/gdal_misc.cpp | 5 +-
gcore/gdal_version.h | 8 +-
gcore/overview.cpp | 27 ++-
man/man1/gdal-config.1 | 2 +-
man/man1/gdal2tiles.1 | 2 +-
man/man1/gdal_calc.1 | 2 +-
man/man1/gdal_contour.1 | 2 +-
man/man1/gdal_edit.1 | 2 +-
man/man1/gdal_fillnodata.1 | 2 +-
man/man1/gdal_grid.1 | 2 +-
man/man1/gdal_merge.1 | 2 +-
man/man1/gdal_pansharpen.1 | 2 +-
man/man1/gdal_polygonize.1 | 2 +-
man/man1/gdal_proximity.1 | 2 +-
man/man1/gdal_rasterize.1 | 2 +-
man/man1/gdal_retile.1 | 2 +-
man/man1/gdal_sieve.1 | 2 +-
man/man1/gdal_translate.1 | 2 +-
man/man1/gdal_utilities.1 | 2 +-
man/man1/gdaladdo.1 | 2 +-
man/man1/gdalbuildvrt.1 | 2 +-
man/man1/gdalcompare.1 | 2 +-
man/man1/gdaldem.1 | 2 +-
man/man1/gdalinfo.1 | 2 +-
man/man1/gdallocationinfo.1 | 2 +-
man/man1/gdalmanage.1 | 2 +-
man/man1/gdalmove.1 | 2 +-
man/man1/gdalsrsinfo.1 | 2 +-
man/man1/gdaltindex.1 | 2 +-
man/man1/gdaltransform.1 | 2 +-
man/man1/gdalwarp.1 | 2 +-
man/man1/gnm_utilities.1 | 2 +-
man/man1/gnmanalyse.1 | 2 +-
man/man1/gnmmanage.1 | 2 +-
man/man1/nearblack.1 | 2 +-
man/man1/ogr2ogr.1 | 2 +-
man/man1/ogr_utilities.1 | 2 +-
man/man1/ogrinfo.1 | 2 +-
man/man1/ogrlineref.1 | 2 +-
man/man1/ogrmerge.1 | 2 +-
man/man1/ogrtindex.1 | 2 +-
man/man1/pct2rgb.1 | 2 +-
man/man1/rgb2pct.1 | 2 +-
nmake.opt | 7 +-
ogr/gml2ogrgeometry.cpp | 11 +-
ogr/ogr_geometry.h | 5 +-
ogr/ogrcircularstring.cpp | 18 +-
ogr/ogrcurvepolygon.cpp | 12 +-
ogr/ogrlinestring.cpp | 5 +-
ogr/ogrpoint.cpp | 5 +-
ogr/ogrsf_frmts/amigocloud/drv_amigocloud.html | 38 +++-
ogr/ogrsf_frmts/amigocloud/ogr_amigocloud.h | 6 +-
.../amigocloud/ogramigoclouddatasource.cpp | 119 +++++++++++-
ogr/ogrsf_frmts/amigocloud/ogramigoclouddriver.cpp | 5 +-
ogr/ogrsf_frmts/amigocloud/ogramigocloudlayer.cpp | 17 +-
.../amigocloud/ogramigocloudresultlayer.cpp | 2 +-
.../amigocloud/ogramigocloudtablelayer.cpp | 2 +-
ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp | 4 +-
ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp | 5 +-
ogr/ogrsf_frmts/geojson/ogrgeojsondriver.cpp | 6 +-
ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp | 20 +-
ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp | 60 +-----
ogr/ogrsf_frmts/gml/gmlreader.cpp | 8 +-
ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp | 13 +-
ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp | 27 ++-
ogr/ogrsf_frmts/gpkg/ogr_geopackage.h | 4 +-
ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp | 23 ++-
ogr/ogrsf_frmts/gtm/gtm.cpp | 4 +-
ogr/ogrsf_frmts/mdb/ogr_mdb.h | 9 +-
ogr/ogrsf_frmts/mdb/ogrmdbdatasource.cpp | 4 +-
ogr/ogrsf_frmts/mdb/ogrmdbdriver.cpp | 3 +-
ogr/ogrsf_frmts/mdb/ogrmdbjackcess.cpp | 78 ++++++--
ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp | 34 +++-
ogr/ogrsf_frmts/mysql/ogr_mysql.h | 3 +-
ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp | 26 +--
ogr/ogrsf_frmts/oci/ogrocisession.cpp | 21 +--
ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp | 4 +-
ogr/ogrsf_frmts/ods/ogrodsdatasource.cpp | 21 ++-
ogr/ogrsf_frmts/ods/ogrodsdriver.cpp | 6 +-
ogr/ogrsf_frmts/shape/ogrshapelayer.cpp | 4 +-
ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp | 5 +-
ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp | 20 +-
ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp | 116 +++++++++---
ogr/ogrsf_frmts/xls/ogr_xls.h | 6 +-
ogr/ogrsf_frmts/xls/ogrxlsdatasource.cpp | 43 ++++-
ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp | 72 +++++---
ogr/ogrsf_frmts/xlsx/ogrxlsxdriver.cpp | 21 ++-
port/cpl_aws.cpp | 14 +-
port/cpl_conv.cpp | 20 +-
port/cpl_google_cloud.cpp | 7 +-
port/cpl_vsil_curl.cpp | 46 +++--
swig/csharp/const/GdalConst.cs | 5 +
swig/csharp/const/GdalConstPINVOKE.cs | 15 ++
swig/csharp/const/gdalconst_wrap.c | 50 +++++
swig/csharp/gdal/ResampleAlg.cs | 7 +-
swig/include/gdal.i | 10 +-
swig/include/gdal_array.i | 3 +-
swig/include/gdalconst.i | 7 +-
swig/include/perl/gdal_perl.i | 6 +-
swig/include/perl/ogr_perl.i | 2 +-
swig/perl/gdalconst_wrap.c | 25 +++
swig/perl/lib/Geo/GDAL.pm | 6 +-
swig/perl/lib/Geo/GDAL/Const.pm | 5 +
swig/perl/lib/Geo/OGR.pm | 2 +-
swig/perl/t/00-measures-01.t | 4 +-
swig/python/README.txt | 2 +-
swig/python/extensions/gdalconst_wrap.c | 60 ++++++
swig/python/osgeo/gdal_array.py | 1 -
swig/python/osgeo/gdalconst.py | 15 ++
144 files changed, 2078 insertions(+), 726 deletions(-)
diff --git a/GDALmake.opt.in b/GDALmake.opt.in
index 17efccf..4b16a9a 100644
--- a/GDALmake.opt.in
+++ b/GDALmake.opt.in
@@ -120,7 +120,7 @@ GDAL_INCLUDE = -I$(GDAL_ROOT)/port -I$(GDAL_ROOT)/gcore \
# libtool targets and help variables
LIBGDAL := libgdal.la
LIBGDAL_CURRENT := 23
-LIBGDAL_REVISION := 1
+LIBGDAL_REVISION := 2
LIBGDAL_AGE := 3
# native build targets and variables
diff --git a/HOWTO-RELEASE b/HOWTO-RELEASE
index bf02d2f..add9368 100644
--- a/HOWTO-RELEASE
+++ b/HOWTO-RELEASE
@@ -163,11 +163,9 @@ password: yourpassword
b) cd swig/python
c) For trial :
- python setup.py register -r pypitest
python setup.py sdist upload -r pypitest
d) For real :
- python setup.py register -r pypi
python setup.py sdist upload -r pypi
21) Build and bundle the java bindings.
diff --git a/NEWS b/NEWS
index 8e8ab49..ae3709c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,161 @@
+= GDAL/OGR 2.2.3 Release Notes =
+
+The 2.2.3 release is a bug fix release.
+
+== Build ==
+
+ * nmake.opt: Ensure PDB is included in release DLL if WITH_PDB requested (#7055)
+
+== Port ==
+
+ * /vsicurl/ and derived filesystems: redirect ReadDir() to ReadDirEx() (#7045)
+ * /vsicurl/: enable redirection optimization on signed URLs of Google Cloud Storage. Helps for the PLScenes driver (#7067)
+ * /vsicurl/: fix 2.2 regression regarding retrieval of file size of FTP file (#7088)
+ * /vsis3/: fix to avoid invalid content to be sent if Write() writes more than 50 MB in a single call (#7058)
+ * /vsis3/: fix Seek(Tell(), SEEK_SET) fails if current position is not 0 (#7062)
+ * /vsis3/: fix support of non-ASCII characters in keys (#7143, #7146)
+ * Fix CPLCopyTree() that doesn't properly on MSVC 2015 (and possibly other platforms) (#7070)
+
+== Algorithms ==
+
+ * RPC transformer: set output coordinates to HUGE_VAL when failure occurs, so that a following coordinate transformation can detect the error too (#7090)
+ * GDALGrid() with linear algorithm: avoid assertions/segmentation fault when GDALTriangulationFindFacetDirected() fails (#7101)
+ * GDALComputeProximity(): fix int32 overflow when computing distances on large input datasets (#7102)
+ * GDALResampleChunk32R_Gauss: fix potential out of bounds access (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4056)
+
+== GDAL utilities ==
+
+ * gdalwarp: fix issue with GDALAdjustValueToDataType(Float32, +/- inf) that didn't preserve infinity, which affected gdalwarp -dstnodata inf (#7097)
+ * gdalwarp -crop_to_cutline: reduce number of iterations to find the appropriate densification (#7119)
+ * gdal_contour: return with non-0 code if field creation or contour generation failed (#7147)
+
+== GDAL drivers ==
+
+GeoRaster driver:
+ * fix int overflow (#6999)
+
+GPKG driver:
+ * speed-up statistics retrieval on non-Byte datasets (#7096)
+
+GRIB driver:
+ * if GRIB_ADJUST_LONGITUDE_RANGE config option is set to YES, adjust the longitude range to be close to [-180,180] when possible for products whose left origin is close to 180deg. (#7103)
+
+GSAG driver:
+ * avoid assertion on some files with nul characters (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3726)
+
+GTiff driver:
+ * make sure that -co PHOTOMETRIC=RGB overrides the color interpretation of the first 3 bands of the source datasets (#7064)
+ * on reading use GeogTOWGS84GeoKey to override the defaults TOWGS84 values coming from EPSG code (#7144)
+ * fix potential crash when reading in RGBA mode with internal libtiff (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4157)
+ * fix potential crash with old-jpeg compression and internal libtiff (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4180)
+
+HTTP driver:
+ * do not open the underlying dataset with GDAL_OF_SHARED, to avoid later assertion
+
+JP2KAK driver:
+ * fix unix build with Kakadu 7.A and later (#7048, #7081)
+
+JPEG driver:
+ * Add compatibility with libjpeg-turbo 1.5.2 that honours max_memory_to_use (cf https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162)
+
+JP2OpenJPEG driver:
+ * Add support for openjpeg 2.3 (#7074)
+
+netCDF driver:
+ * fix raster read as nodata with Byte datatype, (valid_range={0,255} or _Unsigned = True) and negative _FillValue (#7069)
+ * be more tolerant on the formatting of standard parallel (space separated instead of {x,y,...} syntax), and accept up to 2/1000 error on spacing to consider a regular grid, to be able to read files provided by the national weather institute of Netherlands (KNMI) (#7086)
+
+PDF driver:
+ * round to upper integer when computing a DPI such that page size remains within limits accepted by Acrobat (#7083)
+
+Sentinel2 driver:
+ * add support for direct opening of .zip files of new safe_compact L1C products (#7085)
+
+VRT driver:
+ * avoid error being emitted when opening a VRTRawRasterBand in a .zip files (#7056)
+
+== OGR core ==
+
+ * Fix OGR[Curve]Polygon::Intersects(OGRPoint*) to return true when point is on polygon boundary (#7091)
+ * importFromWkt(): fix import of GEOMETRYCOLLECTION ending with POINT EMPTY or LINESTRING EMPTY (#7128, 2.1 regression)
+
+== OGR utilities ==
+
+ * ogrtindex: fix crash when using -f SQLITE -t_srs XXXX (#7053)
+
+== OGR drivers ==
+
+Amigocloud driver:
+ * Fixed data field types (https://github.com/OSGeo/gdal/pull/246)
+ * Output list of datasets if dataset id is not provided.
+ * Implemented waiting for job to complete on the server. This will improve write to AmigoCloud reliability.
+ * Updated documentation.
+
+FileGDB driver:
+ * remove erroneous ODsCCreateGeomFieldAfterCreateLayer capability declaration (https://github.com/OSGeo/gdal/pull/247)
+
+GeoJSON driver:
+ * ESRIJson: recognize documents that lack geometry fields (#7071)
+ * ESRIJson: recognize documents starting with a very long fieldAliases list (#7107)
+
+GeoRSS driver:
+ * fix detection of field type (#7108)
+
+GML driver:
+ * fix FORCE_SRS_DETECTION=YES effect on feature count and SRS reporting on gml files with .gfs (#7046)
+ * do not try to open kml files (#7061)
+ * GML geometry parsing: fix robustness issue with gml:PolyhedralSurface
+ * do not report gml:name / gml:description of features as layer metadata
+
+GPKG driver:
+ * do not try to update extent on gpkg_contents after GetExtent() on a empty layer of a datasource opened in read-only mode
+
+GTM driver:
+ * fix null pointer dereference in case of read error (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4047)
+
+KML / LIBKML drivers:
+
+MDB driver:
+ * fix multi-thread support (https://issues.qgis.org/issues/16039)
+
+MITAB driver
+ * do not emit error if the .ind file is missing, just a debug message (#7094)
+
+MySQL:
+ * fix build with MariaDB 10.2 (#7079)
+
+OCI driver:
+ * initialize in multi-threaded compatible mode to fix QGIS related crashes (https://issues.qgis.org/issues/17311), and fix a few memleaks
+
+ODS driver:
+ * avoid using CPLSPrintf() return directly with VSIFOpenL() as the temp buffer might be later recycled (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4050)
+
+PLScenes driver:
+ * backport data/plscenesconf.json from trunk to add SkySatScene fields
+
+Shapefile driver:
+ * Fix GetFeatureCount() to properly take into account spatial filter when attribute filter also in effect (#7123)
+
+SQLite/Spatialite driver:
+ * don't invalidate statistics when running a PRAGMA (https://issues.qgis.org/issues/17424)
+ * SQLite dialect: support SQLite 3.21, and LIKE, <>, IS NOT, IS NOT NULL, IS NULL and IS operators (#7149)
+
+XLS driver:
+ * workaround opening filenames with incompatible character set on Windows (https://issues.qgis.org/issues/9301)
+
+XLSX driver:
+ * fix non working detection of Date/Time fields in some documents (#7073)
+ * fix opening of documents with x: namespace in xl/workbook.xml (#7110)
+ * avoid using CPLSPrintf() return directly with VSIFOpenL() as the temp buffer might be later recycled (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4050)
+
+== SWIG bindings ==
+
+ * map GRA_Max, GRA_Min, GRA_Med, GRA_Q1 and GRA_Q3 (#7153)
+
+== Python bindings ==
+
+ * remove 'from . import _gdal_array' line from gdal_array.py that is not necessary with normal execution of the bindings, and cause errors with PyInstaller (#7044)
+
= GDAL/OGR 2.2.2 Release Notes =
The 2.2.2 release is a bug fix release.
diff --git a/VERSION b/VERSION
index b1b25a5..5859406 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.2
+2.2.3
diff --git a/alg/delaunay.c b/alg/delaunay.c
index e36f8ba..d4817c2 100644
--- a/alg/delaunay.c
+++ b/alg/delaunay.c
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: delaunay.c 36493 2016-11-24 20:53:30Z rouault $
+ * $Id: delaunay.c 40486 2017-10-18 14:26:45Z rouault $
*
* Project: GDAL algorithms
* Purpose: Delaunay triangulation
@@ -50,7 +50,7 @@
#include <ctype.h>
#include <math.h>
-CPL_CVSID("$Id: delaunay.c 36493 2016-11-24 20:53:30Z rouault $");
+CPL_CVSID("$Id: delaunay.c 40486 2017-10-18 14:26:45Z rouault $");
#if defined(INTERNAL_QHULL) || defined(EXTERNAL_QHULL)
#define HAVE_INTERNAL_OR_EXTERNAL_QHULL 1
@@ -403,7 +403,8 @@ int GDALTriangulationComputeBarycentricCoordinates(const GDALTriangulation* psD
* @param psDT triangulation.
* @param dfX x coordinate of the point.
* @param dfY y coordinate of the point.
- * @param panOutputFacetIdx (output) pointer to the index of the triangle.
+ * @param panOutputFacetIdx (output) pointer to the index of the triangle,
+ * or -1 in case of failure.
*
* @return index >= 0 of the triangle in case of success, -1 otherwise.
*
@@ -488,11 +489,13 @@ int GDALTriangulationFindFacetBruteForce(const GDALTriangulation* psDT,
*
* @param psDT triangulation.
* @param nFacetIdx index of first triangle to start with.
+ * Must be >= 0 && < psDT->nFacets
* @param dfX x coordinate of the point.
* @param dfY y coordinate of the point.
- * @param panOutputFacetIdx (output) pointer to the index of the triangle.
+ * @param panOutputFacetIdx (output) pointer to the index of the triangle,
+ * or -1 in case of failure.
*
- * @return TRUE in case of success, -1 otherwise.
+ * @return TRUE in case of success, FALSE otherwise.
*
* @since GDAL 2.1
*/
diff --git a/alg/gdal_rpc.cpp b/alg/gdal_rpc.cpp
index 9e6777d..876de3f 100644
--- a/alg/gdal_rpc.cpp
+++ b/alg/gdal_rpc.cpp
@@ -56,7 +56,7 @@
// #define DEBUG_VERBOSE_EXTRACT_DEM
-CPL_CVSID("$Id: gdal_rpc.cpp 39050 2017-06-10 20:18:19Z rouault $");
+CPL_CVSID("$Id: gdal_rpc.cpp 40447 2017-10-16 09:33:31Z rouault $");
CPL_C_START
CPLXMLNode *GDALSerializeRPCTransformer( void *pTransformArg );
@@ -2019,6 +2019,8 @@ int GDALRPCTransform( void *pTransformArg, int bDstToSrc,
&dfHeight ) )
{
panSuccess[i] = FALSE;
+ padfX[i] = HUGE_VAL;
+ padfY[i] = HUGE_VAL;
continue;
}
@@ -2053,6 +2055,8 @@ int GDALRPCTransform( void *pTransformArg, int bDstToSrc,
&dfResultX, &dfResultY ) )
{
panSuccess[i] = FALSE;
+ padfX[i] = HUGE_VAL;
+ padfY[i] = HUGE_VAL;
continue;
}
diff --git a/alg/gdalgrid.cpp b/alg/gdalgrid.cpp
index 7df5869..f17d2f7 100644
--- a/alg/gdalgrid.cpp
+++ b/alg/gdalgrid.cpp
@@ -51,7 +51,7 @@
#include "cpl_worker_thread_pool.h"
#include "gdal.h"
-CPL_CVSID("$Id: gdalgrid.cpp 37481 2017-02-27 12:42:13Z rouault $");
+CPL_CVSID("$Id: gdalgrid.cpp 40486 2017-10-18 14:26:45Z rouault $");
static const double TO_RADIANS = M_PI / 180.0;
@@ -1456,13 +1456,13 @@ GDALGridLinear( const void *poOptionsIn, GUInt32 nPoints,
psTriangulation, psExtraParams->nInitialFacetIdx,
dfXPoint, dfYPoint, &nOutputFacetIdx ) );
- CPLAssert(nOutputFacetIdx >= 0);
- // Reuse output facet idx as next initial index since we proceed line by
- // line.
- psExtraParams->nInitialFacetIdx = nOutputFacetIdx;
-
if( bRet )
{
+ CPLAssert(nOutputFacetIdx >= 0);
+ // Reuse output facet idx as next initial index since we proceed line by
+ // line.
+ psExtraParams->nInitialFacetIdx = nOutputFacetIdx;
+
double lambda1 = 0.0;
double lambda2 = 0.0;
double lambda3 = 0.0;
diff --git a/alg/gdalproximity.cpp b/alg/gdalproximity.cpp
index 3d7e085..cecc238 100644
--- a/alg/gdalproximity.cpp
+++ b/alg/gdalproximity.cpp
@@ -42,7 +42,7 @@
#include "cpl_vsi.h"
#include "gdal.h"
-CPL_CVSID("$Id: gdalproximity.cpp 36721 2016-12-06 05:02:46Z goatbar $");
+CPL_CVSID("$Id: gdalproximity.cpp 40490 2017-10-18 17:08:34Z rouault $");
static CPLErr
ProcessProximityLine( GInt32 *panSrcScanline, int *panNearX, int *panNearY,
@@ -451,6 +451,18 @@ end:
}
/************************************************************************/
+/* SquareDistance() */
+/************************************************************************/
+
+static double SquareDistance(double dfX1, double dfX2,
+ double dfY1, double dfY2)
+{
+ const double dfDX = dfX1 - dfX2;
+ const double dfDY = dfY1 - dfY2;
+ return dfDX * dfDX + dfDY * dfDY;
+}
+
+/************************************************************************/
/* ProcessProximityLine() */
/************************************************************************/
@@ -497,20 +509,19 @@ ProcessProximityLine( GInt32 *panSrcScanline, int *panNearX, int *panNearY,
/* Are we near(er) to the closest target to the above (below) */
/* pixel? */
/* -------------------------------------------------------------------- */
- float fNearDistSq =
- static_cast<float>(
+ double dfNearDistSq =
std::max(dfMaxDist, static_cast<double>(nXSize)) *
- std::max(dfMaxDist, static_cast<double>(nXSize)) * 2.0);
+ std::max(dfMaxDist, static_cast<double>(nXSize)) * 2.0;
if( panNearX[iPixel] != -1 )
{
- const float fDistSq = static_cast<float>(
- (panNearX[iPixel] - iPixel) * (panNearX[iPixel] - iPixel)
- + (panNearY[iPixel] - iLine) * (panNearY[iPixel] - iLine));
+ const double dfDistSq =
+ SquareDistance(panNearX[iPixel], iPixel,
+ panNearY[iPixel], iLine);
- if( fDistSq < fNearDistSq )
+ if( dfDistSq < dfNearDistSq )
{
- fNearDistSq = fDistSq;
+ dfNearDistSq = dfDistSq;
}
else
{
@@ -527,13 +538,13 @@ ProcessProximityLine( GInt32 *panSrcScanline, int *panNearX, int *panNearY,
if( iPixel != iStart && panNearX[iLast] != -1 )
{
- const float fDistSq = static_cast<float>(
- (panNearX[iLast] - iPixel) * (panNearX[iLast] - iPixel)
- + (panNearY[iLast] - iLine) * (panNearY[iLast] - iLine));
+ const double dfDistSq =
+ SquareDistance(panNearX[iLast], iPixel,
+ panNearY[iLast], iLine);
- if( fDistSq < fNearDistSq )
+ if( dfDistSq < dfNearDistSq )
{
- fNearDistSq = fDistSq;
+ dfNearDistSq = dfDistSq;
panNearX[iPixel] = panNearX[iLast];
panNearY[iPixel] = panNearY[iLast];
}
@@ -547,13 +558,13 @@ ProcessProximityLine( GInt32 *panSrcScanline, int *panNearX, int *panNearY,
if( iTR != iEnd && panNearX[iTR] != -1 )
{
- const float fDistSq = static_cast<float>(
- (panNearX[iTR] - iPixel) * (panNearX[iTR] - iPixel)
- + (panNearY[iTR] - iLine) * (panNearY[iTR] - iLine));
+ const double dfDistSq =
+ SquareDistance(panNearX[iTR], iPixel,
+ panNearY[iTR], iLine);
- if( fDistSq < fNearDistSq )
+ if( dfDistSq < dfNearDistSq )
{
- fNearDistSq = fDistSq;
+ dfNearDistSq = dfDistSq;
panNearX[iPixel] = panNearX[iTR];
panNearY[iPixel] = panNearY[iTR];
}
@@ -565,10 +576,10 @@ ProcessProximityLine( GInt32 *panSrcScanline, int *panNearX, int *panNearY,
if( panNearX[iPixel] != -1
&& (pdfSrcNoDataValue == NULL
|| panSrcScanline[iPixel] != *pdfSrcNoDataValue)
- && fNearDistSq <= dfMaxDist * dfMaxDist
+ && dfNearDistSq <= dfMaxDist * dfMaxDist
&& (pafProximity[iPixel] < 0
- || fNearDistSq < pafProximity[iPixel] * pafProximity[iPixel]) )
- pafProximity[iPixel] = static_cast<float>(sqrt(fNearDistSq));
+ || dfNearDistSq < pafProximity[iPixel] * pafProximity[iPixel]) )
+ pafProximity[iPixel] = static_cast<float>(sqrt(dfNearDistSq));
}
return CE_None;
diff --git a/apps/gdal_contour.cpp b/apps/gdal_contour.cpp
index eb04bc4..ba312c1 100644
--- a/apps/gdal_contour.cpp
+++ b/apps/gdal_contour.cpp
@@ -34,7 +34,7 @@
#include "ogr_api.h"
#include "ogr_srs_api.h"
-CPL_CVSID("$Id: gdal_contour.cpp 36534 2016-11-27 23:48:27Z goatbar $");
+CPL_CVSID("$Id: gdal_contour.cpp 40710 2017-11-14 21:47:33Z rouault $");
/************************************************************************/
/* ArgIsNumeric() */
@@ -296,15 +296,18 @@ int main( int argc, char ** argv )
hFld = OGR_Fld_Create( pszElevAttrib, OFTReal );
OGR_Fld_SetWidth( hFld, 12 );
OGR_Fld_SetPrecision( hFld, 3 );
- OGR_L_CreateField( hLayer, hFld, FALSE );
+ OGRErr eErr = OGR_L_CreateField( hLayer, hFld, FALSE );
OGR_Fld_Destroy( hFld );
+ if( eErr == OGRERR_FAILURE )
+ {
+ exit( 1 );
+ }
}
/* -------------------------------------------------------------------- */
/* Invoke. */
/* -------------------------------------------------------------------- */
- /* CPLErr eErr = */
- GDALContourGenerate( hBand, dfInterval, dfOffset,
+ CPLErr eErr = GDALContourGenerate( hBand, dfInterval, dfOffset,
nFixedLevelCount, adfFixedLevels,
bNoDataSet, dfNoData, hLayer,
OGR_FD_GetFieldIndex( OGR_L_GetLayerDefn( hLayer ),
@@ -326,5 +329,5 @@ int main( int argc, char ** argv )
GDALDestroyDriverManager();
OGRCleanupAll();
- return 0;
+ return (eErr == CE_None) ? 0 : 1;
}
diff --git a/apps/gdal_translate_lib.cpp b/apps/gdal_translate_lib.cpp
index e13f3f6..4c99892 100644
--- a/apps/gdal_translate_lib.cpp
+++ b/apps/gdal_translate_lib.cpp
@@ -52,7 +52,7 @@
#include "ogr_spatialref.h"
#include "vrtdataset.h"
-CPL_CVSID("$Id: gdal_translate_lib.cpp 39998 2017-09-04 13:20:51Z rouault $");
+CPL_CVSID("$Id: gdal_translate_lib.cpp 40479 2017-10-17 22:52:41Z rouault $");
static int ArgIsNumeric( const char * );
static void AttachMetadata( GDALDatasetH, char ** );
@@ -1492,13 +1492,7 @@ GDALDatasetH GDALTranslate( const char *pszDest, GDALDatasetH hSrcDataset,
bSignedByte = true;
int bClamped = FALSE, bRounded = FALSE;
double dfVal;
- if( eBandType == GDT_Float32 && CPLIsInf(psOptions->dfNoDataReal) )
- {
- dfVal = std::numeric_limits<float>::infinity();
- if( psOptions->dfNoDataReal < 0 )
- dfVal = -dfVal;
- }
- else if( bSignedByte )
+ if( bSignedByte )
{
if( psOptions->dfNoDataReal < -128 )
{
diff --git a/apps/gdalwarp_lib.cpp b/apps/gdalwarp_lib.cpp
index 4e2895b..fc5c8b7 100644
--- a/apps/gdalwarp_lib.cpp
+++ b/apps/gdalwarp_lib.cpp
@@ -40,6 +40,7 @@
#include <cstring>
#include <algorithm>
+#include <limits>
#include <vector>
#include "commonutils.h"
@@ -58,7 +59,7 @@
#include "ogr_srs_api.h"
#include "vrtdataset.h"
-CPL_CVSID("$Id: gdalwarp_lib.cpp 37987 2017-04-14 07:42:50Z rouault $");
+CPL_CVSID("$Id: gdalwarp_lib.cpp 40601 2017-11-01 10:47:26Z rouault $");
/************************************************************************/
/* GDALWarpAppOptions */
@@ -387,6 +388,7 @@ static CPLErr CropToCutline( OGRGeometryH hCutline, char** papszTO, int nSrcCoun
if( hCTCutlineToSrc != NULL )
OGR_G_Transform( hGeomInSrcSRS, hCTCutlineToSrc );
+ const double epsilon = std::numeric_limits<double>::epsilon();
for(int nIter=0;nIter<10;nIter++)
{
OGR_G_DestroyGeometry(hTransformedGeom);
@@ -396,10 +398,14 @@ static CPLErr CropToCutline( OGRGeometryH hCutline, char** papszTO, int nSrcCoun
OGR_G_GetEnvelope(hTransformedGeom, &sCurEnvelope);
if( nIter > 0 || hCTSrcToDst == NULL )
{
- if( sCurEnvelope.MinX == sLastEnvelope.MinX &&
- sCurEnvelope.MinY == sLastEnvelope.MinY &&
- sCurEnvelope.MaxX == sLastEnvelope.MaxX &&
- sCurEnvelope.MaxY == sLastEnvelope.MaxY )
+ if (std::abs(sCurEnvelope.MinX - sLastEnvelope.MinX) <=
+ epsilon * std::abs(sCurEnvelope.MinX + sLastEnvelope.MinX) &&
+ std::abs(sCurEnvelope.MinY - sLastEnvelope.MinY) <=
+ epsilon * std::abs(sCurEnvelope.MinY + sLastEnvelope.MinY) &&
+ std::abs(sCurEnvelope.MaxX - sLastEnvelope.MaxX) <=
+ epsilon * std::abs(sCurEnvelope.MaxX + sLastEnvelope.MaxX) &&
+ std::abs(sCurEnvelope.MaxY - sLastEnvelope.MaxY) <=
+ epsilon * std::abs(sCurEnvelope.MaxY + sLastEnvelope.MaxY))
{
break;
}
diff --git a/apps/ogrtindex.cpp b/apps/ogrtindex.cpp
index bfe81de..9e66462 100644
--- a/apps/ogrtindex.cpp
+++ b/apps/ogrtindex.cpp
@@ -35,7 +35,7 @@
#include <cassert>
-CPL_CVSID("$Id: ogrtindex.cpp 37862 2017-03-30 12:17:31Z rouault $");
+CPL_CVSID("$Id: ogrtindex.cpp 40206 2017-09-25 14:34:11Z rouault $");
static void Usage();
@@ -309,7 +309,8 @@ int main( int nArgc, char **papszArgv )
poDstLayer->CreateField( &oSrcSRSNameField );
}
- OGRSpatialReference::DestroySpatialReference( poSrcSpatialRef );
+ if( poSrcSpatialRef )
+ poSrcSpatialRef->Release();
}
}
@@ -738,8 +739,7 @@ int main( int nArgc, char **papszArgv )
OGRFeatureDefn::DestroyFeatureDefn( poFeatureDefn );
if( alreadyExistingSpatialRef != NULL )
- OGRSpatialReference::DestroySpatialReference(
- alreadyExistingSpatialRef );
+ alreadyExistingSpatialRef->Release();
delete poTargetSRS;
CPLFree(current_path);
diff --git a/configure b/configure
index fb621be..8796854 100755
--- a/configure
+++ b/configure
@@ -25116,19 +25116,20 @@ $as_echo "$as_me: OpenJPEG (JPEG2000) support disabled." >&6;}
elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then
- for ac_header in openjpeg-2.2/openjpeg.h
+
+ for ac_header in openjpeg-2.3/openjpeg.h
do :
- ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.2/openjpeg.h" "ac_cv_header_openjpeg_2_2_openjpeg_h" "$ac_includes_default"
-if test "x$ac_cv_header_openjpeg_2_2_openjpeg_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.3/openjpeg.h" "ac_cv_header_openjpeg_2_3_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_3_openjpeg_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENJPEG_2_2_OPENJPEG_H 1
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 1
_ACEOF
fi
done
- if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
+ if test "$ac_cv_header_openjpeg_2_3_openjpeg_h" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
@@ -25172,23 +25173,23 @@ else
fi
if test "$HAVE_OPENJPEG" = "yes"; then
- OPENJPEG_VERSION=20200
+ OPENJPEG_VERSION=20300
LIBS="-lopenjp2 $LIBS"
fi
else
- for ac_header in openjpeg-2.1/openjpeg.h
+ for ac_header in openjpeg-2.2/openjpeg.h
do :
- ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.1/openjpeg.h" "ac_cv_header_openjpeg_2_1_openjpeg_h" "$ac_includes_default"
-if test "x$ac_cv_header_openjpeg_2_1_openjpeg_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.2/openjpeg.h" "ac_cv_header_openjpeg_2_2_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_2_openjpeg_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENJPEG_2_1_OPENJPEG_H 1
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 1
_ACEOF
fi
done
- if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
+ if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
@@ -25232,23 +25233,23 @@ else
fi
if test "$HAVE_OPENJPEG" = "yes"; then
- OPENJPEG_VERSION=20100
+ OPENJPEG_VERSION=20200
LIBS="-lopenjp2 $LIBS"
fi
else
- for ac_header in openjpeg-2.0/openjpeg.h
+ for ac_header in openjpeg-2.1/openjpeg.h
do :
- ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.0/openjpeg.h" "ac_cv_header_openjpeg_2_0_openjpeg_h" "$ac_includes_default"
-if test "x$ac_cv_header_openjpeg_2_0_openjpeg_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.1/openjpeg.h" "ac_cv_header_openjpeg_2_1_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_1_openjpeg_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENJPEG_2_0_OPENJPEG_H 1
+#define HAVE_OPENJPEG_2_1_OPENJPEG_H 1
_ACEOF
fi
done
- if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+ if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
@@ -25292,8 +25293,69 @@ else
fi
if test "$HAVE_OPENJPEG" = "yes"; then
+ OPENJPEG_VERSION=20100
LIBS="-lopenjp2 $LIBS"
fi
+ else
+ for ac_header in openjpeg-2.0/openjpeg.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.0/openjpeg.h" "ac_cv_header_openjpeg_2_0_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_0_openjpeg_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENJPEG_2_0_OPENJPEG_H 1
+_ACEOF
+
+fi
+
+done
+
+ if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
+$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
+if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopenjp2 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opj_stream_set_user_data_length ();
+int
+main ()
+{
+return opj_stream_set_user_data_length ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_openjp2_opj_stream_set_user_data_length=yes
+else
+ ac_cv_lib_openjp2_opj_stream_set_user_data_length=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&5
+$as_echo "$ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&6; }
+if test "x$ac_cv_lib_openjp2_opj_stream_set_user_data_length" = xyes; then :
+ HAVE_OPENJPEG=yes
+else
+ HAVE_OPENJPEG=no
+fi
+
+ if test "$HAVE_OPENJPEG" = "yes"; then
+ LIBS="-lopenjp2 $LIBS"
+ fi
+ fi
fi
fi
fi
@@ -25308,8 +25370,11 @@ else
elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then
OPENJPEG_VERSION=20200
EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+ elif test -r $with_openjpeg/include/openjpeg-2.3/openjpeg.h ; then
+ OPENJPEG_VERSION=20300
+ EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
else
- as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2" "$LINENO" 5
+ as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2 or $with_openjpeg/include/openjpeg-2.3" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
diff --git a/configure.ac b/configure.ac
index 38adcf4..5049906 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
dnl ***************************************************************************
-dnl $Id: configure.ac 40036 2017-09-08 11:23:21Z rouault $
+dnl $Id: configure.ac 40330 2017-10-05 12:56:50Z rouault $
dnl
dnl Project: GDAL
dnl Purpose: Configure source file.
@@ -2539,28 +2539,38 @@ if test "$with_openjpeg" = "no" ; then
elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then
- AC_CHECK_HEADERS([openjpeg-2.2/openjpeg.h])
- if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
+
+ AC_CHECK_HEADERS([openjpeg-2.3/openjpeg.h])
+ if test "$ac_cv_header_openjpeg_2_3_openjpeg_h" = "yes"; then
AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
if test "$HAVE_OPENJPEG" = "yes"; then
- OPENJPEG_VERSION=20200
+ OPENJPEG_VERSION=20300
LIBS="-lopenjp2 $LIBS"
fi
else
- AC_CHECK_HEADERS([openjpeg-2.1/openjpeg.h])
- if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
+ AC_CHECK_HEADERS([openjpeg-2.2/openjpeg.h])
+ if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
if test "$HAVE_OPENJPEG" = "yes"; then
- OPENJPEG_VERSION=20100
+ OPENJPEG_VERSION=20200
LIBS="-lopenjp2 $LIBS"
fi
else
- AC_CHECK_HEADERS([openjpeg-2.0/openjpeg.h])
- if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+ AC_CHECK_HEADERS([openjpeg-2.1/openjpeg.h])
+ if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
if test "$HAVE_OPENJPEG" = "yes"; then
+ OPENJPEG_VERSION=20100
LIBS="-lopenjp2 $LIBS"
fi
+ else
+ AC_CHECK_HEADERS([openjpeg-2.0/openjpeg.h])
+ if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+ AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
+ if test "$HAVE_OPENJPEG" = "yes"; then
+ LIBS="-lopenjp2 $LIBS"
+ fi
+ fi
fi
fi
fi
@@ -2575,8 +2585,11 @@ else
elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then
OPENJPEG_VERSION=20200
EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+ elif test -r $with_openjpeg/include/openjpeg-2.3/openjpeg.h ; then
+ OPENJPEG_VERSION=20300
+ EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
else
- AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2])
+ AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2 or $with_openjpeg/include/openjpeg-2.3])
fi
AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,-L$with_openjpeg/lib)
diff --git a/data/plscenesconf.json b/data/plscenesconf.json
index af5881e..1f6f415 100644
--- a/data/plscenesconf.json
+++ b/data/plscenesconf.json
@@ -290,6 +290,39 @@
"analytic_b12",
"metadata_aux"
]
+ },
+ "SkySatScene" : {
+ "fields": [
+ { "name": "acquired", "type": "datetime" },
+ { "name": "anomalous_pixels", "type": "double" },
+ { "name": "cloud_cover", "type": "double" },
+ { "name": "gsd", "type": "double" },
+ { "name": "item_type", "type": "string" },
+ { "name": "provider", "type": "string" },
+ { "name": "published", "type": "datetime" },
+ { "name": "quality_category", "type": "string" },
+ { "name": "satellite_id", "type": "string" },
+ { "name": "satellite_azimuth", "type": "double" },
+ { "name": "strip_id", "type": "string" },
+ { "name": "sun_azimuth", "type": "double" },
+ { "name": "sun_elevation", "type": "double" },
+ { "name": "updated", "type": "datetime" },
+ { "name": "view_angle", "type": "double" }
+ ],
+ "assets": [
+ "basic_analytic_dn",
+ "basic_analytic_dn_rpc",
+ "basic_panchromatic_dn",
+ "basic_panchromatic_dn_rpc",
+ "basic_udm",
+ "ortho_analytic_dn",
+ "ortho_analytic_udm",
+ "ortho_visual",
+ "ortho_panchromatic_dn",
+ "ortho_panchromatic_udm",
+ "ortho_pansharpened",
+ "ortho_pansharpened_udm"
+ ]
}
}
}
diff --git a/frmts/georaster/georaster_dataset.cpp b/frmts/georaster/georaster_dataset.cpp
index c4aee69..bbc5323 100644
--- a/frmts/georaster/georaster_dataset.cpp
+++ b/frmts/georaster/georaster_dataset.cpp
@@ -40,7 +40,7 @@
#include "georaster_priv.h"
-CPL_CVSID("$Id: georaster_dataset.cpp 39643 2017-07-24 15:25:46Z ilucena $")
+CPL_CVSID("$Id: georaster_dataset.cpp 40616 2017-11-02 12:40:51Z ilucena $")
// ---------------------------------------------------------------------------
// GeoRasterDataset()
@@ -347,10 +347,10 @@ GDALDataset* GeoRasterDataset::Open( GDALOpenInfo* poOpenInfo )
poGRD->SetMetadataItem( "RDT_TABLE_NAME",
poGRW->sDataTable.c_str(), "ORACLE" );
- poGRD->SetMetadataItem( "RASTER_ID", CPLSPrintf( "%d",
+ poGRD->SetMetadataItem( "RASTER_ID", CPLSPrintf( "%lld",
poGRW->nRasterId ), "ORACLE" );
- poGRD->SetMetadataItem( "SRID", CPLSPrintf( "%d",
+ poGRD->SetMetadataItem( "SRID", CPLSPrintf( "%lld",
poGRW->nSRID ), "ORACLE" );
poGRD->SetMetadataItem( "WKT", poGRW->sWKText.c_str(), "ORACLE" );
@@ -400,29 +400,36 @@ void GeoRasterDataset::JP2_Open( GDALAccess /* eAccess */ )
{
CPLString osDSName;
- osDSName.Printf( "/vsiocilob/%s,%s,%s,%s,%d,noext",
+ osDSName.Printf( "/vsiocilob/%s,%s,%s,%s,%lld,noext",
poGeoRaster->poConnection->GetUser(),
poGeoRaster->poConnection->GetPassword(),
poGeoRaster->poConnection->GetServer(),
poGeoRaster->sDataTable.c_str(),
poGeoRaster->nRasterId );
+ CPLPushErrorHandler( CPLQuietErrorHandler );
+
poJP2Dataset = (GDALDataset*) GDALOpenEx( osDSName.c_str(),
GDAL_OF_RASTER,
apszDrivers,
NULL, NULL );
- }
- // Report error
+ CPLPopErrorHandler();
- if( ! poJP2Dataset )
+ if( ! poJP2Dataset )
+ {
+ CPLString osLastErrorMsg(CPLGetLastErrorMsg());
+ CPLError( CE_Failure, CPLE_AppDefined,
+ "Unable to open JPEG2000 image within GeoRaster dataset.\n%s",
+ osLastErrorMsg.c_str() );
+ }
+ }
+ else
{
CPLError( CE_Failure, CPLE_AppDefined,
- "Unable to open JPEG2000 image within GeoRaster dataset.\n%s",
- ( ! poJP2Driver ) ?
- "No JPEG2000 capable driver (JP2OPENJPEG,, JP2ECW, JP2MRSID, etc...) is available." :
- "One or several JPEG2000 capable drivers are available but the lob could not be "
- "opened successfully." );
+ "Unable to open JPEG2000 image within GeoRaster dataset.\n%s",
+ "No JPEG2000 capable driver (JP2OPENJPEG, "
+ "JP2ECW, JP2MRSID, etc...) is available." );
}
}
@@ -530,7 +537,7 @@ void GeoRasterDataset::JP2_CreateCopy( GDALDataset* poJP2DS,
CPLString osDSName;
- osDSName.Printf( "/vsiocilob/%s,%s,%s,%s,%d,noext",
+ osDSName.Printf( "/vsiocilob/%s,%s,%s,%s,%lld,noext",
poGeoRaster->poConnection->GetUser(),
poGeoRaster->poConnection->GetPassword(),
poGeoRaster->poConnection->GetServer(),
@@ -548,16 +555,22 @@ void GeoRasterDataset::JP2_CreateCopy( GDALDataset* poJP2DS,
CPLPopErrorHandler();
CSLDestroy( papszOpt );
- }
- if( ! poJP2Dataset )
+ if( ! poJP2Dataset )
+ {
+ CPLString osLastErrorMsg(CPLGetLastErrorMsg());
+ CPLError( CE_Failure, CPLE_AppDefined,
+ "Unable to copy JPEG2000 image within GeoRaster dataset.\n%s",
+ osLastErrorMsg.c_str() );
+ return;
+ }
+ }
+ else
{
CPLError( CE_Failure, CPLE_AppDefined,
- "Unable to copy JPEG2000 image into GeoRaster dataset.\n%s",
- ( ! poJP2Driver ) ?
- "No JPEG2000 capable driver (JP2OPENJPEG, JP2ECW, JP2MRSID, etc...) is available." :
- "One or several JPEG2000 capable drivers are available but the file could not be "
- "opened successfully." );
+ "Unable to copy JPEG2000 image within GeoRaster dataset.\n%s",
+ "No JPEG2000 capable driver (JP2OPENJPEG, "
+ "JP2ECW, JP2MRSID, etc...) is available." );
return;
}
@@ -707,7 +720,7 @@ boolean GeoRasterDataset::JPEG_CopyDirect( const char* pszJPGFilename,
OCILobLocator* poLocator;
poStmt = poConnection->CreateStatement( CPLSPrintf(
- "select rasterblock from %s where rasterid = %d "
+ "select rasterblock from %s where rasterid = %lld "
"and rownum = 1 for update",
poGeoRaster->sDataTable.c_str(),
poGeoRaster->nRasterId ) );
@@ -789,7 +802,7 @@ char** GeoRasterDataset::GetFileList()
{
CPLString osDSName;
- osDSName.Printf( "/vsiocilob/%s,%s,%s,%s,%d,noext",
+ osDSName.Printf( "/vsiocilob/%s,%s,%s,%s,%lld,noext",
this->poGeoRaster->poConnection->GetUser(),
this->poGeoRaster->poConnection->GetPassword(),
this->poGeoRaster->poConnection->GetServer(),
@@ -1177,7 +1190,7 @@ GDALDataset *GeoRasterDataset::Create( const char *pszFilename,
char szStringId[OWTEXT];
- strcpy( szStringId, CPLSPrintf( "georaster:%s,%s,%s,%s,%d",
+ strcpy( szStringId, CPLSPrintf( "georaster:%s,%s,%s,%s,%lld",
poGRW->poConnection->GetUser(),
poGRW->poConnection->GetPassword(),
poGRW->poConnection->GetServer(),
@@ -1212,7 +1225,7 @@ GDALDataset *GeoRasterDataset::Create( const char *pszFilename,
poGRD->poGeoRaster->SetGeoReference( atoi( pszFetched ) );
}
- poGRD->poGeoRaster->bGenSpatialIndex =
+ poGRD->poGeoRaster->bGenSpatialExtent =
CPLFetchBool( papszOptions, "SPATIALEXTENT", TRUE );
pszFetched = CSLFetchNameValue( papszOptions, "EXTENTSRID" );
@@ -1336,12 +1349,12 @@ GDALDataset *GeoRasterDataset::CreateCopy( const char* pszFilename,
adfTransform[5] == 1.0 ) )
{
poDstDS->SetGeoTransform( adfTransform );
- }
- }
- if( ! poDstDS->bForcedSRID ) /* forced by create option SRID */
- {
- poDstDS->SetProjection( poSrcDS->GetProjectionRef() );
+ if( ! poDstDS->bForcedSRID ) /* forced by create option SRID */
+ {
+ poDstDS->SetProjection( poSrcDS->GetProjectionRef() );
+ }
+ }
}
// --------------------------------------------------------------------
@@ -1727,7 +1740,7 @@ GDALDataset *GeoRasterDataset::CreateCopy( const char* pszFilename,
if( pfnProgress )
{
- CPLDebug("GEOR", "Output dataset: (georaster:%s/%s@%s,%s,%d) on %s%s,%s",
+ CPLDebug("GEOR", "Output dataset: (georaster:%s/%s@%s,%s,%lld) on %s%s,%s",
poDstDS->poGeoRaster->poConnection->GetUser(),
poDstDS->poGeoRaster->poConnection->GetPassword(),
poDstDS->poGeoRaster->poConnection->GetServer(),
@@ -1879,18 +1892,24 @@ const char* GeoRasterDataset::GetProjectionRef( void )
// Try to interpreter the WKT text
// --------------------------------------------------------------------
+ poGeoRaster->QueryWKText();
+
char* pszWKText = CPLStrdup( poGeoRaster->sWKText );
if( ! ( oSRS.importFromWkt( &pszWKText ) == OGRERR_NONE && oSRS.GetRoot() ) )
{
- return "";
+ return pszWKText;
}
// ----------------------------------------------------------------
- // Decorate with ORACLE Authority codes
+ // Decorate with Authority name
// ----------------------------------------------------------------
- oSRS.SetAuthority(oSRS.GetRoot()->GetValue(), "ORACLE", poGeoRaster->nSRID);
+ if( strlen(poGeoRaster->sAuthority) > 0 )
+ {
+ oSRS.SetAuthority(oSRS.GetRoot()->GetValue(),
+ poGeoRaster->sAuthority.c_str(), poGeoRaster->nSRID);
+ }
int nSpher = OWParseEPSG( oSRS.GetAttrValue("GEOGCS|DATUM|SPHEROID") );
@@ -2035,7 +2054,7 @@ CPLErr GeoRasterDataset::SetProjection( const char *pszProjString )
if( eOGRErr != OGRERR_NONE )
{
- poGeoRaster->SetGeoReference( DEFAULT_CRS );
+ poGeoRaster->SetGeoReference( UNKNOWN_CRS );
return CE_Failure;
}
diff --git a/frmts/georaster/georaster_priv.h b/frmts/georaster/georaster_priv.h
index 865f810..fa6036a 100644
--- a/frmts/georaster/georaster_priv.h
+++ b/frmts/georaster/georaster_priv.h
@@ -399,7 +399,7 @@ public:
bool HasColorMap( int nBand );
void GetColorMap( int nBand, GDALColorTable* poCT );
void SetColorMap( int nBand, GDALColorTable* poCT );
- void SetGeoReference( int nSRIDIn );
+ void SetGeoReference( long long nSRIDIn );
bool GetDataBlock(
int nBand,
int nLevel,
@@ -445,6 +445,7 @@ public:
void GetRPC();
void GetGCP();
void SetGCP( int nGCPCountIn, const GDAL_GCP *pasGCPListIn );
+ void QueryWKText();
public:
@@ -455,13 +456,13 @@ public:
CPLString sOwner;
CPLString sColumn;
CPLString sDataTable;
- int nRasterId;
+ long long nRasterId;
CPLString sWhere;
CPLString sValueAttributeTab;
- int nSRID;
- int nExtentSRID;
- bool bGenSpatialIndex;
+ long long nSRID;
+ long long nExtentSRID;
+ bool bGenSpatialExtent;
bool bCreateObjectTable;
CPLXMLNode* phMetadata;
CPLString sCellDepth;
diff --git a/frmts/georaster/georaster_rasterband.cpp b/frmts/georaster/georaster_rasterband.cpp
index 14478a1..bcae78c 100644
--- a/frmts/georaster/georaster_rasterband.cpp
+++ b/frmts/georaster/georaster_rasterband.cpp
@@ -35,7 +35,7 @@
#include "cpl_vsi.h"
#include "cpl_error.h"
-CPL_CVSID("$Id: georaster_rasterband.cpp 38020 2017-04-14 21:40:01Z rouault $");
+CPL_CVSID("$Id: georaster_rasterband.cpp 40616 2017-11-02 12:40:51Z ilucena $");
// ---------------------------------------------------------------------------
// GeoRasterRasterBand()
@@ -321,7 +321,7 @@ GDALColorInterp GeoRasterRasterBand::GetColorInterpretation()
}
else
{
- return GCI_GrayIndex;
+ return GCI_Undefined;
}
}
}
@@ -604,7 +604,7 @@ CPLErr GeoRasterRasterBand::SetDefaultRAT( const GDALRasterAttributeTable *poRAT
if( ! pszVATName )
{
pszVATName = CPLStrdup( CPLSPrintf(
- "RAT_%s_%d_%d",
+ "RAT_%s_%lld_%d",
poGeoRaster->sDataTable.c_str(),
poGeoRaster->nRasterId,
nBand ) );
diff --git a/frmts/georaster/georaster_wrapper.cpp b/frmts/georaster/georaster_wrapper.cpp
index 117935a..92bcdd3 100644
--- a/frmts/georaster/georaster_wrapper.cpp
+++ b/frmts/georaster/georaster_wrapper.cpp
@@ -34,7 +34,7 @@
#include "cpl_string.h"
#include "cpl_minixml.h"
-CPL_CVSID("$Id: georaster_wrapper.cpp 39643 2017-07-24 15:25:46Z ilucena $")
+CPL_CVSID("$Id: georaster_wrapper.cpp 40616 2017-11-02 12:40:51Z ilucena $")
// ---------------------------------------------------------------------------
// GeoRasterWrapper()
@@ -79,9 +79,9 @@ GeoRasterWrapper::GeoRasterWrapper() :
bUpdate = false;
bInitializeIO = false;
bFlushMetadata = false;
- nSRID = 0;
+ nSRID = DEFAULT_CRS;
nExtentSRID = 0;
- bGenSpatialIndex = false;
+ bGenSpatialExtent = false;
bCreateObjectTable = false;
nPyramidMaxLevel = 0;
nBlockCount = 0L;
@@ -340,7 +340,7 @@ GeoRasterWrapper* GeoRasterWrapper::Open( const char* pszStringId, bool bUpdate
if( OWIsNumeric( papszParam[4] ) )
{
poGRW->sDataTable = papszParam[3];
- poGRW->nRasterId = atoi( papszParam[4]);
+ poGRW->nRasterId = (long long) CPLAtoGIntBig( papszParam[4]);
break;
}
else
@@ -367,7 +367,7 @@ GeoRasterWrapper* GeoRasterWrapper::Open( const char* pszStringId, bool bUpdate
char szColumn[OWTEXT];
char szDataTable[OWCODE];
char szWhere[OWTEXT];
- int nRasterId = -1;
+ long long nRasterId = -1;
OCILobLocator* phLocator = NULL;
szOwner[0] = '\0';
@@ -404,11 +404,9 @@ GeoRasterWrapper* GeoRasterWrapper::Open( const char* pszStringId, bool bUpdate
}
OWStatement* poStmt = poGRW->poConnection->CreateStatement(
- "DECLARE\n"
- " SCM VARCHAR2(64) := 'xmlns=\"http://xmlns.oracle.com/spatial/georaster\"';\n"
"BEGIN\n"
"\n"
- " IF :datatable IS NOT NULL AND :rasterid IS NOT NULL THEN\n"
+ " IF :datatable IS NOT NULL AND :rasterid IS NOT NULL THEN\n"
"\n"
" EXECUTE IMMEDIATE\n"
" 'SELECT OWNER, TABLE_NAME, COLUMN_NAME\n"
@@ -492,7 +490,7 @@ GeoRasterWrapper* GeoRasterWrapper::Open( const char* pszStringId, bool bUpdate
poGRW->sDataTable = szDataTable;
poGRW->nRasterId = nRasterId;
poGRW->sWhere = CPLSPrintf(
- "T.%s.RASTERDATATABLE = UPPER('%s') AND T.%s.RASTERID = %d",
+ "T.%s.RASTERDATATABLE = UPPER('%s') AND T.%s.RASTERID = %lld",
poGRW->sColumn.c_str(),
poGRW->sDataTable.c_str(),
poGRW->sColumn.c_str(),
@@ -502,8 +500,12 @@ GeoRasterWrapper* GeoRasterWrapper::Open( const char* pszStringId, bool bUpdate
// Read Metadata XML in text
// -------------------------------------------------------------------
+ CPLPushErrorHandler( CPLQuietErrorHandler );
+
char* pszXML = poStmt->ReadCLob( phLocator );
+ CPLPopErrorHandler();
+
if( pszXML )
{
// -----------------------------------------------------------
@@ -570,7 +572,7 @@ bool GeoRasterWrapper::Create( char* pszDescription,
if ( nRasterId > 0 )
{
- strcpy( szRID, CPLSPrintf( "%d", nRasterId ) );
+ strcpy( szRID, CPLSPrintf( "%lld", nRasterId ) );
}
else
{
@@ -841,7 +843,7 @@ bool GeoRasterWrapper::Create( char* pszDescription,
// -----------------------------------------------------------
char szBindRDT[OWNAME];
- int nBindRID = 0;
+ long long nBindRID = 0;
szBindRDT[0] = '\0';
CPLString sObjectTable;
@@ -1136,9 +1138,9 @@ void GeoRasterWrapper::PrepareToOverwrite( void )
bUpdate = false;
bInitializeIO = false;
bFlushMetadata = false;
- nSRID = 0;
+ nSRID = DEFAULT_CRS;;
nExtentSRID = 0;
- bGenSpatialIndex = false;
+ bGenSpatialExtent = false;
bCreateObjectTable = false;
nPyramidMaxLevel = 0;
nBlockCount = 0L;
@@ -1183,7 +1185,7 @@ bool GeoRasterWrapper::Delete( void )
// SetGeoReference()
// ---------------------------------------------------------------------------
-void GeoRasterWrapper::SetGeoReference( int nSRIDIn )
+void GeoRasterWrapper::SetGeoReference( long long nSRIDIn )
{
nSRID = nSRIDIn;
@@ -1377,14 +1379,49 @@ void GeoRasterWrapper::GetRasterInfo( void )
}
// -------------------------------------------------------------------
- // Prepare to get Extents
+ // Prepare to get Spatial reference system
// -------------------------------------------------------------------
bIsReferenced = EQUAL( "TRUE", CPLGetXMLValue( phMetadata,
"spatialReferenceInfo.isReferenced", "FALSE" ) );
- nSRID = atoi( CPLGetXMLValue( phMetadata,
+ nSRID = (long long) CPLAtoGIntBig( CPLGetXMLValue( phMetadata,
"spatialReferenceInfo.SRID", "0" ) );
+
+ if( bIsReferenced == false || nSRID == 0 || nSRID == UNKNOWN_CRS )
+ {
+ return;
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// QueryWKText()
+// ---------------------------------------------------------------------------
+
+void GeoRasterWrapper::QueryWKText()
+{
+ char* pszWKText = (char*) VSI_MALLOC2_VERBOSE( sizeof(char), 3 * OWTEXT);
+ char* pszAuthority = (char*) VSI_MALLOC2_VERBOSE( sizeof(char), OWTEXT);
+
+ OWStatement* poStmt = poConnection->CreateStatement(
+ "select wktext, auth_name from mdsys.cs_srs "
+ "where srid = :1 and wktext is not null" );
+
+ poStmt->Bind( &nSRID );
+ poStmt->Define( pszWKText, 3 * OWTEXT );
+ poStmt->Define( pszAuthority, OWTEXT );
+
+ if( poStmt->Execute() )
+ {
+ sWKText = pszWKText;
+ sAuthority = pszAuthority;
+ }
+
+ CPLFree( pszWKText );
+ CPLFree( pszAuthority );
+
+ delete poStmt;
}
// ---------------------------------------------------------------------------
@@ -1888,7 +1925,7 @@ bool GeoRasterWrapper::GetDataBlock( int nBand,
nBytesRead = poBlockStmt->ReadBlob( pahLocator[nBlock],
pabyBlockBuf,
- static_cast<int>(nBlockBytes) );
+ nBlockBytes );
CPLDebug( "Load ", "Block = %4ld Size = %7ld", nBlock, nBlockBytes );
@@ -2062,7 +2099,7 @@ bool GeoRasterWrapper::SetDataBlock( int nBand,
nBytesRead = poBlockStmt->ReadBlob( pahLocator[nBlock],
pabyBlockBuf,
- static_cast<int>(nBlockBytes) );
+ static_cast<unsigned long>(nBlockBytes) );
CPLDebug( "Reload", "Block = %4ld Size = %7ld", nBlock, nBlockBytes );
@@ -2186,7 +2223,7 @@ bool GeoRasterWrapper::FlushBlock( long nCacheBlock )
if( ! poBlockStmt->WriteBlob( pahLocator[nCacheBlock],
pabyFlushBuffer,
- static_cast<int>(nFlushBlockSize) ) )
+ nFlushBlockSize ) )
{
return false;
}
@@ -3102,7 +3139,7 @@ bool GeoRasterWrapper::SetNoData( int nLayer, const char* pszValue )
strcpy( szRDT, sDataTable.c_str() );
strcpy( szNoData, pszValue );
- int nRID = nRasterId;
+ long long nRID = nRasterId;
// ------------------------------------------------------------
// Write the in memory XML metadata to avoid losing other changes.
@@ -3398,7 +3435,7 @@ bool GeoRasterWrapper::FlushMetadata()
if( phRPC )
{
SetRPC();
- nSRID = 0;
+ nSRID = NO_CRS;
}
// --------------------------------------------------------------------
@@ -3412,15 +3449,81 @@ bool GeoRasterWrapper::FlushMetadata()
return false;
}
- if( bGenSpatialIndex )
+ // --------------------------------------------------------------------
+ // Search for existing Spatial Index SRID
+ // --------------------------------------------------------------------
+
+ OWStatement* poStmt = (OWStatement*) 0;
+
+ if ( nSRID != UNKNOWN_CRS && bGenSpatialExtent )
{
- nExtentSRID = nExtentSRID == 0 ? nSRID : nExtentSRID;
+ long long nIdxSRID = -1;
+
+ poStmt = poConnection->CreateStatement( CPLSPrintf(
+ "DECLARE\n"
+ " IDX_SRID NUMBER;\n"
+ "BEGIN\n"
+ " BEGIN\n"
+ " EXECUTE IMMEDIATE \n"
+ " 'SELECT SRID FROM ALL_SDO_GEOM_METADATA ' || \n"
+ " 'WHERE OWNER = ''%s'' AND ' || \n"
+ " 'TABLE_NAME = ''%s'' AND ' || \n"
+ " 'COLUMN_NAME = ''%s'' || ''.SPATIALEXTENT'' '\n"
+ " INTO IDX_SRID;\n"
+ " EXCEPTION\n"
+ " WHEN NO_DATA_FOUND THEN\n"
+ " IDX_SRID := -1;\n"
+ " END;\n"
+ " :idx_srid := IDX_SRID;\n"
+ "END;",
+ sOwner.c_str(),
+ sTable.c_str(),
+ sColumn.c_str()));
+
+ poStmt->BindName( ":idx_srid", &nIdxSRID );
+
+ if( ! poStmt->Execute() )
+ {
+ nIdxSRID = -1;
+ }
+
+ if ( nIdxSRID != -1 )
+ {
+ if ( nExtentSRID == 0 )
+ {
+ nExtentSRID = nIdxSRID;
+ }
+ else
+ {
+ if ( nExtentSRID != nIdxSRID )
+ {
+ CPLError( CE_Warning, CPLE_AppDefined,
+ "Cannot generate spatialExtent, "
+ "Spatial Index SRID is (%lld)",
+ nIdxSRID );
+
+ nExtentSRID = 0;
+ }
+ }
+ }
+
+ delete poStmt;
+
+ CPLDebug("GEOR","nIdxSRID = %lld",nIdxSRID);
}
else
{
- nExtentSRID = 0; /* Set spatialExtent to null */
+ nExtentSRID = 0;
}
+ if ( nSRID == 0 || nSRID == UNKNOWN_CRS )
+ {
+ nExtentSRID = 0;
+ }
+
+ CPLDebug("GEOR","nExtentSRID = %lld",nExtentSRID);
+ CPLDebug("GEOR","nSRID = %lld",nSRID);
+
// --------------------------------------------------------------------
// Update GeoRaster Metadata
// --------------------------------------------------------------------
@@ -3429,7 +3532,7 @@ bool GeoRasterWrapper::FlushMetadata()
OCILobLocator* phLocator = NULL;
- OWStatement* poStmt = poConnection->CreateStatement( CPLSPrintf(
+ poStmt = poConnection->CreateStatement( CPLSPrintf(
"DECLARE\n"
" GR1 sdo_georaster;\n"
" GM1 sdo_geometry;\n"
@@ -3443,7 +3546,7 @@ bool GeoRasterWrapper::FlushMetadata()
" GR1.metadata := sys.xmltype.createxml(:3);\n"
"\n"
" IF SRID != 0 THEN\n"
- " SDO_GEOR.georeference( GR1, SRID, :4,"
+ " SDO_GEOR.georeference( GR1, SRID, :4, \n"
" SDO_NUMBER_ARRAY(:5, :6, :7), SDO_NUMBER_ARRAY(:8, :9, :10));\n"
" END IF;\n"
"\n"
@@ -3469,10 +3572,7 @@ bool GeoRasterWrapper::FlushMetadata()
" EXCEPTION\n"
" WHEN OTHERS THEN\n"
" :except := SQLCODE;\n"
- " IF (SQLCODE != -29877) THEN\n"
- " RAISE;\n"
- " END IF;\n"
- " END\n"
+ " END;\n"
"\n"
" COMMIT;\n"
"END;",
@@ -3516,7 +3616,7 @@ bool GeoRasterWrapper::FlushMetadata()
if( nException )
{
CPLError( CE_Warning, CPLE_AppDefined,
- "Cannot generate spatialExtent! (ORA-%d) ", nException );
+ "Fail to update GeoRaster Metadata (ORA-%d) ", nException );
}
if (bGenPyramid)
diff --git a/frmts/georaster/oci_wrapper.cpp b/frmts/georaster/oci_wrapper.cpp
index 3bfddb2..82f3bde 100644
--- a/frmts/georaster/oci_wrapper.cpp
+++ b/frmts/georaster/oci_wrapper.cpp
@@ -29,7 +29,7 @@
#include "oci_wrapper.h"
-CPL_CVSID("$Id: oci_wrapper.cpp 38020 2017-04-14 21:40:01Z rouault $");
+CPL_CVSID("$Id: oci_wrapper.cpp 40616 2017-11-02 12:40:51Z ilucena $")
static const OW_CellDepth ahOW_CellDepth[] = {
{"8BIT_U", GDT_Byte},
@@ -98,7 +98,7 @@ OWConnection::OWConnection( OCIExtProcContext* poWithContext )
szSchema[0] = '\0';
OWStatement* poStmt = CreateStatement(
- "select sys_context('userenv','current_user'),\n"
+ "select sys_context('userenv','session_user'),\n"
" sys_context('userenv','current_schema') || '.'\n"
"from dual\n" );
@@ -811,6 +811,29 @@ void OWStatement::Bind( long* pnData )
hError );
}
+void OWStatement::Bind( long long* pnData )
+{
+ OCIBind* hBind = NULL;
+
+ nNextBnd++;
+
+ CheckError( OCIBindByPos(
+ hStmt,
+ &hBind,
+ hError,
+ (ub4) nNextBnd,
+ (dvoid*) pnData,
+ (sb4) sizeof(long long),
+ (ub2) SQLT_INT,
+ (void*) NULL,
+ (ub2*) NULL,
+ (ub2*) NULL,
+ (ub4) 0,
+ (ub4*) NULL,
+ (ub4) OCI_DEFAULT ),
+ hError );
+}
+
void OWStatement::Bind( double* pnData )
{
OCIBind* hBind = NULL;
@@ -1008,6 +1031,25 @@ void OWStatement::Define( long* pnData )
(ub4) OCI_DEFAULT ), hError );
}
+void OWStatement::Define( long long* pnData )
+{
+ OCIDefine* hDefine = NULL;
+
+ nNextCol++;
+
+ CheckError( OCIDefineByPos( hStmt,
+ &hDefine,
+ hError,
+ (ub4) nNextCol,
+ (dvoid*) pnData,
+ (sb4) sizeof(long long),
+ (ub2) SQLT_INT,
+ (void*) NULL,
+ (ub2*) NULL,
+ (ub2*) NULL,
+ (ub4) OCI_DEFAULT ), hError );
+}
+
void OWStatement::Define( double* pfdData )
{
OCIDefine* hDefine = NULL;
@@ -1428,33 +1470,15 @@ unsigned long OWStatement::GetBlobLength( OCILobLocator* phLocator )
unsigned long OWStatement::ReadBlob( OCILobLocator* phLocator,
void* pBuffer,
- int nSize )
+ unsigned long nSize )
{
- ub4 nAmont = (ub4) 0;
-
- if( CheckError( OCILobRead(
- poConnection->hSvcCtx,
- hError,
- phLocator,
- (ub4*) &nAmont,
- (ub4) 1,
- (dvoid*) pBuffer,
- (ub4) nSize,
- (dvoid *) 0,
- (OCICallbackLobRead) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT), hError ) )
- {
- return 0;
- }
-
- return nAmont;
+ return ReadBlob( phLocator, pBuffer, (unsigned long) 1, nSize );
}
unsigned long OWStatement::ReadBlob( OCILobLocator* phLocator,
void* pBuffer,
- int nOffset,
- int nSize )
+ unsigned long nOffset,
+ unsigned long nSize )
{
ub8 nAmont = (ub8) nSize;
@@ -1463,12 +1487,12 @@ unsigned long OWStatement::ReadBlob( OCILobLocator* phLocator,
hError,
phLocator,
(ub8*) &nAmont,
- (ub8*) NULL,
+ (ub8*) 0,
(ub8) nOffset,
- (dvoid*) pBuffer,
+ (void*) pBuffer,
(ub8) nSize,
(ub1) OCI_ONE_PIECE,
- (dvoid *) 0,
+ (dvoid*) 0,
(OCICallbackLobRead2) 0,
(ub2) 0,
(ub1) SQLCS_IMPLICIT), hError ) )
@@ -1476,49 +1500,31 @@ unsigned long OWStatement::ReadBlob( OCILobLocator* phLocator,
return 0;
}
- return nAmont;
+ return (unsigned long) nAmont;
}
bool OWStatement::WriteBlob( OCILobLocator* phLocator,
void* pBuffer,
- int nSize )
+ unsigned long nSize )
{
- ub4 nAmont = (ub4) nSize;
-
- if( CheckError( OCILobWrite(
- poConnection->hSvcCtx,
- hError,
- phLocator,
- (ub4*) &nAmont,
- (ub4) 1,
- (dvoid*) pBuffer,
- (ub4) nSize,
- (ub1) OCI_ONE_PIECE,
- (dvoid*) NULL,
- NULL,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT ),
- hError ) )
- {
- return false;
- }
+ ub8 nAmont = WriteBlob( phLocator, pBuffer, (unsigned long) 1, nSize );
- return nAmont == (ub4) nSize;
+ return ( nAmont == (ub8) nSize );
}
-int OWStatement::WriteBlob( OCILobLocator* phLocator,
+unsigned long OWStatement::WriteBlob( OCILobLocator* phLocator,
void* pBuffer,
- int nOffset,
- int nSize )
+ unsigned long nOffset,
+ unsigned long nSize )
{
- ub8 nAmont = (ub8) nSize;
+ ub8 nAmont = (ub8) nSize;
if( CheckError( OCILobWrite2(
poConnection->hSvcCtx,
hError,
phLocator,
(ub8*) &nAmont,
- (ub8*) NULL,
+ (ub8*) 0,
(ub8) nOffset,
(dvoid*) pBuffer,
(ub8) nSize,
@@ -1528,11 +1534,12 @@ int OWStatement::WriteBlob( OCILobLocator* phLocator,
(ub2) 0,
(ub1) SQLCS_IMPLICIT ), hError ) )
{
- return 0;
+ return (unsigned long) 0;
}
return nAmont;
}
+
char* OWStatement::ReadCLob( OCILobLocator* phLocator )
{
ub4 nSize = 0;
@@ -1604,6 +1611,50 @@ void OWStatement::BindName( const char* pszName, int* pnData )
hError );
}
+void OWStatement::BindName( const char* pszName, long* pnData )
+{
+ OCIBind* hBind = NULL;
+
+ CheckError( OCIBindByName(
+ (OCIStmt*) hStmt,
+ (OCIBind**) &hBind,
+ (OCIError*) hError,
+ (text*) pszName,
+ (sb4) -1,
+ (dvoid*) pnData,
+ (sb4) sizeof(long),
+ (ub2) SQLT_INT,
+ (dvoid*) NULL,
+ (ub2*) NULL,
+ (ub2*) NULL,
+ (ub4) 0,
+ (ub4*) NULL,
+ (ub4) OCI_DEFAULT ),
+ hError );
+}
+
+void OWStatement::BindName( const char* pszName, long long* pnData )
+{
+ OCIBind* hBind = NULL;
+
+ CheckError( OCIBindByName(
+ (OCIStmt*) hStmt,
+ (OCIBind**) &hBind,
+ (OCIError*) hError,
+ (text*) pszName,
+ (sb4) -1,
+ (dvoid*) pnData,
+ (sb4) sizeof(long long),
+ (ub2) SQLT_INT,
+ (dvoid*) NULL,
+ (ub2*) NULL,
+ (ub2*) NULL,
+ (ub4) 0,
+ (ub4*) NULL,
+ (ub4) OCI_DEFAULT ),
+ hError );
+}
+
void OWStatement::BindName( const char* pszName, double* pnData )
{
OCIBind* hBind = NULL;
@@ -1733,6 +1784,46 @@ bool OWIsNumeric( const char *pszText )
}
/*****************************************************************************/
+/* Remove quotes */
+/*****************************************************************************/
+
+char *OWRemoveQuotes( const char* pszText )
+{
+ const size_t nSize = strlen(pszText);
+
+ if( nSize > 2 && pszText[0] != '"' && pszText[nSize - 1] != '"' )
+ {
+ return CPLStrdup( pszText );
+ }
+
+ char *pszResult
+ = reinterpret_cast<char*>( CPLMalloc(nSize - 1) );
+
+ CPLStrlcpy( pszResult, &pszText[1], nSize - 1);
+
+ return pszResult;
+}
+
+/*****************************************************************************/
+/* To upper if there is no quotes */
+/*****************************************************************************/
+
+void OWUpperIfNoQuotes( char* pszText )
+{
+ const size_t nSize = strlen( pszText );
+
+ if( nSize > 2 && pszText[0] == '"' && pszText[nSize - 1] == '"' )
+ {
+ return;
+ }
+
+ for( size_t i = 0; i < nSize; i++ )
+ {
+ pszText[i] = toupper( pszText[i] );
+ }
+}
+
+/*****************************************************************************/
/* Parse Value after a Hint on a string */
/*****************************************************************************/
static
diff --git a/frmts/georaster/oci_wrapper.h b/frmts/georaster/oci_wrapper.h
index 562027d..2daffc3 100644
--- a/frmts/georaster/oci_wrapper.h
+++ b/frmts/georaster/oci_wrapper.h
@@ -64,6 +64,8 @@ int OWParseServerVersion( const char* pszText );
int OWParseEPSG( const char* pszText );
bool OWIsNumeric( const char *pszText );
const char* OWParseSDO_GEOR_INIT( const char* pszInsert, int nField );
+char* OWRemoveQuotes( const char* pszText );
+void OWUpperIfNoQuotes( char* pszText );
/***************************************************************************/
/* Arbitrary limits */
@@ -381,6 +383,7 @@ public:
void Bind( int* pnData );
void Bind( long* pnData );
+ void Bind( long long* pnData );
void Bind( double* pnData );
void Bind( char* pData, long nData );
void Bind( sdo_geometry** pphData );
@@ -389,6 +392,7 @@ public:
void Bind( char* pszData, int nSize = OWNAME );
void Define( int* pnData );
void Define( long* pnData );
+ void Define( long long* pnData );
void Define( double* pnData );
void Define( char* pszData, int nSize = OWNAME );
void Define( OCILobLocator** pphLocator );
@@ -398,6 +402,8 @@ public:
void Define( sdo_pc** pphData );
void Define( OCILobLocator** pphLocator, long nIterations );
void BindName( const char* pszName, int* pnData );
+ void BindName( const char* pszName, long* pnData );
+ void BindName( const char* pszName, long long* pnData );
void BindName( const char* pszName, double* pnData );
void BindName( const char* pszName, char* pszData,
int nSize = OWNAME );
@@ -407,15 +413,17 @@ public:
static void Free( OCILobLocator** ppphLocator,
int nCount );
unsigned long ReadBlob( OCILobLocator* phLocator,
- void* pBuffer, int nSize );
+ void* pBuffer, unsigned long nSize );
unsigned long ReadBlob( OCILobLocator* phLocator,
- void* pBuffer, int nOffset, int nSize );
+ void* pBuffer, unsigned long nOffset,
+ unsigned long nSize );
char* ReadCLob( OCILobLocator* phLocator );
void WriteCLob( OCILobLocator** pphLocator, char* pszData );
bool WriteBlob( OCILobLocator* phLocator,
- void* pBuffer, int nSize );
- int WriteBlob( OCILobLocator* phLocator,
- void* pBuffer, int nOffset, int nSize );
+ void* pBuffer, unsigned long nSize );
+ unsigned long WriteBlob( OCILobLocator* phLocator,
+ void* pBuffer, unsigned long nOffset,
+ unsigned long nSize );
int GetElement( OCIArray** ppoData,
int nIndex, int* pnResult );
double GetElement( OCIArray** ppoData,
diff --git a/frmts/grib/gribdataset.cpp b/frmts/grib/gribdataset.cpp
index cef1a99..dfb1dd3 100644
--- a/frmts/grib/gribdataset.cpp
+++ b/frmts/grib/gribdataset.cpp
@@ -64,7 +64,7 @@
#include "gdal_priv.h"
#include "ogr_spatialref.h"
-CPL_CVSID("$Id: gribdataset.cpp 38010 2017-04-14 15:07:56Z rouault $");
+CPL_CVSID("$Id: gribdataset.cpp 40507 2017-10-20 12:22:11Z rouault $");
static CPLMutex *hGRIBMutex = NULL;
@@ -850,6 +850,27 @@ void GRIBDataset::SetGribMetaData(grib_MetaData *meta)
if (rPixelSizeY < 0 || fabs(rPixelSizeY - meta->gds.Dy) > 0.002)
rPixelSizeY = meta->gds.Dy;
+
+ // Longitude origin of GRIB files is sometimes funny. Try to shift as close
+ // as possible to the traditionnal [-180,180] longitude range
+ // See https://trac.osgeo.org/gdal/ticket/7103
+ if( rMinX >= 179 && rPixelSizeX * meta->gds.Nx > 10 )
+ {
+ const char* pszAdjustLongRange =
+ CPLGetConfigOption("GRIB_ADJUST_LONGITUDE_RANGE", NULL);
+ if( pszAdjustLongRange == NULL )
+ {
+ CPLDebug("GRIB", "Longitude range is unusual. To shift it closer "
+ "to [-180,180], set the GRIB_ADJUST_LONGITUDE_RANGE "
+ "configuration option to YES");
+ }
+ else if( CPLTestBool(pszAdjustLongRange) )
+ {
+ CPLDebug("GRIB", "Adjusting longitude origin from %f to %f",
+ rMinX - rPixelSizeX / 2, rMinX - rPixelSizeX / 2 - 360 );
+ rMinX -= 360;
+ }
+ }
}
// http://gdal.org/gdal_datamodel.html :
diff --git a/frmts/gsg/gsagdataset.cpp b/frmts/gsg/gsagdataset.cpp
index 9e419cc..38d6784 100644
--- a/frmts/gsg/gsagdataset.cpp
+++ b/frmts/gsg/gsagdataset.cpp
@@ -38,7 +38,7 @@
#include "gdal_frmts.h"
#include "gdal_pam.h"
-CPL_CVSID("$Id: gsagdataset.cpp 39765 2017-08-07 11:11:09Z rouault $");
+CPL_CVSID("$Id: gsagdataset.cpp 40525 2017-10-22 13:13:59Z rouault $");
#ifndef DBL_MAX
# ifdef __DBL_MAX__
@@ -364,7 +364,7 @@ CPLErr GSAGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
/* No number found */
if( *szStart == '.' )
{
- CPLError( CE_Warning, CPLE_FileIO,
+ CPLError( CE_Failure, CPLE_FileIO,
"Unexpected value in grid row %d (expected floating "
"point value, found \"%s\").\n",
nBlockYOff, szStart );
@@ -375,7 +375,8 @@ CPLErr GSAGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
/* Found sign at end of input, seek back to re-read it */
bool bOnlySign = false;
- if ( (*szStart == '-' || *szStart == '+') && *(szStart+1) == '\0' )
+ if ( (*szStart == '-' || *szStart == '+') &&
+ static_cast<size_t>(szStart + 1 - szLineBuf) == nCharsRead )
{
if( VSIFSeekL( poGDS->fp,
VSIFTellL( poGDS->fp)-1,
@@ -465,7 +466,7 @@ CPLErr GSAGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
"Unexpected ASCII null-character in grid row %d at "
"offset %ld.\n",
nBlockYOff,
- (long) (szStart - szLineBuf) );
+ (long) (szEnd - szLineBuf) );
while( *szEnd == '\0' &&
static_cast<size_t>(szEnd - szLineBuf) < nCharsRead )
@@ -533,8 +534,22 @@ CPLErr GSAGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
nMaxLineSize = nCharsExamined + 1;
if( nBlockYOff > 0 )
- panLineOffset[nBlockYOff - 1] =
+ {
+ vsi_l_offset nNewOffset =
panLineOffset[nBlockYOff] + nCharsExamined;
+ if( panLineOffset[nBlockYOff - 1] == 0 )
+ {
+ panLineOffset[nBlockYOff - 1] = nNewOffset;
+ }
+ else if( panLineOffset[nBlockYOff - 1] != nNewOffset )
+ {
+ CPLError(CE_Failure, CPLE_AppDefined,
+ "Coding error: previous offset for line %d was "
+ CPL_FRMT_GUIB ", new offset would be " CPL_FRMT_GUIB,
+ nBlockYOff - 1,
+ panLineOffset[nBlockYOff - 1], nNewOffset );
+ }
+ }
nLastReadLine = nBlockYOff;
diff --git a/frmts/gtiff/geotiff.cpp b/frmts/gtiff/geotiff.cpp
index d7d717c..bd7ccd0 100644
--- a/frmts/gtiff/geotiff.cpp
+++ b/frmts/gtiff/geotiff.cpp
@@ -106,7 +106,7 @@
#include "xtiffio.h"
-CPL_CVSID("$Id: geotiff.cpp 39804 2017-08-13 13:15:08Z rouault $");
+CPL_CVSID("$Id: geotiff.cpp 40691 2017-11-11 16:25:25Z rouault $");
#if SIZEOF_VOIDP == 4
static bool bGlobalStripIntegerOverflow = false;
@@ -5637,6 +5637,45 @@ CPLErr GTiffRGBABand::IReadBlock( int nBlockXOff, int nBlockYOff,
const int nBlockBufSize = 4 * nBlockXSize * nBlockYSize;
const int nBlockId = nBlockXOff + nBlockYOff * nBlocksPerRow;
+#ifdef INTERNAL_LIBTIFF
+ if( poGDS->nCompression == COMPRESSION_OJPEG )
+ {
+ // Need to fetch all offsets for Old-JPEG compression
+ if( poGDS->pabyBlockBuf == NULL )
+ {
+ toff_t *panByteCounts = NULL;
+ toff_t *panOffsets = NULL;
+ const bool bIsTiled = CPL_TO_BOOL( TIFFIsTiled(poGDS->hTIFF) );
+
+ if( bIsTiled )
+ {
+ TIFFGetField( poGDS->hTIFF, TIFFTAG_TILEBYTECOUNTS, &panByteCounts );
+ TIFFGetField( poGDS->hTIFF, TIFFTAG_TILEOFFSETS, &panOffsets );
+ }
+ else
+ {
+ TIFFGetField( poGDS->hTIFF, TIFFTAG_STRIPBYTECOUNTS, &panByteCounts );
+ TIFFGetField( poGDS->hTIFF, TIFFTAG_STRIPOFFSETS, &panOffsets );
+ }
+ }
+ }
+#endif
+
+ if( poGDS->nPlanarConfig == PLANARCONFIG_SEPARATE )
+ {
+ for( int iBand = 0; iBand < poGDS->nSamplesPerPixel; iBand ++ )
+ {
+ int nBlockIdBand = nBlockId + iBand * poGDS->nBlocksPerBand;
+ if( !poGDS->IsBlockAvailable(nBlockIdBand) )
+ return CE_Failure;
+ }
+ }
+ else
+ {
+ if( !poGDS->IsBlockAvailable(nBlockId) )
+ return CE_Failure;
+ }
+
/* -------------------------------------------------------------------- */
/* Allocate a temporary buffer for this strip. */
/* -------------------------------------------------------------------- */
@@ -10591,7 +10630,8 @@ void GTiffDataset::WriteRPC( GDALDataset *poSrcDS, TIFF *l_hTIFF,
/************************************************************************/
static bool IsStandardColorInterpretation(GDALDataset* poSrcDS,
- uint16 nPhotometric)
+ uint16 nPhotometric,
+ char** papszCreationOptions)
{
bool bStardardColorInterp = true;
if( nPhotometric == PHOTOMETRIC_MINISBLACK )
@@ -10610,7 +10650,18 @@ static bool IsStandardColorInterpretation(GDALDataset* poSrcDS,
}
else if( nPhotometric == PHOTOMETRIC_RGB )
{
- for( int i = 0; i < poSrcDS->GetRasterCount(); ++i )
+ int iStart = 0;
+ if( EQUAL(CSLFetchNameValueDef(papszCreationOptions,
+ "PHOTOMETRIC", ""), "RGB") )
+ {
+ iStart = 3;
+ if( poSrcDS->GetRasterCount() == 4 &&
+ CSLFetchNameValue(papszCreationOptions, "ALPHA") != NULL )
+ {
+ iStart = 4;
+ }
+ }
+ for( int i = iStart; i < poSrcDS->GetRasterCount(); ++i )
{
const GDALColorInterp eInterp =
poSrcDS->GetRasterBand(i+1)->GetColorInterpretation();
@@ -10692,7 +10743,8 @@ bool GTiffDataset::WriteMetadata( GDALDataset *poSrcDS, TIFF *l_hTIFF,
nPhotometric = PHOTOMETRIC_MINISBLACK;
const bool bStardardColorInterp =
- IsStandardColorInterpretation(poSrcDS, nPhotometric);
+ IsStandardColorInterpretation(poSrcDS, nPhotometric,
+ l_papszCreationOptions);
/* -------------------------------------------------------------------- */
/* We also need to address band specific metadata, and special */
@@ -10750,7 +10802,9 @@ bool GTiffDataset::WriteMetadata( GDALDataset *poSrcDS, TIFF *l_hTIFF,
"description", "" );
}
- if( !bStardardColorInterp )
+ if( !bStardardColorInterp &&
+ !(nBand <= 3 && EQUAL(CSLFetchNameValueDef(
+ l_papszCreationOptions, "PHOTOMETRIC", ""), "RGB") ) )
{
AppendMetadataItem( &psRoot, &psTail, "COLORINTERP",
GDALGetColorInterpretationName(
@@ -10849,7 +10903,7 @@ void GTiffDataset::PushMetadataToPam()
{
const bool bStardardColorInterp =
- IsStandardColorInterpretation(this, nPhotometric);
+ IsStandardColorInterpretation(this, nPhotometric, papszCreationOptions);
for( int nBand = 0; nBand <= GetRasterCount(); ++nBand )
{
@@ -16370,6 +16424,25 @@ GTiffDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
{
nCloneInfoFlags &= ~GCIF_COLORINTERP;
}
+ // Ignore source band color interpretation if requesting PHOTOMETRIC=RGB
+ else if( l_nBands >= 3 &&
+ EQUAL(CSLFetchNameValueDef(papszOptions, "PHOTOMETRIC", ""), "RGB") )
+ {
+ for( int i = 1; i <= 3; i++)
+ {
+ poDS->GetRasterBand(i)->SetColorInterpretation(
+ static_cast<GDALColorInterp>(GCI_RedBand + (i-1)));
+ }
+ nCloneInfoFlags &= ~GCIF_COLORINTERP;
+ if( !(l_nBands == 4 && CSLFetchNameValue(papszOptions, "ALPHA") != NULL) )
+ {
+ for( int i = 4; i <= l_nBands; i++)
+ {
+ poDS->GetRasterBand(i)->SetColorInterpretation(
+ poSrcDS->GetRasterBand(i)->GetColorInterpretation());
+ }
+ }
+ }
poDS->CloneInfo( poSrcDS, nCloneInfoFlags );
poDS->papszCreationOptions = CSLDuplicate( papszOptions );
diff --git a/frmts/gtiff/gt_wkt_srs.cpp b/frmts/gtiff/gt_wkt_srs.cpp
index a245a9f..b96ccad 100644
--- a/frmts/gtiff/gt_wkt_srs.cpp
+++ b/frmts/gtiff/gt_wkt_srs.cpp
@@ -66,7 +66,7 @@
#include "tifvsi.h"
#include "xtiffio.h"
-CPL_CVSID("$Id: gt_wkt_srs.cpp 39898 2017-08-21 23:08:19Z rouault $")
+CPL_CVSID("$Id: gt_wkt_srs.cpp 40684 2017-11-10 21:36:26Z rouault $")
static const geokey_t ProjLinearUnitsInterpCorrectGeoKey =
static_cast<geokey_t>(3059);
@@ -763,17 +763,6 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
CPLFree( pszPMName );
CPLFree( pszAngularUnits );
-#if LIBGEOTIFF_VERSION >= 1310 && !defined(GEO_NORMALIZE_DISABLE_TOWGS84)
- if( psDefn->TOWGS84Count > 0 )
- oSRS.SetTOWGS84( psDefn->TOWGS84[0],
- psDefn->TOWGS84[1],
- psDefn->TOWGS84[2],
- psDefn->TOWGS84[3],
- psDefn->TOWGS84[4],
- psDefn->TOWGS84[5],
- psDefn->TOWGS84[6] );
-#endif
-
/* -------------------------------------------------------------------- */
/* Set projection units if not yet done */
/* -------------------------------------------------------------------- */
@@ -858,6 +847,57 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
}
}
+#if LIBGEOTIFF_VERSION >= 1310 && !defined(GEO_NORMALIZE_DISABLE_TOWGS84)
+ if( psDefn->TOWGS84Count > 0 )
+ {
+ if( bGotFromEPSG )
+ {
+ double adfTOWGS84[7] = { 0.0 };
+ oSRS.GetTOWGS84( adfTOWGS84 );
+ bool bSame = true;
+ for( int i = 0; i < 7; i++ )
+ {
+ if( fabs(adfTOWGS84[i] - psDefn->TOWGS84[i]) > 1e-5 )
+ {
+ bSame = false;
+ break;
+ }
+ }
+ if( !bSame )
+ {
+ CPLDebug( "GTiff",
+ "Modify EPSG:%d to have "
+ "TOWGS84=%f,%f,%f,%f,%f,%f,%f "
+ "coming from GeogTOWGS84GeoKey, instead of "
+ "%f,%f,%f,%f,%f,%f,%f coming from EPSG",
+ psDefn->PCS,
+ psDefn->TOWGS84[0],
+ psDefn->TOWGS84[1],
+ psDefn->TOWGS84[2],
+ psDefn->TOWGS84[3],
+ psDefn->TOWGS84[4],
+ psDefn->TOWGS84[5],
+ psDefn->TOWGS84[6],
+ adfTOWGS84[0],
+ adfTOWGS84[1],
+ adfTOWGS84[2],
+ adfTOWGS84[3],
+ adfTOWGS84[4],
+ adfTOWGS84[5],
+ adfTOWGS84[6] );
+ }
+ }
+
+ oSRS.SetTOWGS84( psDefn->TOWGS84[0],
+ psDefn->TOWGS84[1],
+ psDefn->TOWGS84[2],
+ psDefn->TOWGS84[3],
+ psDefn->TOWGS84[4],
+ psDefn->TOWGS84[5],
+ psDefn->TOWGS84[6] );
+ }
+#endif
+
/* ==================================================================== */
/* Handle projection parameters. */
/* ==================================================================== */
diff --git a/frmts/gtiff/libtiff/tif_jpeg.c b/frmts/gtiff/libtiff/tif_jpeg.c
index 1553e86..2c8e7a9 100644
--- a/frmts/gtiff/libtiff/tif_jpeg.c
+++ b/frmts/gtiff/libtiff/tif_jpeg.c
@@ -2310,12 +2310,22 @@ static int JPEGInitializeLibJPEG( TIFF * tif, int decompress )
#ifndef TIFF_JPEG_MAX_MEMORY_TO_USE
#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
#endif
- /* Increase the max memory usable. This helps when creating files */
- /* with "big" tile, without using libjpeg temporary files. */
- /* For example a 512x512 tile with 3 bands */
- /* requires 1.5 MB which is above libjpeg 1MB default */
- if( sp->cinfo.c.mem->max_memory_to_use < TIFF_JPEG_MAX_MEMORY_TO_USE )
- sp->cinfo.c.mem->max_memory_to_use = TIFF_JPEG_MAX_MEMORY_TO_USE;
+ /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */
+ /* store implementation, so better not set max_memory_to_use ourselves. */
+ /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */
+ if( sp->cinfo.c.mem->max_memory_to_use > 0 )
+ {
+ /* This is to address bug related in ticket GDAL #1795. */
+ if (getenv("JPEGMEM") == NULL)
+ {
+ /* Increase the max memory usable. This helps when creating files */
+ /* with "big" tile, without using libjpeg temporary files. */
+ /* For example a 512x512 tile with 3 bands */
+ /* requires 1.5 MB which is above libjpeg 1MB default */
+ if( sp->cinfo.c.mem->max_memory_to_use < TIFF_JPEG_MAX_MEMORY_TO_USE )
+ sp->cinfo.c.mem->max_memory_to_use = TIFF_JPEG_MAX_MEMORY_TO_USE;
+ }
+ }
}
sp->cinfo_initialized = TRUE;
diff --git a/frmts/jp2kak/jp2kak.lst b/frmts/jp2kak/jp2kak.lst
index 440ea79..c13f278 100644
--- a/frmts/jp2kak/jp2kak.lst
+++ b/frmts/jp2kak/jp2kak.lst
@@ -42,3 +42,9 @@ KAK_OBJ += \
$(KAKDIR)/apps/make/avx2_region_compositor.o \
$(KAKDIR)/apps/make/avx2_vex_transfer.o
endif
+
+# The following are for Kakadu 7.A and later.
+ifneq ($(wildcard $(KAKDIR)/apps/make/supp_local.o),)
+KAK_OBJ += \
+ $(KAKDIR)/apps/make/supp_local.o
+endif
diff --git a/frmts/jp2kak/jp2kakdataset.cpp b/frmts/jp2kak/jp2kakdataset.cpp
index 6d0a7ad..20db35e 100644
--- a/frmts/jp2kak/jp2kakdataset.cpp
+++ b/frmts/jp2kak/jp2kakdataset.cpp
@@ -53,7 +53,7 @@
#include <cmath>
#include <vector>
-CPL_CVSID("$Id: jp2kakdataset.cpp 38086 2017-04-21 14:34:14Z rouault $");
+CPL_CVSID("$Id: jp2kakdataset.cpp 40766 2017-11-20 10:19:39Z rouault $");
// Before v7.5 Kakadu does not advertise its version well
// After v7.5 Kakadu has KDU_{MAJOR,MINOR,PATCH}_VERSION defines so it's easier
@@ -1750,23 +1750,26 @@ CPLErr JP2KAKDataset::IRasterIO( GDALRWFlag eRWFlag,
/* Write out the passed box and delete it. */
/************************************************************************/
-static void JP2KAKWriteBox( jp2_target *jp2_out, GDALJP2Box *poBox )
+static void JP2KAKWriteBox( jp2_family_tgt *jp2_family, GDALJP2Box *poBox )
{
if( poBox == NULL )
return;
+ jp2_output_box jp2_out;
+
GUInt32 nBoxType = 0;
memcpy(&nBoxType, poBox->GetType(), sizeof(nBoxType));
CPL_MSBPTR32(&nBoxType);
- // Write to a box on the JP2 file.
- jp2_out->open_next(nBoxType);
-
- jp2_out->write(const_cast<kdu_byte *>(poBox->GetWritableData()),
- static_cast<int>(poBox->GetDataLength()));
+ int length = static_cast<int>(poBox->GetDataLength());
- jp2_out->close();
+ // Write to a box on the JP2 file.
+ jp2_out.open(jp2_family, nBoxType);
+ jp2_out.set_target_size(length);
+ jp2_out.write(const_cast<kdu_byte *>(poBox->GetWritableData()),
+ length);
+ jp2_out.close();
delete poBox;
}
@@ -2506,16 +2509,41 @@ JP2KAKCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
{
const char *pszGMLJP2V2Def =
CSLFetchNameValue(papszOptions, "GMLJP2V2_DEF");
- if( pszGMLJP2V2Def != NULL )
- JP2KAKWriteBox(
- &jp2_out,
- oJP2MD.CreateGMLJP2V2(
- nXSize,nYSize,pszGMLJP2V2Def,poSrcDS) );
- else
- JP2KAKWriteBox(&jp2_out, oJP2MD.CreateGMLJP2(nXSize, nYSize));
+ GDALJP2Box* poBox;
+ if( pszGMLJP2V2Def != NULL ) {
+ poBox = oJP2MD.CreateGMLJP2V2(
+ nXSize,nYSize,pszGMLJP2V2Def,poSrcDS);
+ } else {
+ poBox = oJP2MD.CreateGMLJP2(nXSize, nYSize);
+ }
+ try
+ {
+ JP2KAKWriteBox(&family, poBox);
+ }
+ catch( ... )
+ {
+ CPLDebug("JP2KAK", "JP2KAKWriteBox) - caught exception.");
+ oCodeStream.destroy();
+ CPLFree(layer_bytes);
+ delete poBox;
+ return NULL;
+ }
+ }
+ if( CPLFetchBool(papszOptions, "GeoJP2", true) ) {
+ GDALJP2Box* poBox = oJP2MD.CreateJP2GeoTIFF();
+ try
+ {
+ JP2KAKWriteBox(&family, poBox);
+ }
+ catch( ... )
+ {
+ CPLDebug("JP2KAK", "JP2KAKWriteBox) - caught exception.");
+ oCodeStream.destroy();
+ CPLFree(layer_bytes);
+ delete poBox;
+ return NULL;
+ }
}
- if( CPLFetchBool(papszOptions, "GeoJP2", true) )
- JP2KAKWriteBox(&jp2_out, oJP2MD.CreateJP2GeoTIFF());
}
// Do we have any XML boxes we want to preserve?
@@ -2534,7 +2562,7 @@ JP2KAKCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
poXMLBox->SetType("xml ");
poXMLBox->SetWritableData(static_cast<int>(strlen(papszMD[0]) + 1),
reinterpret_cast<GByte *>(papszMD[0]));
- JP2KAKWriteBox(&jp2_out, poXMLBox);
+ JP2KAKWriteBox(&family, poXMLBox);
}
// Open codestream box.
diff --git a/frmts/jpeg/jpgdataset.cpp b/frmts/jpeg/jpgdataset.cpp
index 7f68967..8b2dfa8 100644
--- a/frmts/jpeg/jpgdataset.cpp
+++ b/frmts/jpeg/jpgdataset.cpp
@@ -69,7 +69,7 @@ CPL_C_END
#include "memdataset.h"
#include "vsidataio.h"
-CPL_CVSID("$Id: jpgdataset.cpp 37527 2017-02-28 23:13:34Z rouault $");
+CPL_CVSID("$Id: jpgdataset.cpp 40473 2017-10-17 19:07:17Z rouault $");
static const int TIFF_VERSION = 42;
@@ -3169,14 +3169,20 @@ JPGDataset::CreateCopyStage2( const char *pszFilename, GDALDataset *poSrcDS,
jpeg_set_defaults(&sCInfo);
- // This is to address bug related in ticket #1795.
- if (CPLGetConfigOption("JPEGMEM", NULL) == NULL)
+ // libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing
+ // store implementation, so better not set max_memory_to_use ourselves.
+ // See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162
+ if( sCInfo.mem->max_memory_to_use > 0 )
{
- // If the user doesn't provide a value for JPEGMEM, we want to be sure
- // that at least 500 MB will be used before creating the temporary file.
- const long nMinMemory = 500 * 1024 * 1024;
- sCInfo.mem->max_memory_to_use =
- std::max(sCInfo.mem->max_memory_to_use, nMinMemory);
+ // This is to address bug related in ticket #1795.
+ if (CPLGetConfigOption("JPEGMEM", NULL) == NULL)
+ {
+ // If the user doesn't provide a value for JPEGMEM, we want to be sure
+ // that at least 500 MB will be used before creating the temporary file.
+ const long nMinMemory = 500 * 1024 * 1024;
+ sCInfo.mem->max_memory_to_use =
+ std::max(sCInfo.mem->max_memory_to_use, nMinMemory);
+ }
}
if( eDT == GDT_UInt16 )
diff --git a/frmts/netcdf/netcdfdataset.cpp b/frmts/netcdf/netcdfdataset.cpp
index ddb96b3..a542af3 100644
--- a/frmts/netcdf/netcdfdataset.cpp
+++ b/frmts/netcdf/netcdfdataset.cpp
@@ -62,7 +62,7 @@
#include "ogr_core.h"
#include "ogr_srs_api.h"
-CPL_CVSID("$Id: netcdfdataset.cpp 39627 2017-07-22 17:59:00Z rouault $");
+CPL_CVSID("$Id: netcdfdataset.cpp 40424 2017-10-13 14:32:37Z rouault $");
// Internal function declarations.
@@ -376,47 +376,69 @@ netCDFRasterBand::netCDFRasterBand( netCDFDataset *poNCDFDS,
else
bSignedData = true;
- // For NC4 format NC_BYTE is signed, NC_UBYTE is unsigned.
+ // For NC4 format NC_BYTE is (normally) signed, NC_UBYTE is unsigned.
+ // But in case a NC3 file was converted automatically and has hints
+ // that it is unsigned, take them into account
if( poNCDFDS->eFormat == NCDF_FORMAT_NC4 )
{
bSignedData = true;
}
- else
+
+ // Fix nodata value as it was stored signed.
+ if( !bSignedData && dfNoData < 0 )
{
- // If we got valid_range, test for signed/unsigned range.
- // http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Attribute-Conventions.html
- if( bGotValidRange )
+ dfNoData += 256;
+ }
+
+ // If we got valid_range, test for signed/unsigned range.
+ // http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Attribute-Conventions.html
+ if( bGotValidRange )
+ {
+ // If we got valid_range={0,255}, treat as unsigned.
+ if( adfValidRange[0] == 0 && adfValidRange[1] == 255 )
{
- // If we got valid_range={0,255}, treat as unsigned.
- if( (adfValidRange[0] == 0) && (adfValidRange[1] == 255) )
+ bSignedData = false;
+ // Fix nodata value as it was stored signed.
+ if( !bSignedData && dfNoData < 0 )
{
- bSignedData = false;
- // Reset valid_range.
- adfValidRange[0] = dfNoData;
- adfValidRange[1] = dfNoData;
+ dfNoData += 256;
}
- // If we got valid_range={-128,127}, treat as signed.
- else if( (adfValidRange[0] == -128) &&
- (adfValidRange[1] == 127) )
- {
+
+ // Reset valid_range.
+ adfValidRange[0] = dfNoData;
+ adfValidRange[1] = dfNoData;
+ }
+ // If we got valid_range={-128,127}, treat as signed.
+ else if( adfValidRange[0] == -128 && adfValidRange[1] == 127 )
+ {
+ bSignedData = true;
+ // Reset valid_range.
+ adfValidRange[0] = dfNoData;
+ adfValidRange[1] = dfNoData;
+ }
+ }
+ // Else test for _Unsigned.
+ // http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html
+ else
+ {
+ char *pszTemp = NULL;
+ if( NCDFGetAttr(cdfid, nZId, "_Unsigned", &pszTemp) == CE_None )
+ {
+ if( EQUAL(pszTemp, "true") )
+ bSignedData = false;
+ else if( EQUAL(pszTemp, "false") )
bSignedData = true;
- // Reset valid_range.
- adfValidRange[0] = dfNoData;
- adfValidRange[1] = dfNoData;
- }
+ CPLFree(pszTemp);
}
- // Else test for _Unsigned.
- // http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html
- else
+
+ // Fix nodata value as it was stored signed.
+ if( !bSignedData && dfNoData < 0 )
{
- char *pszTemp = NULL;
- if( NCDFGetAttr(cdfid, nZId, "_Unsigned", &pszTemp) == CE_None )
+ dfNoData += 256;
+ if( !bGotValidRange )
{
- if( EQUAL(pszTemp, "true") )
- bSignedData = false;
- else if( EQUAL(pszTemp, "false") )
- bSignedData = true;
- CPLFree(pszTemp);
+ adfValidRange[0] = dfNoData;
+ adfValidRange[1] = dfNoData;
}
}
}
@@ -427,12 +449,6 @@ netCDFRasterBand::netCDFRasterBand( netCDFDataset *poNCDFDS,
// See http://trac.osgeo.org/gdal/wiki/rfc14_imagestructure
SetMetadataItem("PIXELTYPE", "SIGNEDBYTE", "IMAGE_STRUCTURE");
}
- else
- {
- // Fix nodata value as it was stored signed.
- if( dfNoData < 0 )
- dfNoData += 256;
- }
}
#ifdef NETCDF_HAS_NC4
@@ -2007,7 +2023,17 @@ char **netCDFDataset::FetchStandardParallels( const char *pszGridMappingValue )
char **papszValues = NULL;
if( pszValue != NULL )
{
- papszValues = NCDFTokenizeArray(pszValue);
+ if( pszValue[0] != '{' && CPLString(pszValue).Trim().find(' ') != std::string::npos )
+ {
+ // Some files like ftp://data.knmi.nl/download/KNW-NetCDF-3D/1.0/noversion/2013/11/14/KNW-1.0_H37-ERA_NL_20131114.nc
+ // do not use standard formatting for arrays, but just space
+ // separated syntax
+ papszValues = CSLTokenizeString2(pszValue, " ", 0);
+ }
+ else
+ {
+ papszValues = NCDFTokenizeArray(pszValue);
+ }
}
// Try gdal tags.
else
@@ -2033,6 +2059,16 @@ char **netCDFDataset::FetchStandardParallels( const char *pszGridMappingValue )
}
/************************************************************************/
+/* IsDifferenceBelow() */
+/************************************************************************/
+
+static bool IsDifferenceBelow(double dfA, double dfB, double dfError)
+{
+ const double dfAbsDiff = fabs(dfA - dfB);
+ return dfAbsDiff <= dfError;
+}
+
+/************************************************************************/
/* SetProjectionFromVar() */
/************************************************************************/
void netCDFDataset::SetProjectionFromVar( int nVarId, bool bReadSRSOnly )
@@ -2943,9 +2979,6 @@ void netCDFDataset::SetProjectionFromVar( int nVarId, bool bReadSRSOnly )
CPLDebug("GDAL_netCDF", "setting WKT from CF");
SetProjection(pszTempProjection);
CPLFree(pszTempProjection);
-
- if( !bGotCfGT )
- CPLDebug("GDAL_netCDF", "got SRS but no geotransform from CF!");
}
// Is pixel spacing uniform across the map?
@@ -2985,9 +3018,14 @@ void netCDFDataset::SetProjectionFromVar( int nVarId, bool bReadSRSOnly )
pdfXCoord[xdim - 2], pdfXCoord[xdim - 1]);
#endif
- if( (abs(abs(nSpacingBegin) - abs(nSpacingLast)) <= 1) &&
- (abs(abs(nSpacingBegin) - abs(nSpacingMiddle)) <= 1) &&
- (abs(abs(nSpacingMiddle) - abs(nSpacingLast)) <= 1) )
+ const double dfSpacingBegin = nSpacingBegin;
+ const double dfSpacingMiddle = nSpacingMiddle;
+ const double dfSpacingLast = nSpacingLast;
+ // ftp://data.knmi.nl/download/KNW-NetCDF-3D/1.0/noversion/2013/11/14/KNW-1.0_H37-ERA_NL_20131114.nc
+ // requires a 2/1000 tolerance.
+ if( IsDifferenceBelow(dfSpacingBegin, dfSpacingLast, 2) &&
+ IsDifferenceBelow(dfSpacingBegin, dfSpacingMiddle, 2) &&
+ IsDifferenceBelow(dfSpacingMiddle, dfSpacingLast, 2) )
{
bLonSpacingOK = true;
}
@@ -3028,17 +3066,21 @@ void netCDFDataset::SetProjectionFromVar( int nVarId, bool bReadSRSOnly )
// For Latitude we allow an error of 0.1 degrees for gaussian
// gridding (only if this is not a projected SRS).
-
- if( (abs(abs(nSpacingBegin) - abs(nSpacingLast)) <= 1) &&
- (abs(abs(nSpacingBegin) - abs(nSpacingMiddle)) <= 1) &&
- (abs(abs(nSpacingMiddle) - abs(nSpacingLast)) <= 1) )
+ // Note: we use fabs() instead of abs() to avoid int32 overflow
+ // issues.
+ const double dfSpacingBegin = nSpacingBegin;
+ const double dfSpacingMiddle = nSpacingMiddle;
+ const double dfSpacingLast = nSpacingLast;
+ if( IsDifferenceBelow(dfSpacingBegin, dfSpacingLast, 2) &&
+ IsDifferenceBelow(dfSpacingBegin, dfSpacingMiddle, 2) &&
+ IsDifferenceBelow(dfSpacingMiddle, dfSpacingLast, 2) )
{
bLatSpacingOK = true;
}
else if( !oSRS.IsProjected() &&
- (((abs(abs(nSpacingBegin) - abs(nSpacingLast))) <= 100) &&
- ((abs(abs(nSpacingBegin) - abs(nSpacingMiddle))) <= 100) &&
- ((abs(abs(nSpacingMiddle) - abs(nSpacingLast))) <= 100)) )
+ (((fabs(fabs(dfSpacingBegin) - fabs(dfSpacingLast))) <= 100) &&
+ ((fabs(fabs(dfSpacingBegin) - fabs(dfSpacingMiddle))) <= 100) &&
+ ((fabs(fabs(dfSpacingMiddle) - fabs(dfSpacingLast))) <= 100)) )
{
bLatSpacingOK = true;
CPLError(CE_Warning, CPLE_AppDefined,
diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp
index 2805d98..6f83647 100644
--- a/frmts/openjpeg/openjpegdataset.cpp
+++ b/frmts/openjpeg/openjpegdataset.cpp
@@ -34,7 +34,9 @@
#pragma clang diagnostic ignored "-Wdocumentation"
#endif
-#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200
+#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20300
+#include <openjpeg-2.3/openjpeg.h>
+#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200
#include <openjpeg-2.2/openjpeg.h>
#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
#include <openjpeg-2.1/openjpeg.h>
@@ -59,7 +61,7 @@
#include <algorithm>
-CPL_CVSID("$Id: openjpegdataset.cpp 39926 2017-08-24 01:12:30Z rouault $");
+CPL_CVSID("$Id: openjpegdataset.cpp 40330 2017-10-05 12:56:50Z rouault $");
/************************************************************************/
/* JP2OpenJPEGDataset_ErrorCallback() */
diff --git a/frmts/pdf/pdfcreatecopy.cpp b/frmts/pdf/pdfcreatecopy.cpp
index 43c2849..e3aeef0 100644
--- a/frmts/pdf/pdfcreatecopy.cpp
+++ b/frmts/pdf/pdfcreatecopy.cpp
@@ -45,7 +45,7 @@
/* Cf PDF reference v1.7, Appendix C, page 993 */
#define MAXIMUM_SIZE_IN_UNITS 14400
-CPL_CVSID("$Id: pdfcreatecopy.cpp 37371 2017-02-13 11:41:59Z rouault $");
+CPL_CVSID("$Id: pdfcreatecopy.cpp 40417 2017-10-12 14:07:59Z rouault $");
#define PIXEL_TO_GEO_X(x,y) adfGeoTransform[0] + x * adfGeoTransform[1] + y * adfGeoTransform[2]
#define PIXEL_TO_GEO_Y(x,y) adfGeoTransform[3] + x * adfGeoTransform[4] + y * adfGeoTransform[5]
@@ -4486,12 +4486,12 @@ GDALDataset *GDALPDFCreateCopy( const char * pszFilename,
{
if( dfWidthInUserUnit >= dfHeightInUserUnit )
{
- dfDPI = (int)(0.5 + (double)nWidth / (MAXIMUM_SIZE_IN_UNITS -
+ dfDPI = ceil((double)nWidth / (MAXIMUM_SIZE_IN_UNITS -
(sMargins.nLeft + sMargins.nRight)) / USER_UNIT_IN_INCH);
}
else
{
- dfDPI = (int)(0.5 + (double)nHeight / (MAXIMUM_SIZE_IN_UNITS -
+ dfDPI = ceil((double)nHeight / (MAXIMUM_SIZE_IN_UNITS -
(sMargins.nBottom + sMargins.nTop)) / USER_UNIT_IN_INCH);
}
CPLDebug("PDF", "Adjusting DPI to %d so that page dimension in "
diff --git a/frmts/sentinel2/sentinel2dataset.cpp b/frmts/sentinel2/sentinel2dataset.cpp
index be303d9..b469d68 100644
--- a/frmts/sentinel2/sentinel2dataset.cpp
+++ b/frmts/sentinel2/sentinel2dataset.cpp
@@ -49,7 +49,7 @@
#define STARTS_WITH_CI(a,b) EQUALN(a,b,strlen(b))
#endif
-CPL_CVSID("$Id: sentinel2dataset.cpp 37145 2017-01-14 20:02:35Z rouault $");
+CPL_CVSID("$Id: sentinel2dataset.cpp 40547 2017-10-24 17:42:31Z rouault $");
CPL_C_START
// TODO: Leave this declaration while Sentinel2 folks use this as a
@@ -380,7 +380,9 @@ int SENTINEL2Dataset::Identify( GDALOpenInfo *poOpenInfo )
return FALSE;
/* Accept directly .zip as provided by https://scihub.esa.int/ */
- if( (STARTS_WITH_CI(pszJustFilename, "S2A_OPER_PRD_MSI") ||
+ if( (STARTS_WITH_CI(pszJustFilename, "S2A_MSIL1C_") ||
+ STARTS_WITH_CI(pszJustFilename, "S2B_MSIL1C_") ||
+ STARTS_WITH_CI(pszJustFilename, "S2A_OPER_PRD_MSI") ||
STARTS_WITH_CI(pszJustFilename, "S2B_OPER_PRD_MSI") ||
STARTS_WITH_CI(pszJustFilename, "S2A_USER_PRD_MSI") ||
STARTS_WITH_CI(pszJustFilename, "S2B_USER_PRD_MSI") ) &&
@@ -482,6 +484,25 @@ GDALDataset *SENTINEL2Dataset::Open( GDALOpenInfo * poOpenInfo )
GDALOpenInfo oOpenInfo(osFilename, GA_ReadOnly);
return Open(&oOpenInfo);
}
+ else if( (STARTS_WITH_CI(pszJustFilename, "S2A_MSIL1C_") ||
+ STARTS_WITH_CI(pszJustFilename, "S2B_MSIL1C_") ) &&
+ EQUAL(CPLGetExtension(pszJustFilename), "zip") )
+ {
+ CPLString osBasename(CPLGetBasename(pszJustFilename));
+ CPLString osFilename(poOpenInfo->pszFilename);
+ CPLString osSAFE(osBasename);
+ // S2B_MSIL1C_20171004T233419_N0206_R001_T54DWM_20171005T001811.SAFE.zip
+ // has .SAFE.zip extension, but other products have just a .zip
+ // extension. So for the subdir in the zip only add .SAFE when needed
+ if( !EQUAL(CPLGetExtension(osSAFE), "SAFE") )
+ osSAFE += ".SAFE";
+ osFilename = osFilename + "/" + osSAFE + "/MTD_MSIL1C.xml";
+ if( strncmp(osFilename, "/vsizip/", strlen("/vsizip/")) != 0 )
+ osFilename = "/vsizip/" + osFilename;
+ CPLDebug("SENTINEL2", "Trying %s", osFilename.c_str());
+ GDALOpenInfo oOpenInfo(osFilename, GA_ReadOnly);
+ return Open(&oOpenInfo);
+ }
const char* pszHeader = reinterpret_cast<const char*>(poOpenInfo->pabyHeader);
diff --git a/frmts/vrt/vrtrawrasterband.cpp b/frmts/vrt/vrtrawrasterband.cpp
index 24e07a5..3e17d6f 100644
--- a/frmts/vrt/vrtrawrasterband.cpp
+++ b/frmts/vrt/vrtrawrasterband.cpp
@@ -45,7 +45,7 @@
#include "gdal.h"
#include "gdal_priv.h"
-CPL_CVSID("$Id: vrtrawrasterband.cpp 37310 2017-02-06 11:42:54Z goatbar $");
+CPL_CVSID("$Id: vrtrawrasterband.cpp 40225 2017-09-26 21:19:15Z rouault $");
/*! @cond Doxygen_Suppress */
@@ -215,6 +215,7 @@ CPLErr VRTRawRasterBand::SetRawLink( const char *pszFilename,
/* -------------------------------------------------------------------- */
/* Try and open the file. We always use the large file API. */
/* -------------------------------------------------------------------- */
+ CPLPushErrorHandler(CPLQuietErrorHandler);
FILE *fp = CPLOpenShared( pszExpandedFilename, "rb+", TRUE );
if( fp == NULL )
@@ -225,6 +226,8 @@ CPLErr VRTRawRasterBand::SetRawLink( const char *pszFilename,
{
fp = CPLOpenShared( pszExpandedFilename, "wb+", TRUE );
}
+ CPLPopErrorHandler();
+ CPLErrorReset();
if( fp == NULL )
{
diff --git a/frmts/wcs/httpdriver.cpp b/frmts/wcs/httpdriver.cpp
index 679a69d..7a69648 100644
--- a/frmts/wcs/httpdriver.cpp
+++ b/frmts/wcs/httpdriver.cpp
@@ -33,7 +33,7 @@
#include "gdal_frmts.h"
#include "gdal_pam.h"
-CPL_CVSID("$Id: httpdriver.cpp 35929 2016-10-25 16:09:00Z goatbar $");
+CPL_CVSID("$Id: httpdriver.cpp 40505 2017-10-19 22:08:44Z rouault $");
/************************************************************************/
/* HTTPFetchContentDispositionFilename() */
@@ -143,7 +143,7 @@ static GDALDataset *HTTPOpen( GDALOpenInfo * poOpenInfo )
/* suppress errors as not all drivers support /vsimem */
CPLPushErrorHandler( CPLQuietErrorHandler );
GDALDataset *poDS = (GDALDataset *)
- GDALOpenEx( osResultFilename, poOpenInfo->nOpenFlags,
+ GDALOpenEx( osResultFilename, poOpenInfo->nOpenFlags & ~GDAL_OF_SHARED,
poOpenInfo->papszAllowedDrivers,
poOpenInfo->papszOpenOptions, NULL);
CPLPopErrorHandler();
@@ -171,7 +171,7 @@ static GDALDataset *HTTPOpen( GDALOpenInfo * poOpenInfo )
else
{
poDS = (GDALDataset *)
- GDALOpenEx( osTempFilename, poOpenInfo->nOpenFlags,
+ GDALOpenEx( osTempFilename, poOpenInfo->nOpenFlags & ~GDAL_OF_SHARED,
poOpenInfo->papszAllowedDrivers,
poOpenInfo->papszOpenOptions, NULL );
if( VSIUnlink( osTempFilename ) != 0 && poDS != NULL )
diff --git a/gcore/gdal_misc.cpp b/gcore/gdal_misc.cpp
index 1eb545a..10c190d 100644
--- a/gcore/gdal_misc.cpp
+++ b/gcore/gdal_misc.cpp
@@ -57,7 +57,7 @@
#include "ogr_core.h"
#include "ogr_spatialref.h"
-CPL_CVSID("$Id: gdal_misc.cpp 39789 2017-08-10 18:42:40Z rouault $");
+CPL_CVSID("$Id: gdal_misc.cpp 40479 2017-10-17 22:52:41Z rouault $");
/************************************************************************/
/* GDALDataTypeUnion() */
@@ -481,6 +481,9 @@ double GDALAdjustValueToDataType(
break;
case GDT_Float32:
{
+ if( !CPLIsFinite(dfValue) )
+ break;
+
// TODO(schwehr): ::min() versus ::lowest.
// Use ClampAndRound after it has been fixed.
if ( dfValue < -std::numeric_limits<float>::max())
diff --git a/gcore/gdal_version.h b/gcore/gdal_version.h
index 68f26f1..dd67214 100644
--- a/gcore/gdal_version.h
+++ b/gcore/gdal_version.h
@@ -1,4 +1,4 @@
-/* $Id: gdal_version.h 40116 2017-09-15 10:35:19Z rouault $ */
+/* $Id: gdal_version.h 40767 2017-11-20 10:39:34Z rouault $ */
/* -------------------------------------------------------------------- */
/* GDAL Version Information. */
@@ -7,7 +7,7 @@
#ifndef GDAL_VERSION_MAJOR
# define GDAL_VERSION_MAJOR 2
# define GDAL_VERSION_MINOR 2
-# define GDAL_VERSION_REV 2
+# define GDAL_VERSION_REV 3
# define GDAL_VERSION_BUILD 0
#endif
@@ -23,8 +23,8 @@
#endif
#ifndef GDAL_RELEASE_DATE
-# define GDAL_RELEASE_DATE 20170915
+# define GDAL_RELEASE_DATE 20171120
#endif
#ifndef GDAL_RELEASE_NAME
-# define GDAL_RELEASE_NAME "2.2.2"
+# define GDAL_RELEASE_NAME "2.2.3"
#endif
diff --git a/gcore/overview.cpp b/gcore/overview.cpp
index c645048..a08354a 100644
--- a/gcore/overview.cpp
+++ b/gcore/overview.cpp
@@ -47,7 +47,7 @@
// #include "gdalsse_priv.h"
#include "gdalwarper.h"
-CPL_CVSID("$Id: overview.cpp 37377 2017-02-13 18:43:53Z rouault $");
+CPL_CVSID("$Id: overview.cpp 40641 2017-11-04 15:32:07Z rouault $");
/************************************************************************/
/* GDALResampleChunk32R_Near() */
@@ -682,6 +682,14 @@ GDALResampleChunk32R_Gauss( double dfXRatioDstToSrc, double dfYRatioDstToSrc,
nGaussMatrixDim=7;
}
+#ifdef DEBUG_OUT_OF_BOUND_ACCESS
+ int* panGaussMatrixDup = static_cast<int*>(
+ CPLMalloc(sizeof(int) * nGaussMatrixDim * nGaussMatrixDim)=;
+ memcpy(panGaussMatrixDup, panGaussMatrix,
+ sizeof(int) * nGaussMatrixDim * nGaussMatrixDim);
+ panGaussMatrix = panGaussMatrixDup;
+#endif
+
float *pafDstScanline = static_cast<float *>(
VSI_MALLOC_VERBOSE((nDstXOff2 - nDstXOff) * sizeof(float)) );
if( pafDstScanline == NULL )
@@ -755,7 +763,12 @@ GDALResampleChunk32R_Gauss( double dfXRatioDstToSrc, double dfYRatioDstToSrc,
if( nSrcYOff2 > nChunkBottomYOff ||
(dfYRatioDstToSrc > 1 && iDstLine == nOYSize-1) )
- nSrcYOff2 = nChunkBottomYOff;
+ {
+ if( nChunkBottomYOff - nSrcYOff <= nGaussMatrixDim )
+ {
+ nSrcYOff2 = nChunkBottomYOff;
+ }
+ }
const float * const pafSrcScanline =
pafChunk + ((nSrcYOff-nChunkYOff) * nChunkXSize);
@@ -785,7 +798,12 @@ GDALResampleChunk32R_Gauss( double dfXRatioDstToSrc, double dfYRatioDstToSrc,
if( nSrcXOff2 > nChunkRightXOff ||
(dfXRatioDstToSrc > 1 && iDstPixel == nOXSize-1) )
- nSrcXOff2 = nChunkRightXOff;
+ {
+ if( nChunkRightXOff - nSrcXOff <= nGaussMatrixDim )
+ {
+ nSrcXOff2 = nChunkRightXOff;
+ }
+ }
if( poColorTable == NULL )
{
@@ -883,6 +901,9 @@ GDALResampleChunk32R_Gauss( double dfXRatioDstToSrc, double dfYRatioDstToSrc,
CPLFree( pafDstScanline );
CPLFree( aEntries );
+#ifdef DEBUG_OUT_OF_BOUND_ACCESS
+ CPLFree( panGaussMatrixNew );
+#endif
return eErr;
}
diff --git a/man/man1/gdal-config.1 b/man/man1/gdal-config.1
index a56e08f..3a769b2 100644
--- a/man/man1/gdal-config.1
+++ b/man/man1/gdal-config.1
@@ -1,4 +1,4 @@
-.TH "gdal-config" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal-config" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal2tiles.1 b/man/man1/gdal2tiles.1
index 9e75fe5..d0ec106 100644
--- a/man/man1/gdal2tiles.1
+++ b/man/man1/gdal2tiles.1
@@ -1,4 +1,4 @@
-.TH "gdal2tiles" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal2tiles" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_calc.1 b/man/man1/gdal_calc.1
index d03acb9..1b442f2 100644
--- a/man/man1/gdal_calc.1
+++ b/man/man1/gdal_calc.1
@@ -1,4 +1,4 @@
-.TH "gdal_calc" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_calc" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_contour.1 b/man/man1/gdal_contour.1
index 23094e2..cecfa4b 100644
--- a/man/man1/gdal_contour.1
+++ b/man/man1/gdal_contour.1
@@ -1,4 +1,4 @@
-.TH "gdal_contour" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_contour" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_edit.1 b/man/man1/gdal_edit.1
index 3d28ebe..ea8db50 100644
--- a/man/man1/gdal_edit.1
+++ b/man/man1/gdal_edit.1
@@ -1,4 +1,4 @@
-.TH "gdal_edit" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_edit" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_fillnodata.1 b/man/man1/gdal_fillnodata.1
index 7b61c92..fc32226 100644
--- a/man/man1/gdal_fillnodata.1
+++ b/man/man1/gdal_fillnodata.1
@@ -1,4 +1,4 @@
-.TH "gdal_fillnodata" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_fillnodata" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_grid.1 b/man/man1/gdal_grid.1
index 29a0ef8..2813153 100644
--- a/man/man1/gdal_grid.1
+++ b/man/man1/gdal_grid.1
@@ -1,4 +1,4 @@
-.TH "gdal_grid" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_grid" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_merge.1 b/man/man1/gdal_merge.1
index a73cf25..97ad066 100644
--- a/man/man1/gdal_merge.1
+++ b/man/man1/gdal_merge.1
@@ -1,4 +1,4 @@
-.TH "gdal_merge" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_merge" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_pansharpen.1 b/man/man1/gdal_pansharpen.1
index 1b1baf0..f2e1dae 100644
--- a/man/man1/gdal_pansharpen.1
+++ b/man/man1/gdal_pansharpen.1
@@ -1,4 +1,4 @@
-.TH "gdal_pansharpen" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_pansharpen" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_polygonize.1 b/man/man1/gdal_polygonize.1
index 74a7d16..db8d315 100644
--- a/man/man1/gdal_polygonize.1
+++ b/man/man1/gdal_polygonize.1
@@ -1,4 +1,4 @@
-.TH "gdal_polygonize" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_polygonize" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_proximity.1 b/man/man1/gdal_proximity.1
index 8aa5863..6899464 100644
--- a/man/man1/gdal_proximity.1
+++ b/man/man1/gdal_proximity.1
@@ -1,4 +1,4 @@
-.TH "gdal_proximity" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_proximity" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_rasterize.1 b/man/man1/gdal_rasterize.1
index 1369a9f..8b999b5 100644
--- a/man/man1/gdal_rasterize.1
+++ b/man/man1/gdal_rasterize.1
@@ -1,4 +1,4 @@
-.TH "gdal_rasterize" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_rasterize" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_retile.1 b/man/man1/gdal_retile.1
index d44da6e..50f0bd1 100644
--- a/man/man1/gdal_retile.1
+++ b/man/man1/gdal_retile.1
@@ -1,4 +1,4 @@
-.TH "gdal_retile" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_retile" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_sieve.1 b/man/man1/gdal_sieve.1
index c3fed6d..3bcce49 100644
--- a/man/man1/gdal_sieve.1
+++ b/man/man1/gdal_sieve.1
@@ -1,4 +1,4 @@
-.TH "gdal_sieve" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_sieve" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_translate.1 b/man/man1/gdal_translate.1
index 33ebda2..12b29a3 100644
--- a/man/man1/gdal_translate.1
+++ b/man/man1/gdal_translate.1
@@ -1,4 +1,4 @@
-.TH "gdal_translate" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_translate" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdal_utilities.1 b/man/man1/gdal_utilities.1
index c2f47f6..e47ddf6 100644
--- a/man/man1/gdal_utilities.1
+++ b/man/man1/gdal_utilities.1
@@ -1,4 +1,4 @@
-.TH "gdal_utilities" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdal_utilities" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdaladdo.1 b/man/man1/gdaladdo.1
index e2363ad..0e3ab20 100644
--- a/man/man1/gdaladdo.1
+++ b/man/man1/gdaladdo.1
@@ -1,4 +1,4 @@
-.TH "gdaladdo" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdaladdo" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalbuildvrt.1 b/man/man1/gdalbuildvrt.1
index b0e94de..dcde627 100644
--- a/man/man1/gdalbuildvrt.1
+++ b/man/man1/gdalbuildvrt.1
@@ -1,4 +1,4 @@
-.TH "gdalbuildvrt" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalbuildvrt" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalcompare.1 b/man/man1/gdalcompare.1
index 1a02403..ccce715 100644
--- a/man/man1/gdalcompare.1
+++ b/man/man1/gdalcompare.1
@@ -1,4 +1,4 @@
-.TH "gdalcompare" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalcompare" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdaldem.1 b/man/man1/gdaldem.1
index 28a62dd..4b8f888 100644
--- a/man/man1/gdaldem.1
+++ b/man/man1/gdaldem.1
@@ -1,4 +1,4 @@
-.TH "gdaldem" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdaldem" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalinfo.1 b/man/man1/gdalinfo.1
index 80ab275..da9f0c9 100644
--- a/man/man1/gdalinfo.1
+++ b/man/man1/gdalinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalinfo" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalinfo" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdallocationinfo.1 b/man/man1/gdallocationinfo.1
index cf7f44a..b6579ce 100644
--- a/man/man1/gdallocationinfo.1
+++ b/man/man1/gdallocationinfo.1
@@ -1,4 +1,4 @@
-.TH "gdallocationinfo" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdallocationinfo" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalmanage.1 b/man/man1/gdalmanage.1
index e80a00f..a8f5dac 100644
--- a/man/man1/gdalmanage.1
+++ b/man/man1/gdalmanage.1
@@ -1,4 +1,4 @@
-.TH "gdalmanage" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalmanage" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalmove.1 b/man/man1/gdalmove.1
index 6d654d2..b947c92 100644
--- a/man/man1/gdalmove.1
+++ b/man/man1/gdalmove.1
@@ -1,4 +1,4 @@
-.TH "gdalmove" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalmove" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalsrsinfo.1 b/man/man1/gdalsrsinfo.1
index 04694fa..92d9bdc 100644
--- a/man/man1/gdalsrsinfo.1
+++ b/man/man1/gdalsrsinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalsrsinfo" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalsrsinfo" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdaltindex.1 b/man/man1/gdaltindex.1
index 23e9651..d5f2cdb 100644
--- a/man/man1/gdaltindex.1
+++ b/man/man1/gdaltindex.1
@@ -1,4 +1,4 @@
-.TH "gdaltindex" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdaltindex" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdaltransform.1 b/man/man1/gdaltransform.1
index 1cb7dbb..3c732bb 100644
--- a/man/man1/gdaltransform.1
+++ b/man/man1/gdaltransform.1
@@ -1,4 +1,4 @@
-.TH "gdaltransform" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdaltransform" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gdalwarp.1 b/man/man1/gdalwarp.1
index 81558e2..f5dd820 100644
--- a/man/man1/gdalwarp.1
+++ b/man/man1/gdalwarp.1
@@ -1,4 +1,4 @@
-.TH "gdalwarp" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gdalwarp" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gnm_utilities.1 b/man/man1/gnm_utilities.1
index f1f0cd3..1634840 100644
--- a/man/man1/gnm_utilities.1
+++ b/man/man1/gnm_utilities.1
@@ -1,4 +1,4 @@
-.TH "gnm_utilities" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gnm_utilities" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gnmanalyse.1 b/man/man1/gnmanalyse.1
index 4b107a7..6f05487 100644
--- a/man/man1/gnmanalyse.1
+++ b/man/man1/gnmanalyse.1
@@ -1,4 +1,4 @@
-.TH "gnmanalyse" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gnmanalyse" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/gnmmanage.1 b/man/man1/gnmmanage.1
index de93021..b412599 100644
--- a/man/man1/gnmmanage.1
+++ b/man/man1/gnmmanage.1
@@ -1,4 +1,4 @@
-.TH "gnmmanage" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "gnmmanage" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/nearblack.1 b/man/man1/nearblack.1
index ae4cd74..c5a8ad0 100644
--- a/man/man1/nearblack.1
+++ b/man/man1/nearblack.1
@@ -1,4 +1,4 @@
-.TH "nearblack" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "nearblack" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/ogr2ogr.1 b/man/man1/ogr2ogr.1
index 87e6258..5e9ea3f 100644
--- a/man/man1/ogr2ogr.1
+++ b/man/man1/ogr2ogr.1
@@ -1,4 +1,4 @@
-.TH "ogr2ogr" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "ogr2ogr" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/ogr_utilities.1 b/man/man1/ogr_utilities.1
index c11b809..56f95ef 100644
--- a/man/man1/ogr_utilities.1
+++ b/man/man1/ogr_utilities.1
@@ -1,4 +1,4 @@
-.TH "ogr_utilities" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "ogr_utilities" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/ogrinfo.1 b/man/man1/ogrinfo.1
index 53c266e..d231bb2 100644
--- a/man/man1/ogrinfo.1
+++ b/man/man1/ogrinfo.1
@@ -1,4 +1,4 @@
-.TH "ogrinfo" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "ogrinfo" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/ogrlineref.1 b/man/man1/ogrlineref.1
index 640fbf6..24484b2 100644
--- a/man/man1/ogrlineref.1
+++ b/man/man1/ogrlineref.1
@@ -1,4 +1,4 @@
-.TH "ogrlineref" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "ogrlineref" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/ogrmerge.1 b/man/man1/ogrmerge.1
index 9c76655..8acad88 100644
--- a/man/man1/ogrmerge.1
+++ b/man/man1/ogrmerge.1
@@ -1,4 +1,4 @@
-.TH "ogrmerge" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "ogrmerge" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/ogrtindex.1 b/man/man1/ogrtindex.1
index b793f96..61eb0f5 100644
--- a/man/man1/ogrtindex.1
+++ b/man/man1/ogrtindex.1
@@ -1,4 +1,4 @@
-.TH "ogrtindex" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "ogrtindex" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/pct2rgb.1 b/man/man1/pct2rgb.1
index 6321825..e4b30af 100644
--- a/man/man1/pct2rgb.1
+++ b/man/man1/pct2rgb.1
@@ -1,4 +1,4 @@
-.TH "pct2rgb" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "pct2rgb" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/man/man1/rgb2pct.1 b/man/man1/rgb2pct.1
index da5837a..6acebe7 100644
--- a/man/man1/rgb2pct.1
+++ b/man/man1/rgb2pct.1
@@ -1,4 +1,4 @@
-.TH "rgb2pct" 1 "Fri Sep 15 2017" "GDAL" \" -*- nroff -*-
+.TH "rgb2pct" 1 "Mon Nov 20 2017" "GDAL" \" -*- nroff -*-
.ad l
.nh
.SH NAME
diff --git a/nmake.opt b/nmake.opt
index 276686b..bd132c3 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -1,4 +1,4 @@
-# $Id: nmake.opt 40036 2017-09-08 11:23:21Z rouault $
+# $Id: nmake.opt 40330 2017-10-05 12:56:50Z rouault $
#
# nmake.opt - main configuration file for NMAKE makefiles.
#
@@ -195,6 +195,9 @@ SOFTWARNFLAGS= /wd4244 /wd4702 /wd4701 /wd4013 /wd4706 /wd4057 /wd4210 /wd4305
# Linker debug options
!IFDEF DEBUG
LDEBUG= /debug
+!ELSEIFDEF WITH_PDB
+# Ensures that PDB is included in release DLL if so requested
+LDEBUG= /debug /opt:ref /opt:icf
!ENDIF
# Uncomment the following if you are building for 64-bit windows
@@ -611,6 +614,8 @@ OCI_INCLUDE = -I$(ORACLE_HOME)\oci\include
#OPENJPEG_VERSION = 20100
# For OpenJpeg 2.2.x, uncomment
#OPENJPEG_VERSION = 20200
+# For OpenJpeg 2.3.x, uncomment
+#OPENJPEG_VERSION = 20300
#if using an external zlib uncomment the following lines
#ZLIB_EXTERNAL_LIB = 1
diff --git a/ogr/gml2ogrgeometry.cpp b/ogr/gml2ogrgeometry.cpp
index ffa047a..13875d2 100644
--- a/ogr/gml2ogrgeometry.cpp
+++ b/ogr/gml2ogrgeometry.cpp
@@ -57,7 +57,7 @@
#include "ogr_srs_api.h"
#include "ogrsf_frmts/xplane/ogr_xplane_geo_utils.h"
-CPL_CVSID("$Id: gml2ogrgeometry.cpp 37129 2017-01-12 21:15:15Z rouault $");
+CPL_CVSID("$Id: gml2ogrgeometry.cpp 40428 2017-10-13 21:34:18Z rouault $");
#if HAVE_CXX11
constexpr double kdfD2R = M_PI / 180.0;
@@ -3631,6 +3631,9 @@ OGRGeometry *GML2OGRGeometry_XMLNode_Internal(
OGRGeometry *poResult = NULL;
for( ; psParent != NULL; psParent = psParent->psNext )
{
+ psChild = GetChildElement(psParent);
+ if( psChild == NULL )
+ continue;
poPS = new OGRPolyhedralSurface();
for( ; psChild != NULL; psChild = psChild->psNext )
{
@@ -3656,6 +3659,12 @@ OGRGeometry *GML2OGRGeometry_XMLNode_Internal(
{
poPS->addGeometryDirectly( poPolygon );
}
+ else if( wkbFlatten(poPolygon->getGeometryType()) ==
+ wkbCurvePolygon )
+ {
+ poPS->addGeometryDirectly(
+ OGRGeometryFactory::forceToPolygon(poPolygon) );
+ }
else
{
delete poPS;
diff --git a/ogr/ogr_geometry.h b/ogr/ogr_geometry.h
index 81ce2ad..cd72b3f 100644
--- a/ogr/ogr_geometry.h
+++ b/ogr/ogr_geometry.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: ogr_geometry.h 37472 2017-02-26 02:47:45Z goatbar $
+ * $Id: ogr_geometry.h 40454 2017-10-16 19:14:13Z rouault $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Classes for manipulating simple features that is not specific
@@ -765,6 +765,9 @@ class CPL_DLL OGRCircularString : public OGRSimpleCurve
const CPL_OVERRIDE;
virtual int ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
+
+ friend class OGRCurvePolygon;
+ int IntersectsPoint( const OGRPoint* p ) const;
//! @endcond
public:
diff --git a/ogr/ogrcircularstring.cpp b/ogr/ogrcircularstring.cpp
index 7085ca5..6654fd7 100644
--- a/ogr/ogrcircularstring.cpp
+++ b/ogr/ogrcircularstring.cpp
@@ -40,7 +40,7 @@
#include "ogr_geometry.h"
#include "ogr_p.h"
-CPL_CVSID("$Id: ogrcircularstring.cpp 36682 2016-12-04 20:34:45Z rouault $");
+CPL_CVSID("$Id: ogrcircularstring.cpp 40454 2017-10-16 19:14:13Z rouault $");
static inline double dist(double x0, double y0, double x1, double y1)
{
@@ -853,8 +853,24 @@ int OGRCircularString::ContainsPoint( const OGRPoint* p ) const
const double square_dist =
(p->getX() - cx) * (p->getX() - cx) +
(p->getY() - cy) * (p->getY() - cy);
+ return square_dist < square_R;
+ }
+ return -1;
+}
+
+int OGRCircularString::IntersectsPoint( const OGRPoint* p ) const
+{
+ double cx = 0.0;
+ double cy = 0.0;
+ double square_R = 0.0;
+ if( IsFullCircle(cx, cy, square_R) )
+ {
+ const double square_dist =
+ (p->getX() - cx) * (p->getX() - cx) +
+ (p->getY() - cy) * (p->getY() - cy);
return square_dist <= square_R;
}
return -1;
}
+
//! @endcond
diff --git a/ogr/ogrcurvepolygon.cpp b/ogr/ogrcurvepolygon.cpp
index 65dd21d..c7a8084 100644
--- a/ogr/ogrcurvepolygon.cpp
+++ b/ogr/ogrcurvepolygon.cpp
@@ -39,7 +39,7 @@
#include "ogr_p.h"
#include "ogr_spatialref.h"
-CPL_CVSID("$Id: ogrcurvepolygon.cpp 36883 2016-12-15 13:31:12Z rouault $");
+CPL_CVSID("$Id: ogrcurvepolygon.cpp 40454 2017-10-16 19:14:13Z rouault $");
/************************************************************************/
/* OGRCurvePolygon() */
@@ -785,7 +785,15 @@ OGRBoolean OGRCurvePolygon::Intersects( const OGRGeometry *poOtherGeom ) const
"dynamic_cast failed. Expected OGRPoint.");
return FALSE;
}
- return ContainsPoint(poPoint);
+ if( getExteriorRingCurve() != NULL &&
+ getNumInteriorRings() == 0 &&
+ wkbFlatten(getExteriorRingCurve()->getGeometryType()) == wkbCircularString)
+ {
+ const int nRet = dynamic_cast<const OGRCircularString*>(
+ getExteriorRingCurve())->IntersectsPoint(poPoint);
+ if( nRet >= 0 )
+ return nRet;
+ }
}
return OGRGeometry::Intersects(poOtherGeom);
diff --git a/ogr/ogrlinestring.cpp b/ogr/ogrlinestring.cpp
index 060e9d4..bdaba33 100644
--- a/ogr/ogrlinestring.cpp
+++ b/ogr/ogrlinestring.cpp
@@ -34,7 +34,7 @@
#include <cstdlib>
#include <algorithm>
-CPL_CVSID("$Id: ogrlinestring.cpp 39951 2017-08-28 07:33:44Z rouault $");
+CPL_CVSID("$Id: ogrlinestring.cpp 40622 2017-11-03 10:07:36Z rouault $");
/************************************************************************/
/* OGRSimpleCurve() */
@@ -1690,9 +1690,6 @@ OGRErr OGRSimpleCurve::importFromWkt( char ** ppszInput )
if( bHasM ) flags |= OGR_G_MEASURED;
if( bIsEmpty )
{
- // we should be at the end
- if( !((*ppszInput[0] == '\000') || (*ppszInput[0] == ',')) )
- return OGRERR_CORRUPT_DATA;
return OGRERR_NONE;
}
diff --git a/ogr/ogrpoint.cpp b/ogr/ogrpoint.cpp
index 91dc8cd..ad39f53 100644
--- a/ogr/ogrpoint.cpp
+++ b/ogr/ogrpoint.cpp
@@ -41,7 +41,7 @@
#include "ogr_p.h"
#include "ogr_spatialref.h"
-CPL_CVSID("$Id: ogrpoint.cpp 36324 2016-11-20 02:28:41Z goatbar $");
+CPL_CVSID("$Id: ogrpoint.cpp 40622 2017-11-03 10:07:36Z rouault $");
/************************************************************************/
/* OGRPoint() */
@@ -488,9 +488,6 @@ OGRErr OGRPoint::importFromWkt( char ** ppszInput )
if( bHasM ) flags |= OGR_G_MEASURED;
if( bIsEmpty )
{
- // Should be at the end.
- if( !((*ppszInput[0] == '\000') || (*ppszInput[0] == ',')) )
- return OGRERR_CORRUPT_DATA;
return OGRERR_NONE;
}
else
diff --git a/ogr/ogrsf_frmts/amigocloud/drv_amigocloud.html b/ogr/ogrsf_frmts/amigocloud/drv_amigocloud.html
index 8974e56..cb62f26 100644
--- a/ogr/ogrsf_frmts/amigocloud/drv_amigocloud.html
+++ b/ogr/ogrsf_frmts/amigocloud/drv_amigocloud.html
@@ -9,7 +9,7 @@
(GDAL/OGR >= 2.1)<p>
-This driver can connect to the services implementing the AmigoCloud API.
+This driver can connect to the AmigoCloud API services.
GDAL/OGR must be built with Curl support in order for the
AmigoCloud driver to be compiled.<p>
@@ -28,6 +28,15 @@ This is necessary when you need to access a particular AmigoCloud dataset.
</ul>
If several parameters are specified, they must be separated by a space.<p>
+If no datset_id is provided, the driver will print list of available datasets for given project.
+<li> For example: <b>"AmigoCloud:1234 datasets"</b>
+ <pre>
+ List of available datasets for project id: 1234
+ | id | name
+ |-----------|-------------------
+ | 5551 | points
+ | 5552 | lines
+</pre>
<h2>Configuration options</h2>
@@ -97,7 +106,30 @@ can be NULL. Defaults to YES.</li>
<h2>Examples</h2>
<li>
-Acceccing data from a public table:
+ Different ways to provide AmigoCloud API token:
+ <pre>
+ ogrinfo --config AMIGOCLOUD_API_KEY abcdefghijklmnopqrstuvw -al "AmigoCloud:1234 datasets=987"
+ ogrinfo -oo AMIGOCLOUD_API_KEY=abcdefghijklmnopqrstuvw -al "AmigoCloud:1234 datasets=987"
+ env AMIGOCLOUD_API_KEY=abcdefghijklmnopqrstuvw ogrinfo -al "AmigoCloud:1234 datasets=987"
+ </pre>
+ <pre>
+ export AMIGOCLOUD_API_KEY=abcdefghijklmnopqrstuvw
+ ogrinfo -al "AmigoCloud:1234 datasets=987"
+ </pre>
+
+<li>
+Show list of datasets.
+ <pre>
+ $ ogrinfo -ro "AmigoCloud:1234 datasets"
+ List of available datasets for project id: 1234
+ | id | name
+ |-----------|-------------------
+ | 5551 | points
+ | 5552 | lines
+ </pre>
+
+<li>
+Accessing data from a public table:
<pre>
ogrinfo -ro "AmigoCloud:1234 datasets=1234,1235"
</pre>
@@ -106,7 +138,7 @@ ogrinfo -ro "AmigoCloud:1234 datasets=1234,1235"
<li>
Creating and populating a table from a shapefile:
<pre>
-ogr2ogr --config AMIGOCLOUD_API_KEY abcdefghijklmnopqrstuvw -f "AmigoCloud" AmigoCloud:"1234" myshapefile.shp
+ogr2ogr --config AMIGOCLOUD_API_KEY abcdefghijklmnopqrstuvw -f AmigoCloud "AmigoCloud:1234" myshapefile.shp
</pre>
<p>
diff --git a/ogr/ogrsf_frmts/amigocloud/ogr_amigocloud.h b/ogr/ogrsf_frmts/amigocloud/ogr_amigocloud.h
index 0484550..396eebe 100644
--- a/ogr/ogrsf_frmts/amigocloud/ogr_amigocloud.h
+++ b/ogr/ogrsf_frmts/amigocloud/ogr_amigocloud.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: ogr_amigocloud.h 36687 2016-12-04 22:28:14Z rouault $
+ * $Id: ogr_amigocloud.h 40508 2017-10-20 12:55:15Z rouault $
*
* Project: AMIGOCLOUD Translator
* Purpose: Definition of classes for OGR AmigoCloud driver.
@@ -60,6 +60,7 @@ class OGRAmigoCloudGeomFieldDefn: public OGRGeomFieldDefn
}
};
+// cppcheck-suppress copyCtorAndEqOperator
class OGRAmigoCloudFID
{
public:
@@ -293,6 +294,9 @@ class OGRAmigoCloudDataSource : public OGRDataSource
OGRGeometry *poSpatialFilter = NULL,
const char *pszDialect = NULL,
bool bRunDeferredActions = false );
+
+ bool ListDatasets();
+ bool waitForJobToFinish(const char* jobId);
};
#endif /* ndef OGR_AMIGOCLOUD_H_INCLUDED */
diff --git a/ogr/ogrsf_frmts/amigocloud/ogramigoclouddatasource.cpp b/ogr/ogrsf_frmts/amigocloud/ogramigoclouddatasource.cpp
index b0b64ea..86c6bf3 100644
--- a/ogr/ogrsf_frmts/amigocloud/ogramigoclouddatasource.cpp
+++ b/ogr/ogrsf_frmts/amigocloud/ogramigoclouddatasource.cpp
@@ -31,7 +31,7 @@
#include "ogrgeojsonreader.h"
#include <sstream>
-CPL_CVSID("$Id: ogramigoclouddatasource.cpp 38115 2017-04-23 07:24:41Z rouault $");
+CPL_CVSID("$Id: ogramigoclouddatasource.cpp 40508 2017-10-20 12:55:15Z rouault $")
CPLString OGRAMIGOCLOUDGetOptionValue(const char* pszFilename, const char* pszOptionName);
@@ -133,6 +133,56 @@ CPLString OGRAMIGOCLOUDGetOptionValue(const char* pszFilename,
return osOptionValue;
}
+bool OGRAmigoCloudDataSource::ListDatasets()
+{
+ std::stringstream url;
+ url << std::string(GetAPIURL()) << "/users/0/projects/" << std::string(GetProjetcId()) << "/datasets/?summary";
+
+ json_object* result = RunGET(url.str().c_str());
+ if( result == NULL ) {
+ CPLError(CE_Failure, CPLE_AppDefined, "AmigoCloud:get failed.");
+ return false;
+ }
+
+ if( result != NULL )
+ {
+ int type = json_object_get_type(result);
+ if(type == json_type_object)
+ {
+ json_object *poResults = CPL_json_object_object_get(result, "results");
+ if(poResults != NULL) {
+ array_list *res = json_object_get_array(poResults);
+ if(res != NULL) {
+ CPLprintf("List of available datasets for project id: %s\n", GetProjetcId());
+ CPLprintf("| id \t | name\n");
+ CPLprintf("|--------|-------------------\n");
+ for(int i = 0; i < res->length; i++) {
+ json_object *ds = (json_object*)array_list_get_idx(res, i);
+ if(ds!=NULL) {
+ const char *name = NULL;
+ int64_t dataset_id = 0;
+ json_object *poName = CPL_json_object_object_get(ds, "name");
+ if (poName != NULL) {
+ name = json_object_get_string(poName);
+ }
+ json_object *poId = CPL_json_object_object_get(ds, "id");
+ if (poId != NULL) {
+ dataset_id = json_object_get_int64(poId);
+ }
+ if (name != NULL) {
+ std::stringstream str;
+ str << "| " << dataset_id << "\t | " << name;
+ CPLprintf("%s\n", str.str().c_str());
+ } }
+ }
+ }
+ }
+ }
+ json_object_put(result);
+ }
+ return true;
+}
+
/************************************************************************/
/* Open() */
/************************************************************************/
@@ -161,15 +211,18 @@ int OGRAmigoCloudDataSource::Open( const char * pszFilename,
}
}
- osAPIKey = CSLFetchNameValueDef(papszOpenOptionsIn, "API_KEY",
+ osAPIKey = CSLFetchNameValueDef(papszOpenOptionsIn, "AMIGOCLOUD_API_KEY",
CPLGetConfigOption("AMIGOCLOUD_API_KEY", ""));
if (osAPIKey.empty())
{
- osAPIKey = OGRAMIGOCLOUDGetOptionValue(pszFilename, "API_KEY");
+ osAPIKey = OGRAMIGOCLOUDGetOptionValue(pszFilename, "AMIGOCLOUD_API_KEY");
+ }
+ if (osAPIKey.empty())
+ {
+ CPLError(CE_Failure, CPLE_AppDefined, "AMIGOCLOUD_API_KEY is not defined.\n");
+ return FALSE;
}
-
- CPLString osDatasets = OGRAMIGOCLOUDGetOptionValue(pszFilename, "datasets");
bUseHTTPS = CPLTestBool(CPLGetConfigOption("AMIGOCLOUD_HTTPS", "YES"));
@@ -190,6 +243,7 @@ int OGRAmigoCloudDataSource::Open( const char * pszFilename,
if( osCurrentSchema.empty() )
return FALSE;
+ CPLString osDatasets = OGRAMIGOCLOUDGetOptionValue(pszFilename, "datasets");
if (!osDatasets.empty())
{
char** papszTables = CSLTokenizeString2(osDatasets, ",", 0);
@@ -201,6 +255,11 @@ int OGRAmigoCloudDataSource::Open( const char * pszFilename,
}
CSLDestroy(papszTables);
return TRUE;
+ } else {
+ // If 'datasets' word is in the filename, but no datasets specified,
+ // print the list of available datasets
+ if(std::string(pszFilename).find("datasets") != std::string::npos)
+ ListDatasets();
}
return TRUE;
@@ -453,6 +512,13 @@ json_object* OGRAmigoCloudDataSource::RunPOST(const char*pszURL, const char *psz
return NULL;
}
}
+ json_object* poJob = CPL_json_object_object_get(poObj, "job");
+ if (poJob != NULL) {
+ const char *job = json_object_get_string(poJob);
+ if (job != NULL) {
+ waitForJobToFinish(job);
+ }
+ }
}
else
{
@@ -464,6 +530,41 @@ json_object* OGRAmigoCloudDataSource::RunPOST(const char*pszURL, const char *psz
return poObj;
}
+bool OGRAmigoCloudDataSource::waitForJobToFinish(const char* jobId)
+{
+ std::stringstream url;
+ url << std::string(GetAPIURL()) << "/me/jobs/" << std::string(jobId);
+
+ bool done = false;
+ int count = 0;
+ while (!done && count<5) {
+ count++;
+ json_object *result = RunGET(url.str().c_str());
+ if (result == NULL) {
+ CPLError(CE_Failure, CPLE_AppDefined, "AmigoCloud:get failed.");
+ return false;
+ }
+
+ if (result != NULL) {
+ int type = json_object_get_type(result);
+ if (type == json_type_object) {
+ json_object *poStatus = CPL_json_object_object_get(result, "status");
+ const char *status = json_object_get_string(poStatus);
+ if (status != NULL) {
+ if (std::string(status) == "SUCCESS") {
+ return true;
+ } else if (std::string(status) == "FAILURE") {
+ return false;
+ }
+ }
+ }
+ }
+ CPLSleep(1.0); // Sleep 1 sec.
+ }
+ return false;
+}
+
+
/************************************************************************/
/* RunDELETE() */
/************************************************************************/
@@ -566,13 +667,17 @@ json_object* OGRAmigoCloudDataSource::RunGET(const char*pszURL)
/* -------------------------------------------------------------------- */
if( !osAPIKey.empty() )
{
- osURL += "?token=";
+ if(osURL.find("?") == std::string::npos)
+ osURL += "?token=";
+ else
+ osURL += "&token=";
osURL += osAPIKey;
}
CPLHTTPResult * psResult = CPLHTTPFetch( osURL.c_str(), NULL);
- if( psResult == NULL )
+ if( psResult == NULL ) {
return NULL;
+ }
if (psResult->pszContentType &&
strncmp(psResult->pszContentType, "text/html", 9) == 0)
diff --git a/ogr/ogrsf_frmts/amigocloud/ogramigoclouddriver.cpp b/ogr/ogrsf_frmts/amigocloud/ogramigoclouddriver.cpp
index e8b77b4..b6c641c 100644
--- a/ogr/ogrsf_frmts/amigocloud/ogramigoclouddriver.cpp
+++ b/ogr/ogrsf_frmts/amigocloud/ogramigoclouddriver.cpp
@@ -28,7 +28,7 @@
#include "ogr_amigocloud.h"
-CPL_CVSID("$Id: ogramigoclouddriver.cpp 35611 2016-10-04 14:58:17Z goatbar $");
+CPL_CVSID("$Id: ogramigoclouddriver.cpp 40508 2017-10-20 12:55:15Z rouault $")
extern "C" void RegisterOGRAmigoCloud();
@@ -93,7 +93,6 @@ static GDALDataset *OGRAmigoCloudDriverCreate( const char * pszName,
/************************************************************************/
void RegisterOGRAmigoCloud()
-
{
if( GDALGetDriverByName( "AmigoCloud" ) != NULL )
return;
@@ -108,7 +107,7 @@ void RegisterOGRAmigoCloud()
poDriver->SetMetadataItem( GDAL_DMD_OPENOPTIONLIST,
"<OpenOptionList>"
- " <Option name='API_KEY' type='string' description='Account API key'/>"
+ " <Option name='AMIGOCLOUD_API_KEY' type='string' description='Account API key'/>"
" <Option name='PROJECTID' type='string' description='Project id' required='true'/>"
" <Option name='BATCH_INSERT' type='boolean' description='Whether to group features to be inserted in a batch' default='YES'/>"
"</OpenOptionList>");
diff --git a/ogr/ogrsf_frmts/amigocloud/ogramigocloudlayer.cpp b/ogr/ogrsf_frmts/amigocloud/ogramigocloudlayer.cpp
index 800f10f..945bf20 100644
--- a/ogr/ogrsf_frmts/amigocloud/ogramigocloudlayer.cpp
+++ b/ogr/ogrsf_frmts/amigocloud/ogramigocloudlayer.cpp
@@ -30,7 +30,7 @@
#include "ogr_p.h"
#include "ogrgeojsonreader.h"
-CPL_CVSID("$Id: ogramigocloudlayer.cpp 37371 2017-02-13 11:41:59Z rouault $");
+CPL_CVSID("$Id: ogramigocloudlayer.cpp 40508 2017-10-20 12:55:15Z rouault $")
/************************************************************************/
/* OGRAmigoCloudLayer() */
@@ -362,18 +362,29 @@ void OGRAmigoCloudLayer::EstablishLayerDefn(const char* pszLayerName,
}
if(!fieldName.empty() && !fieldType.empty())
{
-
if(EQUAL(fieldType.c_str(), "string") ||
EQUAL(fieldType.c_str(), "unknown(19)") /* name */ )
{
OGRFieldDefn oFieldDefn(fieldName.c_str(), OFTString);
poFeatureDefn->AddFieldDefn(&oFieldDefn);
}
- else if(EQUAL(fieldType.c_str(), "number"))
+ else if(EQUAL(fieldType.c_str(), "number") ||
+ EQUAL(fieldType.c_str(), "float") ||
+ EQUAL(fieldType.c_str(), "real"))
{
OGRFieldDefn oFieldDefn(fieldName.c_str(), OFTReal);
poFeatureDefn->AddFieldDefn(&oFieldDefn);
}
+ else if(EQUAL(fieldType.c_str(), "integer"))
+ {
+ OGRFieldDefn oFieldDefn(fieldName.c_str(), OFTInteger);
+ poFeatureDefn->AddFieldDefn(&oFieldDefn);
+ }
+ else if(EQUAL(fieldType.c_str(), "bigint"))
+ {
+ OGRFieldDefn oFieldDefn(fieldName.c_str(), OFTInteger64);
+ poFeatureDefn->AddFieldDefn(&oFieldDefn);
+ }
else if(EQUAL(fieldType.c_str(), "date"))
{
if(!EQUAL(fieldName.c_str(), "created_at") &&
diff --git a/ogr/ogrsf_frmts/amigocloud/ogramigocloudresultlayer.cpp b/ogr/ogrsf_frmts/amigocloud/ogramigocloudresultlayer.cpp
index 4eae0e1..d42f0b0 100644
--- a/ogr/ogrsf_frmts/amigocloud/ogramigocloudresultlayer.cpp
+++ b/ogr/ogrsf_frmts/amigocloud/ogramigocloudresultlayer.cpp
@@ -28,7 +28,7 @@
#include "ogr_amigocloud.h"
-CPL_CVSID("$Id: ogramigocloudresultlayer.cpp 34819 2016-07-28 22:32:18Z goatbar $");
+CPL_CVSID("$Id: ogramigocloudresultlayer.cpp 40508 2017-10-20 12:55:15Z rouault $")
/************************************************************************/
/* OGRAmigoCloudResultLayer() */
diff --git a/ogr/ogrsf_frmts/amigocloud/ogramigocloudtablelayer.cpp b/ogr/ogrsf_frmts/amigocloud/ogramigocloudtablelayer.cpp
index 279a303..b0b5c14 100644
--- a/ogr/ogrsf_frmts/amigocloud/ogramigocloudtablelayer.cpp
+++ b/ogr/ogrsf_frmts/amigocloud/ogramigocloudtablelayer.cpp
@@ -32,7 +32,7 @@
#include "ogrgeojsonreader.h"
#include <sstream>
-CPL_CVSID("$Id: ogramigocloudtablelayer.cpp 37371 2017-02-13 11:41:59Z rouault $");
+CPL_CVSID("$Id: ogramigocloudtablelayer.cpp 40508 2017-10-20 12:55:15Z rouault $")
/************************************************************************/
/* OGRAMIGOCLOUDEscapeIdentifier( ) */
diff --git a/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp b/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp
index 76f2892..d6aa26d 100644
--- a/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp
+++ b/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp
@@ -36,7 +36,7 @@
#include "FGdbUtils.h"
#include "cpl_multiproc.h"
-CPL_CVSID("$Id: FGdbDatasource.cpp 36682 2016-12-04 20:34:45Z rouault $");
+CPL_CVSID("$Id: FGdbDatasource.cpp 40500 2017-10-19 20:40:19Z rouault $");
using std::vector;
using std::wstring;
@@ -476,8 +476,6 @@ int FGdbDataSource::TestCapability( const char * pszCap )
else if( EQUAL(pszCap,ODsCDeleteLayer) )
return m_bUpdate;
- else if( EQUAL(pszCap,ODsCCreateGeomFieldAfterCreateLayer) )
- return TRUE;
else if( EQUAL(pszCap,ODsCRandomLayerWrite) )
return m_bUpdate;
diff --git a/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp b/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp
index b393865..1086273 100644
--- a/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp
@@ -57,7 +57,7 @@
// #include "symbol_renames.h"
-CPL_CVSID("$Id: ogrgeojsondatasource.cpp 38109 2017-04-22 22:26:06Z rouault $");
+CPL_CVSID("$Id: ogrgeojsondatasource.cpp 40541 2017-10-23 20:46:00Z rouault $");
/************************************************************************/
/* OGRGeoJSONDataSource() */
@@ -681,7 +681,8 @@ void OGRGeoJSONDataSource::LoadLayers(char** papszOpenOptionsIn)
/* Is it ESRI Feature Service data ? */
/* -------------------------------------------------------------------- */
if( strstr(pszGeoData_, "esriGeometry") ||
- strstr(pszGeoData_, "esriFieldType") )
+ strstr(pszGeoData_, "esriFieldType") ||
+ strstr(pszGeoData_, "\"fieldAliases\"") )
{
OGRESRIJSONReader reader;
OGRErr err = reader.Parse( pszGeoData_ );
diff --git a/ogr/ogrsf_frmts/geojson/ogrgeojsondriver.cpp b/ogr/ogrsf_frmts/geojson/ogrgeojsondriver.cpp
index 3f98299..b08bb40 100644
--- a/ogr/ogrsf_frmts/geojson/ogrgeojsondriver.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsondriver.cpp
@@ -45,7 +45,7 @@
#include "ogrgeojsonutils.h"
#include "ogrsf_frmts.h"
-CPL_CVSID("$Id: ogrgeojsondriver.cpp 38520 2017-05-20 15:08:48Z rouault $");
+CPL_CVSID("$Id: ogrgeojsondriver.cpp 40541 2017-10-23 20:46:00Z rouault $");
class OGRESRIFeatureServiceDataset;
@@ -483,7 +483,9 @@ static GDALDataset* OGRGeoJSONDriverOpen( GDALOpenInfo* poOpenInfo )
poDS = NULL;
}
- if( poDS != NULL && poDS->HasOtherPages() )
+ if( poDS != NULL && poDS->HasOtherPages() &&
+ (STARTS_WITH(poOpenInfo->pszFilename, "http") ||
+ STARTS_WITH(poOpenInfo->pszFilename, "/vsimem/")) )
{
const char* pszFSP = CSLFetchNameValue(poOpenInfo->papszOpenOptions,
"FEATURE_SERVER_PAGING");
diff --git a/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp b/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp
index 7e6f67d..d6094f4 100644
--- a/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp
@@ -33,7 +33,7 @@
#include <ogr_geometry.h>
#include <json.h> // JSON-C
-CPL_CVSID("$Id: ogrgeojsonutils.cpp 39217 2017-06-20 20:43:30Z rouault $");
+CPL_CVSID("$Id: ogrgeojsonutils.cpp 40541 2017-10-23 20:46:00Z rouault $");
/************************************************************************/
/* GeoJSONIsObject() */
@@ -69,14 +69,30 @@ bool GeoJSONIsObject( const char* pszText )
return false;
return
+ // GeoJSON geometry
(strstr(pszText, "\"type\"") != NULL &&
strstr(pszText, "\"coordinates\"") != NULL)
+
+ // TopoJSON
|| (strstr(pszText, "\"type\"") != NULL &&
strstr(pszText, "\"Topology\"") != NULL)
+
+ // GeoJSON FeatureCollection
|| strstr(pszText, "\"FeatureCollection\"") != NULL
+
+ // GeoJSON Feature
|| strstr(pszText, "\"Feature\"") != NULL
+
+ // ESRI Json geometry
|| (strstr(pszText, "\"geometryType\"") != NULL &&
- strstr(pszText, "\"esriGeometry") != NULL);
+ strstr(pszText, "\"esriGeometry") != NULL)
+
+ // ESRI Json "FeatureCollection"
+ || strstr(pszText, "\"fieldAliases\"") != NULL
+
+ // ESRI Json "FeatureCollection"
+ || (strstr(pszText, "\"fields\"") != NULL &&
+ strstr(pszText, "\"esriFieldType") != NULL);
}
/************************************************************************/
diff --git a/ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp b/ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp
index c485790..bf439fe 100644
--- a/ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp
+++ b/ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp
@@ -32,7 +32,7 @@
#include "ogr_georss.h"
#include "ogr_p.h"
-CPL_CVSID("$Id: ogrgeorsslayer.cpp 38386 2017-05-15 11:55:09Z rouault $");
+CPL_CVSID("$Id: ogrgeorsslayer.cpp 40552 2017-10-25 19:59:16Z rouault $");
static const char* const apszAllowedATOMFieldNamesWithSubElements[] =
{ "author", "contributor", NULL };
@@ -1800,28 +1800,6 @@ void OGRGeoRSSLayer::LoadSchema()
}
/************************************************************************/
-/* OGRGeoRSSIsInt() */
-/************************************************************************/
-
-static int OGRGeoRSSIsInt(const char* pszStr)
-{
- while(*pszStr == ' ')
- pszStr++;
-
- for( int i=0; pszStr[i]; i++ )
- {
- if (pszStr[i] == '+' || pszStr[i] == '-')
- {
- if (i != 0)
- return FALSE;
- }
- else if (!(pszStr[i] >= '0' && pszStr[i] <= '9'))
- return FALSE;
- }
- return TRUE;
-}
-
-/************************************************************************/
/* startElementLoadSchemaCbk() */
/************************************************************************/
@@ -1973,21 +1951,12 @@ void OGRGeoRSSLayer::startElementLoadSchemaCbk(const char *pszName, const char *
if (currentAttrFieldDefn->GetType() == OFTInteger ||
currentAttrFieldDefn->GetType() == OFTReal)
{
- char* pszRemainingStr = NULL;
- CPLStrtod(ppszAttr[i + 1], &pszRemainingStr);
- if (pszRemainingStr == NULL ||
- *pszRemainingStr == 0 ||
- *pszRemainingStr == ' ')
+ const CPLValueType eType = CPLGetValueType(ppszAttr[i+1]);
+ if( eType == CPL_VALUE_REAL )
{
- if (currentAttrFieldDefn->GetType() == OFTInteger)
- {
- if( !OGRGeoRSSIsInt(ppszAttr[i + 1]) )
- {
- currentAttrFieldDefn->SetType(OFTReal);
- }
- }
+ currentAttrFieldDefn->SetType(OFTReal);
}
- else
+ else if( eType == CPL_VALUE_STRING )
{
currentAttrFieldDefn->SetType(OFTString);
}
@@ -2146,25 +2115,16 @@ void OGRGeoRSSLayer::endElementLoadSchemaCbk(const char *pszName)
if (currentFieldDefn->GetType() == OFTInteger ||
currentFieldDefn->GetType() == OFTReal)
{
- char* pszRemainingStr = NULL;
- CPLStrtod(pszSubElementValue, &pszRemainingStr);
- if (pszRemainingStr == NULL ||
- *pszRemainingStr == 0 ||
- *pszRemainingStr == ' ')
+ const CPLValueType eType = CPLGetValueType(pszSubElementValue);
+ if( eType == CPL_VALUE_REAL )
{
- if (currentFieldDefn->GetType() == OFTInteger)
- {
- if( !OGRGeoRSSIsInt(pszSubElementValue) )
- {
- currentFieldDefn->SetType(OFTReal);
- }
- }
+ currentFieldDefn->SetType(OFTReal);
}
- else
+ else if( eType == CPL_VALUE_STRING )
{
currentFieldDefn->SetType(OFTString);
}
- }
+ }
}
CPLFree(pszSubElementName);
diff --git a/ogr/ogrsf_frmts/gml/gmlreader.cpp b/ogr/ogrsf_frmts/gml/gmlreader.cpp
index 0f166c5..e03fadf 100644
--- a/ogr/ogrsf_frmts/gml/gmlreader.cpp
+++ b/ogr/ogrsf_frmts/gml/gmlreader.cpp
@@ -44,7 +44,7 @@
#include "gmlutils.h"
#include "ogr_geometry.h"
-CPL_CVSID("$Id: gmlreader.cpp 39985 2017-09-02 20:44:23Z rouault $");
+CPL_CVSID("$Id: gmlreader.cpp 40124 2017-09-15 15:12:08Z rouault $");
/************************************************************************/
/* ~IGMLReader() */
@@ -1334,6 +1334,12 @@ bool GMLReader::PrescanForSchema( bool bGetExtents,
std::string osWork;
+ for( int i = 0; i < m_nClassCount; i++ )
+ {
+ m_papoClass[i]->SetFeatureCount(-1);
+ m_papoClass[i]->SetSRSName(NULL);
+ }
+
GMLFeature *poFeature = NULL;
while( (poFeature = NextFeature()) != NULL )
{
diff --git a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
index 55545d1..21139c1 100644
--- a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
+++ b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
@@ -50,7 +50,7 @@
#include "ogr_p.h"
#include "parsexsd.h"
-CPL_CVSID("$Id: ogrgmldatasource.cpp 37914 2017-04-06 17:38:46Z rouault $");
+CPL_CVSID("$Id: ogrgmldatasource.cpp 40503 2017-10-19 21:07:17Z rouault $");
/************************************************************************/
/* ReplaceSpaceByPct20IfNeeded() */
@@ -270,6 +270,12 @@ bool OGRGMLDataSource::CheckHeader(const char *pszStr)
return false;
}
+ // Ignore kml files
+ if( strstr(pszStr, "<kml") != NULL )
+ {
+ return false;
+ }
+
// Ignore .xsd schemas.
if( strstr(pszStr, "<schema") != NULL ||
strstr(pszStr, "<xs:schema") != NULL ||
@@ -2699,8 +2705,9 @@ void OGRGMLDataSource::FindAndParseTopElements(VSILFILE *fp)
}
}
+ const char *pszFeatureMember = strstr(pszXML, "<gml:featureMember");
const char *pszDescription = strstr(pszXML, "<gml:description>");
- if( pszDescription )
+ if( pszDescription && (pszFeatureMember == NULL || pszDescription < pszFeatureMember) )
{
pszDescription += strlen("<gml:description>");
const char *pszEndDescription =
@@ -2719,7 +2726,7 @@ void OGRGMLDataSource::FindAndParseTopElements(VSILFILE *fp)
const char *l_pszName = strstr(pszXML, "<gml:name");
if( l_pszName )
l_pszName = strchr(l_pszName, '>');
- if( l_pszName )
+ if( l_pszName && (pszFeatureMember == NULL || l_pszName < pszFeatureMember) )
{
l_pszName++;
const char *pszEndName = strstr(l_pszName, "</gml:name>");
diff --git a/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp b/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
index 2c16785..a3ef402 100644
--- a/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
+++ b/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
@@ -33,7 +33,7 @@
#include <algorithm>
#include <limits>
-CPL_CVSID("$Id: gdalgeopackagerasterband.cpp 39966 2017-08-30 15:28:52Z rouault $");
+CPL_CVSID("$Id: gdalgeopackagerasterband.cpp 40466 2017-10-17 12:22:04Z rouault $");
#if !defined(DEBUG_VERBOSE) && defined(DEBUG_VERBOSE_GPKG)
#define DEBUG_VERBOSE
@@ -3282,7 +3282,8 @@ void GDALGPKGMBTilesLikeRasterBand::SetNoDataValueInternal( double dfNoDataValue
GDALGeoPackageRasterBand::GDALGeoPackageRasterBand(
GDALGeoPackageDataset* poDSIn, int nTileWidth, int nTileHeight) :
- GDALGPKGMBTilesLikeRasterBand(poDSIn, nTileWidth, nTileHeight)
+ GDALGPKGMBTilesLikeRasterBand(poDSIn, nTileWidth, nTileHeight),
+ m_bStatsComputed(false)
{
poDS = poDSIn;
}
@@ -3369,11 +3370,13 @@ char** GDALGeoPackageRasterBand::GetMetadata(const char* pszDomain)
GDALGeoPackageDataset *poGDS
= reinterpret_cast<GDALGeoPackageDataset *>( poDS );
- if( eDataType != GDT_Byte &&
+ if( poGDS->eAccess == GA_ReadOnly &&
+ eDataType != GDT_Byte &&
(pszDomain == NULL || EQUAL(pszDomain, "")) &&
- CSLFetchNameValue(GDALGPKGMBTilesLikeRasterBand::GetMetadata(),
- "STATISTICS_MINIMUM") == NULL )
+ !m_bStatsComputed )
{
+ m_bStatsComputed = true;
+
const int nColMin = poGDS->m_nShiftXTiles;
const int nColMax = (nRasterXSize - 1 + poGDS->m_nShiftXPixelsMod) /
nBlockXSize + poGDS->m_nShiftXTiles;
@@ -3426,15 +3429,17 @@ char** GDALGeoPackageRasterBand::GetMetadata(const char* pszDomain)
{
char* pszSQL = sqlite3_mprintf(
"SELECT MIN(min), MAX(max) FROM "
- "gpkg_2d_gridded_tile_ancillary t_a JOIN \"%w\" tpudt ON "
- "t_a.tpudt_id = tpudt.id WHERE tpudt.zoom_level = %d AND "
- "tpudt.tile_column >= %d AND tpudt.tile_column <= %d AND "
- "tpudt.tile_row >= %d AND tpudt.tile_row <= %d",
+ "gpkg_2d_gridded_tile_ancillary WHERE tpudt_id "
+ "IN (SELECT id FROM \"%w\" WHERE "
+ "zoom_level = %d AND "
+ "tile_column >= %d AND tile_column <= %d AND "
+ "tile_row >= %d AND tile_row <= %d)",
poGDS->m_osRasterTable.c_str(),
poGDS->m_nZoomLevel,
nColMin, nColMax,
nRowMin, nRowMax);
SQLResult sResult;
+ CPLDebug("GPKG", "%s", pszSQL);
if( SQLQuery( poGDS->IGetDB(), pszSQL, &sResult) == OGRERR_NONE &&
sResult.nRowCount == 1 )
{
@@ -3468,7 +3473,9 @@ const char* GDALGeoPackageRasterBand::GetMetadataItem(const char* pszName,
const char* pszDomain)
{
if( eDataType != GDT_Byte &&
- (pszDomain == NULL || EQUAL(pszDomain, "")) )
+ (pszDomain == NULL || EQUAL(pszDomain, "")) &&
+ (EQUAL(pszName, "STATISTICS_MINIMUM") ||
+ EQUAL(pszName, "STATISTICS_MAXIMUM")) )
{
GetMetadata();
}
diff --git a/ogr/ogrsf_frmts/gpkg/ogr_geopackage.h b/ogr/ogrsf_frmts/gpkg/ogr_geopackage.h
index a5b35d7..ade9dd0 100644
--- a/ogr/ogrsf_frmts/gpkg/ogr_geopackage.h
+++ b/ogr/ogrsf_frmts/gpkg/ogr_geopackage.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: ogr_geopackage.h 37872 2017-03-31 18:59:47Z rouault $
+ * $Id: ogr_geopackage.h 40466 2017-10-17 12:22:04Z rouault $
*
* Project: GeoPackage Translator
* Purpose: Definition of classes for OGR GeoPackage driver.
@@ -275,6 +275,8 @@ class GDALGeoPackageDataset CPL_FINAL : public OGRSQLiteBaseDataSource, public G
class GDALGeoPackageRasterBand CPL_FINAL: public GDALGPKGMBTilesLikeRasterBand
{
+ bool m_bStatsComputed;
+
public:
GDALGeoPackageRasterBand(GDALGeoPackageDataset* poDS,
int nTileWidth, int nTileHeight);
diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
index 1d6b2b0..288735c 100644
--- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
+++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
@@ -33,7 +33,7 @@
#include "cpl_time.h"
#include "ogr_p.h"
-CPL_CVSID("$Id: ogrgeopackagetablelayer.cpp 39649 2017-07-24 15:43:36Z rouault $");
+CPL_CVSID("$Id: ogrgeopackagetablelayer.cpp 40670 2017-11-09 15:24:07Z rouault $");
static const char UNSUPPORTED_OP_READ_ONLY[] =
"%s : unsupported operation on a read-only datasource.";
@@ -2219,15 +2219,18 @@ OGRErr OGRGeoPackageTableLayer::GetExtent(OGREnvelope *psExtent, int bForce)
}
else
{
- pszSQL = sqlite3_mprintf(
- "UPDATE gpkg_contents SET "
- "min_x = NULL, min_y = NULL, "
- "max_x = NULL, max_y = NULL "
- "WHERE lower(table_name) = lower('%q') AND "
- "Lower(data_type) = 'features'",
- m_pszTableName);
- SQLCommand( m_poDS->GetDB(), pszSQL);
- sqlite3_free(pszSQL);
+ if( m_poDS->GetUpdate() )
+ {
+ pszSQL = sqlite3_mprintf(
+ "UPDATE gpkg_contents SET "
+ "min_x = NULL, min_y = NULL, "
+ "max_x = NULL, max_y = NULL "
+ "WHERE lower(table_name) = lower('%q') AND "
+ "Lower(data_type) = 'features'",
+ m_pszTableName);
+ SQLCommand( m_poDS->GetDB(), pszSQL);
+ sqlite3_free(pszSQL);
+ }
m_bExtentChanged = false;
err = OGRERR_FAILURE; // we didn't get an extent
}
diff --git a/ogr/ogrsf_frmts/gtm/gtm.cpp b/ogr/ogrsf_frmts/gtm/gtm.cpp
index 2bf9964..7b9a08c 100644
--- a/ogr/ogrsf_frmts/gtm/gtm.cpp
+++ b/ogr/ogrsf_frmts/gtm/gtm.cpp
@@ -29,7 +29,7 @@
#include "gtm.h"
-CPL_CVSID("$Id: gtm.cpp 38444 2017-05-17 08:54:05Z rouault $");
+CPL_CVSID("$Id: gtm.cpp 40629 2017-11-03 19:50:33Z rouault $");
/************************************************************************/
/* Methods for dealing with write on files and buffers */
@@ -810,8 +810,6 @@ bool GTM::readFile(void* pBuffer, size_t nSize, size_t nCount)
const size_t nRead = VSIFReadL( pBuffer, nSize, nCount, pGTMFile );
if (nRead == 0)
{
- VSIFCloseL( pGTMFile );
- pGTMFile = NULL;
return false;
}
return true;
diff --git a/ogr/ogrsf_frmts/mdb/ogr_mdb.h b/ogr/ogrsf_frmts/mdb/ogr_mdb.h
index 2e0e0c0..4a2b2bf 100644
--- a/ogr/ogrsf_frmts/mdb/ogr_mdb.h
+++ b/ogr/ogrsf_frmts/mdb/ogr_mdb.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: ogr_mdb.h 36501 2016-11-25 14:09:24Z rouault $
+ * $Id: ogr_mdb.h 40686 2017-11-10 22:43:51Z rouault $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Private definitions for MDB driver.
@@ -43,11 +43,16 @@
class OGRMDBJavaEnv
{
+ GIntBig nLastPID;
+
+ int Init();
+
public:
OGRMDBJavaEnv();
~OGRMDBJavaEnv();
- int Init();
+ int InitIfNeeded();
+ static void CleanupMutex();
JavaVM *jvm;
JNIEnv *env;
diff --git a/ogr/ogrsf_frmts/mdb/ogrmdbdatasource.cpp b/ogr/ogrsf_frmts/mdb/ogrmdbdatasource.cpp
index 0785dbf..14a4ef2 100644
--- a/ogr/ogrsf_frmts/mdb/ogrmdbdatasource.cpp
+++ b/ogr/ogrsf_frmts/mdb/ogrmdbdatasource.cpp
@@ -32,7 +32,7 @@
#include <vector>
#include "ogrgeomediageometry.h"
-CPL_CVSID("$Id: ogrmdbdatasource.cpp 35911 2016-10-24 15:03:26Z goatbar $");
+CPL_CVSID("$Id: ogrmdbdatasource.cpp 40686 2017-11-10 22:43:51Z rouault $");
/************************************************************************/
/* OGRMDBDataSource() */
@@ -290,7 +290,7 @@ int OGRMDBDataSource::Open( const char * pszNewName )
pszName = CPLStrdup( pszNewName );
- if (!env.Init())
+ if (!env.InitIfNeeded())
return FALSE;
poDB = OGRMDBDatabase::Open(&env, pszNewName);
diff --git a/ogr/ogrsf_frmts/mdb/ogrmdbdriver.cpp b/ogr/ogrsf_frmts/mdb/ogrmdbdriver.cpp
index 2c69474..4ac0ae9 100644
--- a/ogr/ogrsf_frmts/mdb/ogrmdbdriver.cpp
+++ b/ogr/ogrsf_frmts/mdb/ogrmdbdriver.cpp
@@ -29,7 +29,7 @@
#include "ogr_mdb.h"
#include "cpl_conv.h"
-CPL_CVSID("$Id: ogrmdbdriver.cpp 35911 2016-10-24 15:03:26Z goatbar $");
+CPL_CVSID("$Id: ogrmdbdriver.cpp 40686 2017-11-10 22:43:51Z rouault $");
// g++ -fPIC -g -Wall ogr/ogrsf_frmts/mdb/*.cpp -shared -o ogr_MDB.so -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mdb -L. -lgdal -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -ljvm
@@ -42,6 +42,7 @@ extern "C" void RegisterOGRMDB();
OGRMDBDriver::~OGRMDBDriver()
{
+ OGRMDBJavaEnv::CleanupMutex();
}
/************************************************************************/
diff --git a/ogr/ogrsf_frmts/mdb/ogrmdbjackcess.cpp b/ogr/ogrsf_frmts/mdb/ogrmdbjackcess.cpp
index d981b5e..c8c272e 100644
--- a/ogr/ogrsf_frmts/mdb/ogrmdbjackcess.cpp
+++ b/ogr/ogrsf_frmts/mdb/ogrmdbjackcess.cpp
@@ -27,8 +27,9 @@
****************************************************************************/
#include "ogr_mdb.h"
+#include "cpl_multiproc.h"
-CPL_CVSID("$Id: ogrmdbjackcess.cpp 36981 2016-12-20 19:46:41Z rouault $");
+CPL_CVSID("$Id: ogrmdbjackcess.cpp 40741 2017-11-18 09:01:58Z rouault $")
#if JVM_LIB_DLOPEN
#include <limits.h>
@@ -36,7 +37,7 @@ CPL_CVSID("$Id: ogrmdbjackcess.cpp 36981 2016-12-20 19:46:41Z rouault $");
#endif
static JavaVM *jvm_static = NULL;
-static JNIEnv *env_static = NULL;
+static CPLMutex* hMutex = NULL;
/************************************************************************/
/* OGRMDBJavaEnv() */
@@ -44,6 +45,7 @@ static JNIEnv *env_static = NULL;
OGRMDBJavaEnv::OGRMDBJavaEnv()
{
+ nLastPID = 0;
jvm = NULL;
env = NULL;
bCalledFromJava = FALSE;
@@ -158,11 +160,42 @@ OGRMDBJavaEnv::~OGRMDBJavaEnv()
return FALSE;} } while( false )
/************************************************************************/
+/* CleanupMutex() */
+/************************************************************************/
+
+void OGRMDBJavaEnv::CleanupMutex()
+{
+ if( hMutex )
+ CPLDestroyMutex(hMutex);
+ hMutex = NULL;
+}
+
+/************************************************************************/
+/* InitIfNeeded() */
+/************************************************************************/
+
+int OGRMDBJavaEnv::InitIfNeeded()
+{
+ GIntBig nCurPID = CPLGetPID();
+ if( env == NULL || bCalledFromJava || nLastPID != nCurPID )
+ {
+ nLastPID = nCurPID;
+ return Init();
+ }
+ return env != NULL;
+}
+
+/************************************************************************/
/* Init() */
/************************************************************************/
int OGRMDBJavaEnv::Init()
{
+ CPLMutexHolderD(&hMutex);
+
+ jvm = NULL;
+ env = NULL;
+
if (jvm_static == NULL)
{
JavaVM* vmBuf[1];
@@ -278,14 +311,21 @@ int OGRMDBJavaEnv::Init()
}
jvm_static = jvm;
- env_static = env;
}
}
else
{
jvm = jvm_static;
- env = env_static;
}
+
+ if( jvm == NULL )
+ return FALSE;
+
+ if (jvm->GetEnv((void **)&env, JNI_VERSION_1_2) == JNI_EDETACHED )
+ {
+ jvm->AttachCurrentThread((void **)&env, NULL);
+ }
+
if( env == NULL )
return FALSE;
@@ -424,8 +464,8 @@ OGRMDBDatabase* OGRMDBDatabase::Open(OGRMDBJavaEnv* env, const char* pszName)
int OGRMDBDatabase::FetchTableNames()
{
- if (env->bCalledFromJava)
- env->Init();
+ if( !env->InitIfNeeded() )
+ return FALSE;
jobject table_set = env->env->CallObjectMethod(database, env->database_getTableNames);
if (env->ExceptionOccurred()) return FALSE;
@@ -457,8 +497,8 @@ int OGRMDBDatabase::FetchTableNames()
OGRMDBTable* OGRMDBDatabase::GetTable(const char* pszTableName)
{
- if (env->bCalledFromJava)
- env->Init();
+ if( !env->InitIfNeeded() )
+ return NULL;
jstring table_name_jstring = env->env->NewStringUTF(pszTableName);
jobject table = env->env->CallObjectMethod(database, env->database_getTable, table_name_jstring);
@@ -502,12 +542,9 @@ OGRMDBTable::OGRMDBTable(OGRMDBJavaEnv* envIn, OGRMDBDatabase* poDBIn,
OGRMDBTable::~OGRMDBTable()
{
- if (env)
+ if (env && env->InitIfNeeded())
{
//CPLDebug("MDB", "Freeing table %s", osTableName.c_str());
- if (env->bCalledFromJava)
- env->Init();
-
int i;
for(i=0;i<(int)apoColumnNameObjects.size();i++)
env->env->DeleteGlobalRef(apoColumnNameObjects[i]);
@@ -524,8 +561,8 @@ OGRMDBTable::~OGRMDBTable()
int OGRMDBTable::FetchColumns()
{
- if (env->bCalledFromJava)
- env->Init();
+ if( !env->InitIfNeeded() )
+ return FALSE;
jobject column_lists = env->env->CallObjectMethod(table, env->table_getColumns);
if (env->ExceptionOccurred()) return FALSE;
@@ -585,8 +622,8 @@ int OGRMDBTable::FetchColumns()
void OGRMDBTable::ResetReading()
{
- if (env->bCalledFromJava)
- env->Init();
+ if( !env->InitIfNeeded() )
+ return;
env->env->DeleteGlobalRef(table_iterator_obj);
table_iterator_obj = NULL;
@@ -600,8 +637,8 @@ void OGRMDBTable::ResetReading()
int OGRMDBTable::GetNextRow()
{
- if (env->bCalledFromJava)
- env->Init();
+ if( !env->InitIfNeeded() )
+ return FALSE;
if (table_iterator_obj == NULL)
{
@@ -821,8 +858,9 @@ int OGRMDBTable::GetColumnIndex(const char* pszColName, int bEmitErrorIfNotFound
int OGRMDBTable::GetRowCount()
{
- if (env->bCalledFromJava)
- env->Init();
+ if( !env->InitIfNeeded() )
+ return 0;
+
int nRowCount = env->env->CallIntMethod(table, env->table_getRowCount);
if (env->ExceptionOccurred()) return 0;
return nRowCount;
diff --git a/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp b/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp
index ce32c42..82d19b2 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp
@@ -55,7 +55,7 @@
#include "ogr_spatialref.h"
#include "ogrsf_frmts.h"
-CPL_CVSID("$Id: mitab_tabfile.cpp 38309 2017-05-14 09:26:54Z rouault $");
+CPL_CVSID("$Id: mitab_tabfile.cpp 40513 2017-10-20 16:03:10Z rouault $");
static const char UNSUPPORTED_OP_READ_ONLY[] =
"%s : unsupported operation on a read-only datasource.";
@@ -374,8 +374,12 @@ int TABFile::Open(const char *pszFname, TABAccess eAccess,
* is not an error... it simply means that all features will be returned
* with NONE geometry.
*----------------------------------------------------------------*/
+ bool bUpperCase = false;
if (nFnameLen > 4 && strcmp(pszTmpFname+nFnameLen-4, ".DAT")==0)
+ {
+ bUpperCase = true;
strcpy(pszTmpFname+nFnameLen-4, ".MAP");
+ }
else
strcpy(pszTmpFname+nFnameLen-4, ".map");
@@ -442,22 +446,40 @@ int TABFile::Open(const char *pszFname, TABAccess eAccess,
/*-----------------------------------------------------------------
* Initializing the attribute index (.IND) support
*----------------------------------------------------------------*/
+ bool bHasIndex = false;
CPLXMLNode *psRoot = CPLCreateXMLNode( NULL, CXT_Element, "OGRMILayerAttrIndex" );
- CPLCreateXMLElementAndValue( psRoot, "MIIDFilename", CPLResetExtension( pszFname, "IND" ) );
OGRFeatureDefn *poLayerDefn = GetLayerDefn();
- int iField, iIndexIndex, bHasIndex = 0;
- for( iField = 0; iField < poLayerDefn->GetFieldCount(); iField++ )
+ for( int iField = 0; iField < poLayerDefn->GetFieldCount(); iField++ )
{
- iIndexIndex = GetFieldIndexNumber(iField);
+ int iIndexIndex = GetFieldIndexNumber(iField);
if (iIndexIndex > 0)
{
+ if( !bHasIndex )
+ {
+ const char* pszIndFilename = CPLFormCIFilename(
+ CPLGetPath(pszFname),
+ CPLGetBasename(pszFname),
+ (bUpperCase) ? "IND" : "ind" );
+ VSIStatBufL sStat;
+ if( VSIStatL( pszIndFilename, &sStat) == 0 )
+ {
+ CPLCreateXMLElementAndValue( psRoot, "MIIDFilename", pszIndFilename );
+ }
+ else
+ {
+ CPLDebug("MITAB", "At least one field is supposed to be indexed, "
+ "but index file is missing");
+ break;
+ }
+ }
+
CPLXMLNode *psIndex = CPLCreateXMLNode( psRoot, CXT_Element, "OGRMIAttrIndex" );
CPLCreateXMLElementAndValue( psIndex, "FieldIndex", CPLSPrintf( "%d", iField ) );
CPLCreateXMLElementAndValue( psIndex, "FieldName",
poLayerDefn->GetFieldDefn(iField)->GetNameRef() );
CPLCreateXMLElementAndValue( psIndex, "IndexIndex", CPLSPrintf( "%d", iIndexIndex ) );
- bHasIndex = 1;
+ bHasIndex = true;
}
}
diff --git a/ogr/ogrsf_frmts/mysql/ogr_mysql.h b/ogr/ogrsf_frmts/mysql/ogr_mysql.h
index 76a6762..5d8b9cf 100644
--- a/ogr/ogrsf_frmts/mysql/ogr_mysql.h
+++ b/ogr/ogrsf_frmts/mysql/ogr_mysql.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: ogr_mysql.h 38631 2017-05-23 20:07:01Z rouault $
+ * $Id: ogr_mysql.h 40363 2017-10-08 17:20:37Z rouault $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Declarations for MySQL OGR Driver Classes.
@@ -43,7 +43,6 @@
#pragma warning( disable : 4211 ) /* nonstandard extension used : redefined extern to static */
#endif
-#include <my_global.h>
#include <mysql.h>
#ifdef _MSC_VER
diff --git a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
index e694bbd..4bb6bcb 100644
--- a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
+++ b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
@@ -31,34 +31,10 @@
#include <string>
#include "ogr_mysql.h"
-#ifdef _MSC_VER
-#pragma warning( push )
-#pragma warning( disable : 4201 ) /* nonstandard extension used : nameless struct/union */
-#endif
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-#endif
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunknown-pragmas"
-#pragma clang diagnostic ignored "-Wdocumentation"
-#endif
-#include <my_sys.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
-#pragma GCC diagnostic pop
-#endif
-#ifdef _MSC_VER
-#pragma warning( pop )
-#endif
-
#include "cpl_conv.h"
#include "cpl_string.h"
-CPL_CVSID("$Id: ogrmysqldatasource.cpp 37230 2017-01-28 19:24:50Z rouault $");
+CPL_CVSID("$Id: ogrmysqldatasource.cpp 40363 2017-10-08 17:20:37Z rouault $");
/************************************************************************/
/* OGRMySQLDataSource() */
/************************************************************************/
diff --git a/ogr/ogrsf_frmts/oci/ogrocisession.cpp b/ogr/ogrsf_frmts/oci/ogrocisession.cpp
index 57ec205..d0d0797 100644
--- a/ogr/ogrsf_frmts/oci/ogrocisession.cpp
+++ b/ogr/ogrsf_frmts/oci/ogrocisession.cpp
@@ -30,7 +30,7 @@
#include "ogr_oci.h"
#include "cpl_conv.h"
-CPL_CVSID("$Id: ogrocisession.cpp 38061 2017-04-19 05:23:56Z ilucena $");
+CPL_CVSID("$Id: ogrocisession.cpp 40697 2017-11-13 13:26:12Z rouault $");
/************************************************************************/
/* OGRGetOCISession() */
@@ -141,16 +141,13 @@ int OGROCISession::EstablishSession( const char *pszUseridIn,
/* Initialize Environment handler */
/* -------------------------------------------------------------------- */
- if( Failed( OCIInitialize((ub4) (OCI_DEFAULT | OCI_OBJECT), (dvoid *)0,
- (dvoid * (*)(dvoid *, size_t)) 0,
- (dvoid * (*)(dvoid *, dvoid *, size_t))0,
- (void (*)(dvoid *, dvoid *)) 0 ) ) )
- {
- return FALSE;
- }
-
- if( Failed( OCIEnvInit( (OCIEnv **) &hEnv, OCI_DEFAULT, (size_t) 0,
- (dvoid **) 0 ) ) )
+ if( Failed( OCIEnvCreate( (OCIEnv **) &hEnv, OCI_THREADED | OCI_OBJECT,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ NULL ) ) )
{
return FALSE;
}
@@ -324,7 +321,7 @@ int OGROCISession::EstablishSession( const char *pszUseridIn,
nMaxNameLength = 128;
}
- CPLFree( papszNameValue );
+ CSLDestroy( papszNameValue );
/* -------------------------------------------------------------------- */
/* Setting up the OGR compatible time formatting rules. */
diff --git a/ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp b/ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp
index 4d7ddc6..9d62b8f 100644
--- a/ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp
+++ b/ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp
@@ -32,7 +32,7 @@
#include "cpl_conv.h"
#include "cpl_string.h"
-CPL_CVSID("$Id: ogrocitablelayer.cpp 39942 2017-08-25 19:26:57Z rouault $");
+CPL_CVSID("$Id: ogrocitablelayer.cpp 40697 2017-11-13 13:26:12Z rouault $");
static int nDiscarded = 0;
static int nHits = 0;
@@ -616,6 +616,8 @@ OGRFeature *OGROCITableLayer::GetFeature( GIntBig nFeatureId )
" WHERE \"%s\" = " CPL_FRMT_GIB " ",
pszFIDName, nFeatureId );
+ CPLFree( pszFields );
+
/* -------------------------------------------------------------------- */
/* Execute the statement. */
/* -------------------------------------------------------------------- */
diff --git a/ogr/ogrsf_frmts/ods/ogrodsdatasource.cpp b/ogr/ogrsf_frmts/ods/ogrodsdatasource.cpp
index bae9716..6d04195 100644
--- a/ogr/ogrsf_frmts/ods/ogrodsdatasource.cpp
+++ b/ogr/ogrsf_frmts/ods/ogrodsdatasource.cpp
@@ -34,7 +34,7 @@
#include "ods_formula.h"
#include <set>
-CPL_CVSID("$Id: ogrodsdatasource.cpp 37371 2017-02-13 11:41:59Z rouault $");
+CPL_CVSID("$Id: ogrodsdatasource.cpp 40632 2017-11-04 11:29:43Z rouault $");
namespace OGRODS {
@@ -1710,12 +1710,13 @@ void OGRODSDataSource::FlushCache()
hZIP = NULL;
/* Re-open with VSILFILE */
- VSILFILE* fpZIP = VSIFOpenL(CPLSPrintf("/vsizip/%s", pszName), "ab");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s", pszName));
+ VSILFILE* fpZIP = VSIFOpenL(osTmpFilename, "ab");
if (fpZIP == NULL)
return;
- VSILFILE* fp = VSIFOpenL(CPLSPrintf(
- "/vsizip/%s/META-INF/manifest.xml", pszName), "wb");
+ osTmpFilename = CPLSPrintf("/vsizip/%s/META-INF/manifest.xml", pszName);
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFPrintfL(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
VSIFPrintfL(
fp,
@@ -1737,7 +1738,8 @@ void OGRODSDataSource::FlushCache()
VSIFPrintfL(fp, "</manifest:manifest>\n");
VSIFCloseL(fp);
- fp = VSIFOpenL(CPLSPrintf("/vsizip/%s/meta.xml", pszName), "wb");
+ osTmpFilename = CPLSPrintf("/vsizip/%s/meta.xml", pszName);
+ fp = VSIFOpenL(osTmpFilename, "wb");
VSIFPrintfL(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
VSIFPrintfL(
fp, "<office:document-meta "
@@ -1746,7 +1748,8 @@ void OGRODSDataSource::FlushCache()
VSIFPrintfL(fp, "</office:document-meta>\n");
VSIFCloseL(fp);
- fp = VSIFOpenL(CPLSPrintf("/vsizip/%s/settings.xml", pszName), "wb");
+ osTmpFilename = CPLSPrintf("/vsizip/%s/settings.xml", pszName);
+ fp = VSIFOpenL(osTmpFilename, "wb");
VSIFPrintfL(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
VSIFPrintfL(
fp, "<office:document-settings "
@@ -1801,7 +1804,8 @@ void OGRODSDataSource::FlushCache()
VSIFPrintfL(fp, "</office:document-settings>\n");
VSIFCloseL(fp);
- fp = VSIFOpenL(CPLSPrintf("/vsizip/%s/styles.xml", pszName), "wb");
+ osTmpFilename = CPLSPrintf("/vsizip/%s/styles.xml", pszName);
+ fp = VSIFOpenL(osTmpFilename, "wb");
VSIFPrintfL(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
VSIFPrintfL(
fp, "<office:document-styles "
@@ -1816,7 +1820,8 @@ void OGRODSDataSource::FlushCache()
VSIFPrintfL(fp, "</office:document-styles>\n");
VSIFCloseL(fp);
- fp = VSIFOpenL(CPLSPrintf("/vsizip/%s/content.xml", pszName), "wb");
+ osTmpFilename = CPLSPrintf("/vsizip/%s/content.xml", pszName);
+ fp = VSIFOpenL(osTmpFilename, "wb");
VSIFPrintfL(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
VSIFPrintfL(
fp, "<office:document-content "
diff --git a/ogr/ogrsf_frmts/ods/ogrodsdriver.cpp b/ogr/ogrsf_frmts/ods/ogrodsdriver.cpp
index e018f04..6a26f1c 100644
--- a/ogr/ogrsf_frmts/ods/ogrodsdriver.cpp
+++ b/ogr/ogrsf_frmts/ods/ogrodsdriver.cpp
@@ -30,7 +30,7 @@
#include "ogr_ods.h"
#include "ogrsf_frmts.h"
-CPL_CVSID("$Id: ogrodsdriver.cpp 34819 2016-07-28 22:32:18Z goatbar $");
+CPL_CVSID("$Id: ogrodsdriver.cpp 40632 2017-11-04 11:29:43Z rouault $");
using namespace OGRODS;
@@ -124,8 +124,8 @@ OGRDataSource *OGRODSDriver::Open( const char * pszFilename, int bUpdate )
if (EQUAL(CPLGetExtension(pszFilename), "ODS"))
{
- fpSettings =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/settings.xml", pszFilename), "rb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/settings.xml", pszFilename));
+ fpSettings = VSIFOpenL(osTmpFilename, "rb");
}
OGRODSDataSource *poDS = new OGRODSDataSource();
diff --git a/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp b/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
index 3392cc0..d5bb78a 100644
--- a/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
+++ b/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
@@ -39,7 +39,7 @@
static const char UNSUPPORTED_OP_READ_ONLY[] =
"%s : unsupported operation on a read-only datasource.";
-CPL_CVSID("$Id: ogrshapelayer.cpp 40020 2017-09-07 11:41:25Z rouault $");
+CPL_CVSID("$Id: ogrshapelayer.cpp 40607 2017-11-01 13:10:02Z rouault $");
/************************************************************************/
/* OGRShapeLayer() */
@@ -1480,7 +1480,7 @@ GIntBig OGRShapeLayer::GetFeatureCount( int bForce )
}
// Attribute filter only.
- if( m_poAttrQuery != NULL )
+ if( m_poAttrQuery != NULL && m_poFilterGeom == NULL )
{
// See if we can ignore reading geometries.
const bool bSaveGeometryIgnored =
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp
index 454ebc1..8e3c80b 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp
@@ -61,7 +61,7 @@
static int bSpatialiteGlobalLoaded = FALSE;
#endif
-CPL_CVSID("$Id: ogrsqlitedatasource.cpp 37818 2017-03-21 07:53:27Z rouault $");
+CPL_CVSID("$Id: ogrsqlitedatasource.cpp 40703 2017-11-13 21:03:14Z rouault $");
/************************************************************************/
/* OGRSQLiteInitOldSpatialite() */
@@ -2130,7 +2130,8 @@ OGRLayer * OGRSQLiteDataSource::ExecuteSQL( const char *pszSQLCommand,
}
else if( !STARTS_WITH_CI(pszSQLCommand, "SELECT ") && !EQUAL(pszSQLCommand, "BEGIN")
&& !EQUAL(pszSQLCommand, "COMMIT")
- && !STARTS_WITH_CI(pszSQLCommand, "CREATE TABLE ") )
+ && !STARTS_WITH_CI(pszSQLCommand, "CREATE TABLE ")
+ && !STARTS_WITH_CI(pszSQLCommand, "PRAGMA ") )
{
for(int i = 0; i < nLayers; i++)
papoLayers[i]->InvalidateCachedFeatureCountAndExtent();
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
index 849d16f..00347ad 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
@@ -38,7 +38,7 @@
static const char UNSUPPORTED_OP_READ_ONLY[] =
"%s : unsupported operation on a read-only datasource.";
-CPL_CVSID("$Id: ogrsqlitetablelayer.cpp 39914 2017-08-23 13:07:42Z rouault $");
+CPL_CVSID("$Id: ogrsqlitetablelayer.cpp 40703 2017-11-13 21:03:14Z rouault $");
/************************************************************************/
/* OGRSQLiteTableLayer() */
@@ -1095,7 +1095,7 @@ GIntBig OGRSQLiteTableLayer::GetFeatureCount( int bForce )
{
nFeatureCount = nResult;
if( poDS->GetUpdate() )
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
}
}
@@ -1180,7 +1180,7 @@ OGRErr OGRSQLiteTableLayer::GetExtent(int iGeomField, OGREnvelope *psExtent, int
{
poGeomFieldDefn->bCachedExtentIsValid = TRUE;
if( poDS->GetUpdate() )
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
memcpy(&poGeomFieldDefn->oCachedExtent, psExtent, sizeof(poGeomFieldDefn->oCachedExtent));
}
}
@@ -1199,7 +1199,7 @@ OGRErr OGRSQLiteTableLayer::GetExtent(int iGeomField, OGREnvelope *psExtent, int
if( eErr == OGRERR_NONE && m_poFilterGeom == NULL && osQuery.empty() )
{
poGeomFieldDefn->bCachedExtentIsValid = TRUE;
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
memcpy(&poGeomFieldDefn->oCachedExtent, psExtent, sizeof(poGeomFieldDefn->oCachedExtent));
}
return eErr;
@@ -2509,7 +2509,7 @@ OGRErr OGRSQLiteTableLayer::ISetFeature( OGRFeature *poFeature )
poGeomFieldDefn->oCachedExtent.Merge(sGeomEnvelope);
}
}
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
}
return eErr;
@@ -2916,13 +2916,13 @@ OGRErr OGRSQLiteTableLayer::ICreateFeature( OGRFeature *poFeature )
poGeom->getEnvelope(&sGeomEnvelope);
poGeomFieldDefn->oCachedExtent.Merge(sGeomEnvelope);
poGeomFieldDefn->bCachedExtentIsValid = TRUE;
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
}
}
if( nFeatureCount >= 0 )
{
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
nFeatureCount ++;
}
@@ -2981,7 +2981,7 @@ OGRErr OGRSQLiteTableLayer::DeleteFeature( GIntBig nFID )
poGeomFieldDefn->bCachedExtentIsValid = FALSE;
}
nFeatureCount --;
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
}
return eErr;
@@ -3162,7 +3162,7 @@ int OGRSQLiteTableLayer::HasSpatialIndex(int iGeomCol)
void OGRSQLiteTableLayer::InitFeatureCount()
{
nFeatureCount = 0;
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
}
/************************************************************************/
@@ -3174,7 +3174,7 @@ void OGRSQLiteTableLayer::InvalidateCachedFeatureCountAndExtent()
nFeatureCount = -1;
for(int iGeomCol=0;iGeomCol<GetLayerDefn()->GetGeomFieldCount();iGeomCol++)
poFeatureDefn->myGetGeomFieldDefn(iGeomCol)->bCachedExtentIsValid = FALSE;
- bStatisticsNeedsToBeFlushed = TRUE;
+ ForceStatisticsToBeFlushed();
}
/************************************************************************/
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp
index 8f78f0e..1ee2e63 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp
@@ -667,6 +667,39 @@ int OGR2SQLITE_ConnectCreate(sqlite3* hDB, void *pAux,
}
/************************************************************************/
+/* OGR2SQLITE_IsHandledOp() */
+/************************************************************************/
+
+static bool OGR2SQLITE_IsHandledOp(int op)
+{
+ switch(op)
+ {
+ case SQLITE_INDEX_CONSTRAINT_EQ: return true;
+ case SQLITE_INDEX_CONSTRAINT_GT: return true;
+ case SQLITE_INDEX_CONSTRAINT_LE: return true;
+ case SQLITE_INDEX_CONSTRAINT_LT: return true;
+ case SQLITE_INDEX_CONSTRAINT_GE: return true;
+ case SQLITE_INDEX_CONSTRAINT_MATCH: return false; // unhandled
+#ifdef SQLITE_INDEX_CONSTRAINT_LIKE
+ /* SQLite >= 3.10 */
+ case SQLITE_INDEX_CONSTRAINT_LIKE: return true;
+ case SQLITE_INDEX_CONSTRAINT_GLOB: return false; // unhandled
+ case SQLITE_INDEX_CONSTRAINT_REGEXP: return false; // unhandled
+#endif
+#ifdef SQLITE_INDEX_CONSTRAINT_NE
+ /* SQLite >= 3.21 */
+ case SQLITE_INDEX_CONSTRAINT_NE: return true;
+ case SQLITE_INDEX_CONSTRAINT_ISNOT: return true;
+ case SQLITE_INDEX_CONSTRAINT_ISNOTNULL: return true;
+ case SQLITE_INDEX_CONSTRAINT_ISNULL: return true;;
+ case SQLITE_INDEX_CONSTRAINT_IS: return true;
+#endif
+ default: break;
+ }
+ return false;
+}
+
+/************************************************************************/
/* OGR2SQLITE_BestIndex() */
/************************************************************************/
@@ -698,6 +731,20 @@ int OGR2SQLITE_BestIndex(sqlite3_vtab *pVTab, sqlite3_index_info* pIndex)
case SQLITE_INDEX_CONSTRAINT_LT: pszOp = " < "; break;
case SQLITE_INDEX_CONSTRAINT_GE: pszOp = " >= "; break;
case SQLITE_INDEX_CONSTRAINT_MATCH: pszOp = " MATCH "; break;
+#ifdef SQLITE_INDEX_CONSTRAINT_LIKE
+ /* SQLite >= 3.10 */
+ case SQLITE_INDEX_CONSTRAINT_LIKE: pszOp = " LIKE "; break;
+ case SQLITE_INDEX_CONSTRAINT_GLOB: pszOp = " GLOB "; break;
+ case SQLITE_INDEX_CONSTRAINT_REGEXP: pszOp = " REGEXP "; break;
+#endif
+#ifdef SQLITE_INDEX_CONSTRAINT_NE
+ /* SQLite >= 3.21 */
+ case SQLITE_INDEX_CONSTRAINT_NE: pszOp = " <> "; break;
+ case SQLITE_INDEX_CONSTRAINT_ISNOT: pszOp = " IS NOT "; break;
+ case SQLITE_INDEX_CONSTRAINT_ISNOTNULL: pszOp= " IS NOT NULL"; break;
+ case SQLITE_INDEX_CONSTRAINT_ISNULL: pszOp = " IS NULL"; break;
+ case SQLITE_INDEX_CONSTRAINT_IS: pszOp = " IS "; break;
+#endif
default: pszOp = " (unknown op) "; break;
}
@@ -725,7 +772,7 @@ int OGR2SQLITE_BestIndex(sqlite3_vtab *pVTab, sqlite3_index_info* pIndex)
{
int iCol = pIndex->aConstraint[i].iColumn;
if (pIndex->aConstraint[i].usable &&
- pIndex->aConstraint[i].op != SQLITE_INDEX_CONSTRAINT_MATCH &&
+ OGR2SQLITE_IsHandledOp(pIndex->aConstraint[i].op) &&
iCol < poFDefn->GetFieldCount() &&
(iCol < 0 || poFDefn->GetFieldDefn(iCol)->GetType() != OFTBinary))
{
@@ -815,7 +862,7 @@ int OGR2SQLITE_Open(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor)
OGR2SQLITE_vtab* pMyVTab = (OGR2SQLITE_vtab*) pVTab;
#ifdef DEBUG_OGR2SQLITE
CPLDebug("OGR2SQLITE", "Open(%s, %s)",
- pMyVTab->poDS->GetName(), pMyVTab->poLayer->GetName());
+ pMyVTab->poDS->GetDescription(), pMyVTab->poLayer->GetDescription());
#endif
OGRDataSource* poDupDataSource = NULL;
@@ -877,7 +924,7 @@ int OGR2SQLITE_Close(sqlite3_vtab_cursor* pCursor)
OGR2SQLITE_vtab* pMyVTab = pMyCursor->pVTab;
#ifdef DEBUG_OGR2SQLITE
CPLDebug("OGR2SQLITE", "Close(%s, %s)",
- pMyVTab->poDS->GetName(), pMyVTab->poLayer->GetName());
+ pMyVTab->poDS->GetDescription(), pMyVTab->poLayer->GetDescription());
#endif
pMyVTab->nMyRef --;
@@ -959,6 +1006,7 @@ int OGR2SQLITE_Filter(sqlite3_vtab_cursor* pCursor,
osAttributeFilter += "FID";
}
+ bool bExpectRightOperator = true;
switch(panConstraints[2 * i + 2])
{
case SQLITE_INDEX_CONSTRAINT_EQ: osAttributeFilter += " = "; break;
@@ -966,6 +1014,21 @@ int OGR2SQLITE_Filter(sqlite3_vtab_cursor* pCursor,
case SQLITE_INDEX_CONSTRAINT_LE: osAttributeFilter += " <= "; break;
case SQLITE_INDEX_CONSTRAINT_LT: osAttributeFilter += " < "; break;
case SQLITE_INDEX_CONSTRAINT_GE: osAttributeFilter += " >= "; break;
+ // unhandled: SQLITE_INDEX_CONSTRAINT_MATCH
+#ifdef SQLITE_INDEX_CONSTRAINT_LIKE
+ /* SQLite >= 3.10 */
+ case SQLITE_INDEX_CONSTRAINT_LIKE: osAttributeFilter += " LIKE "; break;
+ // unhandled: SQLITE_INDEX_CONSTRAINT_GLOB
+ // unhandled: SQLITE_INDEX_CONSTRAINT_REGEXP
+#endif
+#ifdef SQLITE_INDEX_CONSTRAINT_NE
+ /* SQLite >= 3.21 */
+ case SQLITE_INDEX_CONSTRAINT_NE: osAttributeFilter += " <> "; break;
+ case SQLITE_INDEX_CONSTRAINT_ISNOT: osAttributeFilter += " IS NOT "; break;
+ case SQLITE_INDEX_CONSTRAINT_ISNOTNULL: osAttributeFilter += " IS NOT NULL"; bExpectRightOperator = false; break;
+ case SQLITE_INDEX_CONSTRAINT_ISNULL: osAttributeFilter += " IS NULL"; bExpectRightOperator = false; break;
+ case SQLITE_INDEX_CONSTRAINT_IS: osAttributeFilter += " IS "; break;
+#endif
default:
{
sqlite3_free(pMyCursor->pVTab->zErrMsg);
@@ -976,29 +1039,32 @@ int OGR2SQLITE_Filter(sqlite3_vtab_cursor* pCursor,
}
}
- if (sqlite3_value_type (argv[i]) == SQLITE_INTEGER)
+ if( bExpectRightOperator )
{
- osAttributeFilter +=
- CPLSPrintf(CPL_FRMT_GIB, sqlite3_value_int64 (argv[i]));
- }
- else if (sqlite3_value_type (argv[i]) == SQLITE_FLOAT)
- { // Insure that only Decimal.Points are used, never local settings such as Decimal.Comma.
- osAttributeFilter +=
- CPLSPrintf("%.18g", sqlite3_value_double (argv[i]));
- }
- else if (sqlite3_value_type (argv[i]) == SQLITE_TEXT)
- {
- osAttributeFilter += "'";
- osAttributeFilter += SQLEscapeLiteral((const char*) sqlite3_value_text (argv[i]));
- osAttributeFilter += "'";
- }
- else
- {
- sqlite3_free(pMyCursor->pVTab->zErrMsg);
- pMyCursor->pVTab->zErrMsg = sqlite3_mprintf(
- "Unhandled constraint data type : %d",
- sqlite3_value_type (argv[i]));
- return SQLITE_ERROR;
+ if (sqlite3_value_type (argv[i]) == SQLITE_INTEGER)
+ {
+ osAttributeFilter +=
+ CPLSPrintf(CPL_FRMT_GIB, sqlite3_value_int64 (argv[i]));
+ }
+ else if (sqlite3_value_type (argv[i]) == SQLITE_FLOAT)
+ { // Insure that only Decimal.Points are used, never local settings such as Decimal.Comma.
+ osAttributeFilter +=
+ CPLSPrintf("%.18g", sqlite3_value_double (argv[i]));
+ }
+ else if (sqlite3_value_type (argv[i]) == SQLITE_TEXT)
+ {
+ osAttributeFilter += "'";
+ osAttributeFilter += SQLEscapeLiteral((const char*) sqlite3_value_text (argv[i]));
+ osAttributeFilter += "'";
+ }
+ else
+ {
+ sqlite3_free(pMyCursor->pVTab->zErrMsg);
+ pMyCursor->pVTab->zErrMsg = sqlite3_mprintf(
+ "Unhandled constraint data type : %d",
+ sqlite3_value_type (argv[i]));
+ return SQLITE_ERROR;
+ }
}
}
diff --git a/ogr/ogrsf_frmts/xls/ogr_xls.h b/ogr/ogrsf_frmts/xls/ogr_xls.h
index adb0469..3007d91 100644
--- a/ogr/ogrsf_frmts/xls/ogr_xls.h
+++ b/ogr/ogrsf_frmts/xls/ogr_xls.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: ogr_xls.h 36501 2016-11-25 14:09:24Z rouault $
+ * $Id: ogr_xls.h 40701 2017-11-13 15:58:20Z rouault $
*
* Project: XLS Translator
* Purpose: Definition of classes for OGR .xls driver.
@@ -92,6 +92,10 @@ class OGRXLSDataSource : public OGRDataSource
const void* xlshandle;
+ CPLString m_osANSIFilename;
+#ifdef WIN32
+ CPLString m_osTempFilename;
+#endif
public:
OGRXLSDataSource();
virtual ~OGRXLSDataSource();
diff --git a/ogr/ogrsf_frmts/xls/ogrxlsdatasource.cpp b/ogr/ogrsf_frmts/xls/ogrxlsdatasource.cpp
index 87ff45f..1587d1e 100644
--- a/ogr/ogrsf_frmts/xls/ogrxlsdatasource.cpp
+++ b/ogr/ogrsf_frmts/xls/ogrxlsdatasource.cpp
@@ -36,7 +36,7 @@
#include "cpl_conv.h"
#include "cpl_string.h"
-CPL_CVSID("$Id: ogrxlsdatasource.cpp 35205 2016-08-26 18:17:08Z goatbar $");
+CPL_CVSID("$Id: ogrxlsdatasource.cpp 40701 2017-11-13 15:58:20Z rouault $");
/************************************************************************/
/* OGRXLSDataSource() */
@@ -64,6 +64,12 @@ OGRXLSDataSource::~OGRXLSDataSource()
if( xlshandle )
freexl_close(xlshandle);
+#ifdef WIN32
+ if( m_osTempFilename.empty() )
+ {
+ VSIUnlink(m_osTempFilename);
+ }
+#endif
}
/************************************************************************/
@@ -101,13 +107,32 @@ int OGRXLSDataSource::Open( const char * pszFilename, int bUpdateIn)
return FALSE;
}
-#ifdef _WIN32
+ pszName = CPLStrdup(pszFilename);
+ m_osANSIFilename = pszFilename;
+#ifdef WIN32
if( CPLTestBool( CPLGetConfigOption( "GDAL_FILENAME_IS_UTF8", "YES" ) ) )
- pszName = CPLRecode( pszFilename, CPL_ENC_UTF8, CPLString().Printf( "CP%d", GetACP() ) );
- else
- pszName = CPLStrdup( pszFilename );
-#else
- pszName = CPLStrdup( pszFilename );
+ {
+ CPLErrorReset();
+ CPLPushErrorHandler(CPLQuietErrorHandler);
+ char* pszTmpName = CPLRecode( pszFilename, CPL_ENC_UTF8, CPLString().Printf( "CP%d", GetACP() ) );
+ CPLPopErrorHandler();
+ m_osANSIFilename = pszTmpName;
+ CPLFree(pszTmpName);
+
+ // In case recoding to the ANSI code page failed, then create a temporary file
+ // in a "safe" location
+ if( CPLGetLastErrorType() != CE_None )
+ {
+ CPLErrorReset();
+
+ // FIXME: CPLGenerateTempFilename() would normally be expected to return a UTF-8 filename
+ // but I doubt it does in all cases.
+ m_osTempFilename = CPLGenerateTempFilename("temp_xls");
+ m_osANSIFilename = m_osTempFilename;
+ CPLCopyFile( m_osANSIFilename, pszFilename );
+ CPLDebug("XLS", "Create temporary file: %s", m_osTempFilename.c_str());
+ }
+ }
#endif
// --------------------------------------------------------------------
@@ -115,7 +140,7 @@ int OGRXLSDataSource::Open( const char * pszFilename, int bUpdateIn)
// --------------------------------------------------------------------
/* Open only for getting info. To get cell values, we have to use freexl_open */
- if (freexl_open_info (pszName, &xlshandle) != FREEXL_OK)
+ if ( !GetXLSHandle() )
return FALSE;
unsigned int nSheets = 0;
@@ -158,7 +183,7 @@ const void* OGRXLSDataSource::GetXLSHandle()
if (xlshandle)
return xlshandle;
- if (freexl_open (pszName, &xlshandle) != FREEXL_OK)
+ if (freexl_open (m_osANSIFilename, &xlshandle) != FREEXL_OK)
return NULL;
return xlshandle;
diff --git a/ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp b/ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp
index 340b97a..7a468dd 100644
--- a/ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp
+++ b/ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp
@@ -32,7 +32,7 @@
#include "cpl_time.h"
#include "cpl_vsi_error.h"
-CPL_CVSID("$Id: ogrxlsxdatasource.cpp 37472 2017-02-26 02:47:45Z goatbar $");
+CPL_CVSID("$Id: ogrxlsxdatasource.cpp 40632 2017-11-04 11:29:43Z rouault $");
namespace OGRXLSX {
@@ -1244,6 +1244,18 @@ void OGRXLSXDataSource::AnalyseWorkbookRels(VSILFILE* fpWorkbookRels)
}
/************************************************************************/
+/* GetUnprefixed() */
+/************************************************************************/
+
+static const char* GetUnprefixed(const char* pszStr)
+{
+ const char* pszColumn = strchr(pszStr, ':');
+ if( pszColumn )
+ return pszColumn + 1;
+ return pszStr;
+}
+
+/************************************************************************/
/* startElementWBCbk() */
/************************************************************************/
@@ -1259,7 +1271,7 @@ void OGRXLSXDataSource::startElementWBCbk(const char *pszNameIn,
if( bStopParsing ) return;
nWithoutEventCounter = 0;
- if (strcmp(pszNameIn,"sheet") == 0)
+ if (strcmp(GetUnprefixed(pszNameIn),"sheet") == 0)
{
const char* pszSheetName = GetAttributeValue(ppszAttr, "name", NULL);
const char* pszId = GetAttributeValue(ppszAttr, "r:id", NULL);
@@ -1361,11 +1373,15 @@ void OGRXLSXDataSource::startElementStylesCbk(const char *pszNameIn,
if (pszFormatCode && nNumFmtId >= 164)
{
int bHasDate = strstr(pszFormatCode, "DD") != NULL ||
- strstr(pszFormatCode, "YY") != NULL;
- int bHasTime = strstr(pszFormatCode, "HH") != NULL;
+ strstr(pszFormatCode, "dd") != NULL ||
+ strstr(pszFormatCode, "YY") != NULL ||
+ strstr(pszFormatCode, "yy") != NULL;
+ int bHasTime = strstr(pszFormatCode, "HH") != NULL ||
+ strstr(pszFormatCode, "hh") != NULL;
if (bHasDate && bHasTime)
apoMapStyleFormats[nNumFmtId] = XLSXFieldTypeExtended(OFTDateTime,
- strstr(pszFormatCode, "SS.000") != NULL );
+ strstr(pszFormatCode, "SS.000") != NULL ||
+ strstr(pszFormatCode, "ss.000") != NULL);
else if (bHasDate)
apoMapStyleFormats[nNumFmtId] = XLSXFieldTypeExtended(OFTDate);
else if (bHasTime)
@@ -1651,8 +1667,9 @@ static const char SCHEMA_PACKAGE_RS[] =
static void WriteContentTypes(const char* pszName, int nLayers)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/[Content_Types].xml", pszName), "wb");
+ CPLString osTmpFilename(
+ CPLSPrintf("/vsizip/%s/[Content_Types].xml", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
// TODO(schwehr): Convert all strlen(XML_HEADER) to constexpr with
// switch to C++11 or newer.
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
@@ -1679,8 +1696,8 @@ static void WriteContentTypes(const char* pszName, int nLayers)
static void WriteApp(const char* pszName)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/docProps/app.xml", pszName), "wb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/docProps/app.xml", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<Properties xmlns=\"%s/extended-properties\" "
"xmlns:vt=\"%s/docPropsVTypes\">\n", SCHEMA_OD, SCHEMA_OD);
@@ -1695,8 +1712,9 @@ static void WriteApp(const char* pszName)
static void WriteCore(const char* pszName)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/docProps/core.xml", pszName), "wb");
+ CPLString osTmpFilename(
+ CPLSPrintf("/vsizip/%s/docProps/core.xml", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<cp:coreProperties xmlns:cp=\"%s/metadata/core-properties\" "
"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" "
@@ -1714,8 +1732,8 @@ static void WriteCore(const char* pszName)
static void WriteWorkbook(const char* pszName, OGRDataSource* poDS)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/workbook.xml", pszName), "wb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/xl/workbook.xml", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<workbook %s xmlns:r=\"%s\">\n", MAIN_NS, SCHEMA_OD_RS);
VSIFPrintfL(fp, "<fileVersion appName=\"Calc\"/>\n");
@@ -1780,9 +1798,9 @@ static void WriteLayer(const char* pszName, OGRLayer* poLayer, int iLayer,
std::map<std::string,int>& oStringMap,
std::vector<std::string>& oStringList)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/worksheets/sheet%d.xml",
- pszName, iLayer + 1), "wb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/xl/worksheets/sheet%d.xml",
+ pszName, iLayer + 1));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<worksheet %s xmlns:r=\"%s\">\n", MAIN_NS, SCHEMA_OD_RS);
/*
@@ -1949,8 +1967,9 @@ static void WriteSharedStrings(const char* pszName,
CPL_UNUSED std::map<std::string,int>& oStringMap,
std::vector<std::string>& oStringList)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/sharedStrings.xml", pszName), "wb");
+ CPLString osTmpFilename(
+ CPLSPrintf("/vsizip/%s/xl/sharedStrings.xml", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<sst %s uniqueCount=\"%d\">\n",
MAIN_NS,
@@ -1973,8 +1992,8 @@ static void WriteSharedStrings(const char* pszName,
static void WriteStyles(const char* pszName)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/styles.xml", pszName), "wb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/xl/styles.xml", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<styleSheet %s>\n", MAIN_NS);
VSIFPrintfL(fp, "<numFmts count=\"4\">\n");
@@ -2029,9 +2048,9 @@ static void WriteStyles(const char* pszName)
static void WriteWorkbookRels(const char* pszName, int nLayers)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/_rels/workbook.xml.rels",
- pszName), "wb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/xl/_rels/workbook.xml.rels",
+ pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<Relationships xmlns=\"%s\">\n", SCHEMA_PACKAGE_RS);
VSIFPrintfL(fp, "<Relationship Id=\"rId1\" Type=\"%s/styles\" Target=\"styles.xml\"/>\n", SCHEMA_OD_RS);
@@ -2052,8 +2071,8 @@ static void WriteWorkbookRels(const char* pszName, int nLayers)
static void WriteDotRels(const char* pszName)
{
- VSILFILE* fp =
- VSIFOpenL(CPLSPrintf("/vsizip/%s/_rels/.rels", pszName), "wb");
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s/_rels/.rels", pszName));
+ VSILFILE* fp = VSIFOpenL(osTmpFilename, "wb");
VSIFWriteL(XML_HEADER, strlen(XML_HEADER), 1, fp);
VSIFPrintfL(fp, "<Relationships xmlns=\"%s\">\n", SCHEMA_PACKAGE_RS);
VSIFPrintfL(fp, "<Relationship Id=\"rId1\" Type=\"%s/officeDocument\" Target=\"xl/workbook.xml\"/>\n", SCHEMA_OD_RS);
@@ -2090,7 +2109,8 @@ void OGRXLSXDataSource::FlushCache()
}
/* Maintain new ZIP files opened */
- VSILFILE* fpZIP = VSIFOpenExL(CPLSPrintf("/vsizip/%s", pszName), "wb", true);
+ CPLString osTmpFilename(CPLSPrintf("/vsizip/%s", pszName));
+ VSILFILE* fpZIP = VSIFOpenExL(osTmpFilename, "wb", true);
if (fpZIP == NULL)
{
CPLError(CE_Failure, CPLE_FileIO,
diff --git a/ogr/ogrsf_frmts/xlsx/ogrxlsxdriver.cpp b/ogr/ogrsf_frmts/xlsx/ogrxlsxdriver.cpp
index 5e75d2b..508ee2a 100644
--- a/ogr/ogrsf_frmts/xlsx/ogrxlsxdriver.cpp
+++ b/ogr/ogrsf_frmts/xlsx/ogrxlsxdriver.cpp
@@ -29,7 +29,7 @@
#include "ogr_xlsx.h"
#include "cpl_conv.h"
-CPL_CVSID("$Id: ogrxlsxdriver.cpp 35709 2016-10-13 07:21:06Z rouault $");
+CPL_CVSID("$Id: ogrxlsxdriver.cpp 40632 2017-11-04 11:29:43Z rouault $");
extern "C" void RegisterOGRXLSX();
@@ -86,7 +86,12 @@ OGRDataSource *OGRXLSXDriver::Open( const char * pszFilename, int bUpdate )
if( !bOK )
return NULL;
- VSILFILE* fpContent = VSIFOpenL(CPLSPrintf("/vsizip/%s/[Content_Types].xml", pszFilename), "rb");
+ CPLString osPrefixedFilename("/vsizip/");
+ osPrefixedFilename += pszFilename;
+
+ CPLString osTmpFilename;
+ osTmpFilename = CPLSPrintf("%s/[Content_Types].xml", osPrefixedFilename.c_str());
+ VSILFILE* fpContent = VSIFOpenL(osTmpFilename, "rb");
if (fpContent == NULL)
return NULL;
@@ -98,19 +103,23 @@ OGRDataSource *OGRXLSXDriver::Open( const char * pszFilename, int bUpdate )
if (strstr(szBuffer, XLSX_MIMETYPE) == NULL)
return NULL;
- VSILFILE* fpWorkbook = VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/workbook.xml", pszFilename), "rb");
+ osTmpFilename = CPLSPrintf("%s/xl/workbook.xml", osPrefixedFilename.c_str());
+ VSILFILE* fpWorkbook = VSIFOpenL(osTmpFilename, "rb");
if (fpWorkbook == NULL)
return NULL;
- VSILFILE* fpWorkbookRels = VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/_rels/workbook.xml.rels", pszFilename), "rb");
+ osTmpFilename = CPLSPrintf("%s/xl/_rels/workbook.xml.rels", osPrefixedFilename.c_str());
+ VSILFILE* fpWorkbookRels = VSIFOpenL(osTmpFilename, "rb");
if (fpWorkbookRels == NULL)
{
VSIFCloseL(fpWorkbook);
return NULL;
}
- VSILFILE* fpSharedStrings = VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/sharedStrings.xml", pszFilename), "rb");
- VSILFILE* fpStyles = VSIFOpenL(CPLSPrintf("/vsizip/%s/xl/styles.xml", pszFilename), "rb");
+ osTmpFilename = CPLSPrintf("%s/xl/sharedStrings.xml", osPrefixedFilename.c_str());
+ VSILFILE* fpSharedStrings = VSIFOpenL(osTmpFilename, "rb");
+ osTmpFilename = CPLSPrintf("%s/xl/styles.xml", osPrefixedFilename.c_str());
+ VSILFILE* fpStyles = VSIFOpenL(osTmpFilename, "rb");
OGRXLSXDataSource *poDS = new OGRXLSXDataSource();
diff --git a/port/cpl_aws.cpp b/port/cpl_aws.cpp
index e66a61b..79d9084 100644
--- a/port/cpl_aws.cpp
+++ b/port/cpl_aws.cpp
@@ -36,7 +36,7 @@
#include "cpl_minixml.h"
#include <algorithm>
-CPL_CVSID("$Id: cpl_aws.cpp 37174 2017-01-18 20:00:36Z rouault $");
+CPL_CVSID("$Id: cpl_aws.cpp 40695 2017-11-13 12:17:28Z rouault $");
// #define DEBUG_VERBOSE 1
@@ -109,7 +109,7 @@ CPLString CPLAWSURLEncode( const CPLString& osURL, bool bEncodeSlash )
}
else
{
- osRet += CPLSPrintf("%02X", ch);
+ osRet += CPLSPrintf("%%%02X", static_cast<unsigned char>(ch));
}
}
return osRet;
@@ -344,12 +344,12 @@ CPLString VSIS3HandleHelper::BuildURL(const CPLString& osAWSS3Endpoint,
return CPLSPrintf("%s://%s.%s/%s", (bUseHTTPS) ? "https" : "http",
osBucket.c_str(),
osAWSS3Endpoint.c_str(),
- osObjectKey.c_str());
+ CPLAWSURLEncode(osObjectKey, false).c_str());
else
return CPLSPrintf("%s://%s/%s/%s", (bUseHTTPS) ? "https" : "http",
osAWSS3Endpoint.c_str(),
osBucket.c_str(),
- osObjectKey.c_str());
+ CPLAWSURLEncode(osObjectKey, false).c_str());
}
/************************************************************************/
@@ -372,7 +372,7 @@ void VSIS3HandleHelper::RebuildURL()
if( !oIter->second.empty() )
{
m_osURL += "=";
- m_osURL += oIter->second;
+ m_osURL += CPLAWSURLEncode(oIter->second);
}
}
}
@@ -521,8 +521,8 @@ VSIS3HandleHelper::GetCurlHeaders( const CPLString& osVerb,
osVerb,
osHost,
m_bUseVirtualHosting
- ? ("/" + m_osObjectKey).c_str() :
- ("/" + m_osBucket + "/" + m_osObjectKey).c_str(),
+ ? CPLAWSURLEncode("/" + m_osObjectKey, false).c_str() :
+ CPLAWSURLEncode("/" + m_osBucket + "/" + m_osObjectKey, false).c_str(),
osCanonicalQueryString,
osXAMZContentSHA256,
osXAMZDate);
diff --git a/port/cpl_conv.cpp b/port/cpl_conv.cpp
index 5990d7d..450038f 100644
--- a/port/cpl_conv.cpp
+++ b/port/cpl_conv.cpp
@@ -81,7 +81,7 @@
// Uncomment to get list of options that have been fetched and set.
// #define DEBUG_CONFIG_OPTIONS
-CPL_CVSID("$Id: cpl_conv.cpp 37987 2017-04-14 07:42:50Z rouault $");
+CPL_CVSID("$Id: cpl_conv.cpp 40320 2017-10-03 20:21:00Z rouault $");
static CPLMutex *hConfigMutex = NULL;
static volatile char **g_papszConfigOptions = NULL;
@@ -2631,15 +2631,6 @@ int CPLCopyTree( const char *pszNewPath, const char *pszOldPath )
{
VSIStatBufL sStatBuf;
-
- if( VSIStatL(pszOldPath, &sStatBuf) != 0 )
- {
- CPLError(CE_Failure, CPLE_AppDefined,
- "It seems no file system object called '%s' exists.",
- pszOldPath);
-
- return -1;
- }
if( VSIStatL(pszNewPath, &sStatBuf) == 0 )
{
CPLError(
@@ -2650,6 +2641,15 @@ int CPLCopyTree( const char *pszNewPath, const char *pszOldPath )
return -1;
}
+ if( VSIStatL(pszOldPath, &sStatBuf) != 0 )
+ {
+ CPLError(CE_Failure, CPLE_AppDefined,
+ "It seems no file system object called '%s' exists.",
+ pszOldPath);
+
+ return -1;
+ }
+
if( VSI_ISDIR(sStatBuf.st_mode) )
{
if( VSIMkdir(pszNewPath, 0755) != 0 )
diff --git a/port/cpl_google_cloud.cpp b/port/cpl_google_cloud.cpp
index 795d516..161b124 100644
--- a/port/cpl_google_cloud.cpp
+++ b/port/cpl_google_cloud.cpp
@@ -31,8 +31,9 @@
#include "cpl_vsi_error.h"
#include "cpl_sha1.h"
#include "cpl_time.h"
+#include "cpl_aws.h"
-CPL_CVSID("$Id: cpl_google_cloud.cpp 37645 2017-03-08 00:15:33Z rouault $");
+CPL_CVSID("$Id: cpl_google_cloud.cpp 40695 2017-11-13 12:17:28Z rouault $");
#ifdef HAVE_CURL
@@ -110,7 +111,7 @@ VSIGSHandleHelper::VSIGSHandleHelper( const CPLString& osEndpoint,
const CPLString& osSecretAccessKey,
const CPLString& osAccessKeyId,
bool bUseHeaderFile ) :
- m_osURL(osEndpoint + osBucketObjectKey),
+ m_osURL(osEndpoint + CPLAWSURLEncode(osBucketObjectKey, false)),
m_osEndpoint(osEndpoint),
m_osBucketObjectKey(osBucketObjectKey),
m_osSecretAccessKey(osSecretAccessKey),
@@ -170,7 +171,7 @@ VSIGSHandleHelper::GetCurlHeaders( const CPLString& osVerb ) const
if( m_bUseHeaderFile )
return NULL;
return GetGSHeaders( osVerb,
- "/" + m_osBucketObjectKey,
+ "/" + CPLAWSURLEncode(m_osBucketObjectKey, false),
m_osSecretAccessKey,
m_osAccessKeyId );
}
diff --git a/port/cpl_vsil_curl.cpp b/port/cpl_vsil_curl.cpp
index 5d7a5b9..e3059ed 100644
--- a/port/cpl_vsil_curl.cpp
+++ b/port/cpl_vsil_curl.cpp
@@ -42,7 +42,7 @@
#include "cpl_vsi_virtual.h"
#include "cpl_http.h"
-CPL_CVSID("$Id: cpl_vsil_curl.cpp 39326 2017-06-27 14:31:43Z rouault $");
+CPL_CVSID("$Id: cpl_vsil_curl.cpp 40695 2017-11-13 12:17:28Z rouault $");
#ifndef HAVE_CURL
@@ -310,6 +310,8 @@ public:
override;
virtual int Mkdir( const char *pszDirname, long nMode ) override;
virtual int Rmdir( const char *pszDirname ) override;
+ virtual char **ReadDir( const char *pszDirname ) override
+ { return ReadDirEx(pszDirname, 0); }
virtual char **ReadDirEx( const char *pszDirname, int nMaxFiles )
override;
char **ReadDirInternal( const char *pszDirname, int nMaxFiles,
@@ -722,7 +724,8 @@ static size_t VSICurlHandleWriteFunc( void *buffer, size_t count,
static bool VSICurlIsS3SignedURL( const char* pszURL )
{
return
- strstr(pszURL, ".s3.amazonaws.com/") != NULL &&
+ (strstr(pszURL, ".s3.amazonaws.com/") != NULL ||
+ strstr(pszURL, ".storage.googleapis.com/") != NULL) &&
(strstr(pszURL, "&Signature=") != NULL ||
strstr(pszURL, "?Signature=") != NULL);
}
@@ -836,19 +839,21 @@ retry:
if( STARTS_WITH(osURL, "ftp") )
{
- if( sWriteFuncData.pBuffer != NULL &&
- STARTS_WITH(sWriteFuncData.pBuffer, "Content-Length: ") )
+ if( sWriteFuncData.pBuffer != NULL )
{
- const char* pszBuffer =
- sWriteFuncData.pBuffer + strlen("Content-Length: ");
- eExists = EXIST_YES;
- fileSize = CPLScanUIntBig(
- pszBuffer,
- static_cast<int>(sWriteFuncData.nSize -
- strlen("Content-Length: ")));
- if( ENABLE_DEBUG )
- CPLDebug("VSICURL", "GetFileSize(%s)=" CPL_FRMT_GUIB,
- osURL.c_str(), fileSize);
+ const char* pszContentLength = strstr(
+ const_cast<const char*>(sWriteFuncData.pBuffer), "Content-Length: ");
+ if( pszContentLength )
+ {
+ pszContentLength += strlen("Content-Length: ");
+ eExists = EXIST_YES;
+ fileSize = CPLScanUIntBig(
+ pszContentLength,
+ static_cast<int>(strlen(pszContentLength)));
+ if( ENABLE_DEBUG )
+ CPLDebug("VSICURL", "GetFileSize(%s)=" CPL_FRMT_GUIB,
+ osURL.c_str(), fileSize);
+ }
}
}
@@ -2821,7 +2826,7 @@ void VSICurlFilesystemHandler::AnalyseS3FileList(
const char* pszKey = CPLGetXMLValue(psIter, "Key", NULL);
if( pszKey && strlen(pszKey) > osPrefix.size() )
{
- CPLString osCachedFilename = osBaseURL + pszKey;
+ CPLString osCachedFilename = osBaseURL + CPLAWSURLEncode(pszKey, false);
#if DEBUG_VERBOSE
CPLDebug("S3", "Cache %s", osCachedFilename.c_str());
#endif
@@ -2871,7 +2876,7 @@ void VSICurlFilesystemHandler::AnalyseS3FileList(
osKey.resize(osKey.size()-1);
if( osKey.size() > osPrefix.size() )
{
- CPLString osCachedFilename = osBaseURL + osKey;
+ CPLString osCachedFilename = osBaseURL + CPLAWSURLEncode(osKey, false);
#if DEBUG_VERBOSE
CPLDebug("S3", "Cache %s", osCachedFilename.c_str());
#endif
@@ -3674,8 +3679,9 @@ VSIS3WriteHandle::~VSIS3WriteHandle()
int VSIS3WriteHandle::Seek( vsi_l_offset nOffset, int nWhence )
{
- if( (nWhence == SEEK_SET && nOffset != m_nCurOffset) ||
- nOffset != 0 )
+ if( !((nWhence == SEEK_SET && nOffset == m_nCurOffset) ||
+ (nWhence == SEEK_CUR && nOffset == 0) ||
+ (nWhence == SEEK_END && nOffset == 0)) )
{
CPLError(CE_Failure, CPLE_NotSupported,
"Seek not supported on writable /vsis3 files");
@@ -3924,12 +3930,14 @@ VSIS3WriteHandle::Write( const void *pBuffer, size_t nSize, size_t nMemb )
size_t nBytesToWrite = nSize * nMemb;
+ const GByte* pabySrcBuffer = reinterpret_cast<const GByte*>(pBuffer);
while( nBytesToWrite > 0 )
{
const int nToWriteInBuffer = static_cast<int>(
std::min(static_cast<size_t>(m_nBufferSize - m_nBufferOff),
nBytesToWrite));
- memcpy(m_pabyBuffer + m_nBufferOff, pBuffer, nToWriteInBuffer);
+ memcpy(m_pabyBuffer + m_nBufferOff, pabySrcBuffer, nToWriteInBuffer);
+ pabySrcBuffer += nToWriteInBuffer;
m_nBufferOff += nToWriteInBuffer;
m_nCurOffset += nToWriteInBuffer;
nBytesToWrite -= nToWriteInBuffer;
diff --git a/swig/csharp/const/GdalConst.cs b/swig/csharp/const/GdalConst.cs
index c639cdd..868cc96 100644
--- a/swig/csharp/const/GdalConst.cs
+++ b/swig/csharp/const/GdalConst.cs
@@ -61,6 +61,11 @@ public class GdalConst {
public static readonly int GRA_Lanczos = GdalConstPINVOKE.GRA_Lanczos_get();
public static readonly int GRA_Average = GdalConstPINVOKE.GRA_Average_get();
public static readonly int GRA_Mode = GdalConstPINVOKE.GRA_Mode_get();
+ public static readonly int GRA_Max = GdalConstPINVOKE.GRA_Max_get();
+ public static readonly int GRA_Min = GdalConstPINVOKE.GRA_Min_get();
+ public static readonly int GRA_Med = GdalConstPINVOKE.GRA_Med_get();
+ public static readonly int GRA_Q1 = GdalConstPINVOKE.GRA_Q1_get();
+ public static readonly int GRA_Q3 = GdalConstPINVOKE.GRA_Q3_get();
public static readonly int GPI_Gray = GdalConstPINVOKE.GPI_Gray_get();
public static readonly int GPI_RGB = GdalConstPINVOKE.GPI_RGB_get();
public static readonly int GPI_CMYK = GdalConstPINVOKE.GPI_CMYK_get();
diff --git a/swig/csharp/const/GdalConstPINVOKE.cs b/swig/csharp/const/GdalConstPINVOKE.cs
index fc2b7d6..bac4e02 100644
--- a/swig/csharp/const/GdalConstPINVOKE.cs
+++ b/swig/csharp/const/GdalConstPINVOKE.cs
@@ -336,6 +336,21 @@ class GdalConstPINVOKE {
[DllImport("gdalconst_wrap", EntryPoint="CSharp_GRA_Mode_get")]
public static extern int GRA_Mode_get();
+ [DllImport("gdalconst_wrap", EntryPoint="CSharp_GRA_Max_get")]
+ public static extern int GRA_Max_get();
+
+ [DllImport("gdalconst_wrap", EntryPoint="CSharp_GRA_Min_get")]
+ public static extern int GRA_Min_get();
+
+ [DllImport("gdalconst_wrap", EntryPoint="CSharp_GRA_Med_get")]
+ public static extern int GRA_Med_get();
+
+ [DllImport("gdalconst_wrap", EntryPoint="CSharp_GRA_Q1_get")]
+ public static extern int GRA_Q1_get();
+
+ [DllImport("gdalconst_wrap", EntryPoint="CSharp_GRA_Q3_get")]
+ public static extern int GRA_Q3_get();
+
[DllImport("gdalconst_wrap", EntryPoint="CSharp_GPI_Gray_get")]
public static extern int GPI_Gray_get();
diff --git a/swig/csharp/const/gdalconst_wrap.c b/swig/csharp/const/gdalconst_wrap.c
index 3e0de9e..ae9302c 100644
--- a/swig/csharp/const/gdalconst_wrap.c
+++ b/swig/csharp/const/gdalconst_wrap.c
@@ -756,6 +756,56 @@ SWIGEXPORT int SWIGSTDCALL CSharp_GRA_Mode_get() {
}
+SWIGEXPORT int SWIGSTDCALL CSharp_GRA_Max_get() {
+ int jresult ;
+ int result;
+
+ result = (int)(GRA_Max);
+ jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_GRA_Min_get() {
+ int jresult ;
+ int result;
+
+ result = (int)(GRA_Min);
+ jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_GRA_Med_get() {
+ int jresult ;
+ int result;
+
+ result = (int)(GRA_Med);
+ jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_GRA_Q1_get() {
+ int jresult ;
+ int result;
+
+ result = (int)(GRA_Q1);
+ jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_GRA_Q3_get() {
+ int jresult ;
+ int result;
+
+ result = (int)(GRA_Q3);
+ jresult = result;
+ return jresult;
+}
+
+
SWIGEXPORT int SWIGSTDCALL CSharp_GPI_Gray_get() {
int jresult ;
int result;
diff --git a/swig/csharp/gdal/ResampleAlg.cs b/swig/csharp/gdal/ResampleAlg.cs
index 06a46c0..fe348dd 100644
--- a/swig/csharp/gdal/ResampleAlg.cs
+++ b/swig/csharp/gdal/ResampleAlg.cs
@@ -15,7 +15,12 @@ public enum ResampleAlg {
GRA_CubicSpline = 3,
GRA_Lanczos = 4,
GRA_Average = 5,
- GRA_Mode = 6
+ GRA_Mode = 6,
+ GRA_Max = 8,
+ GRA_Min = 9,
+ GRA_Med = 10,
+ GRA_Q1 = 11,
+ GRA_Q3 = 12
}
}
diff --git a/swig/include/gdal.i b/swig/include/gdal.i
index b8190b5..7f4d55e 100644
--- a/swig/include/gdal.i
+++ b/swig/include/gdal.i
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: gdal.i 35668 2016-10-09 20:52:50Z rouault $
+ * $Id: gdal.i 40765 2017-11-20 10:03:14Z rouault $
*
* Name: gdal.i
* Project: GDAL Python Interface
@@ -211,7 +211,13 @@ typedef enum {
/*! Cubic B-Spline Approximation (4x4 kernel) */ GRA_CubicSpline=3,
/*! Lanczos windowed sinc interpolation (6x6 kernel) */ GRA_Lanczos=4,
/*! Average (computes the average of all non-NODATA contributing pixels) */ GRA_Average=5,
- /*! Mode (selects the value which appears most often of all the sampled points) */ GRA_Mode=6
+ /*! Mode (selects the value which appears most often of all the sampled points) */ GRA_Mode=6,
+ /* GRA_Gauss=7 reserved. */
+ /*! Max (selects maximum of all non-NODATA contributing pixels) */ GRA_Max=8,
+ /*! Min (selects minimum of all non-NODATA contributing pixels) */ GRA_Min=9,
+ /*! Med (selects median of all non-NODATA contributing pixels) */ GRA_Med=10,
+ /*! Q1 (selects first quartile of all non-NODATA contributing pixels) */ GRA_Q1=11,
+ /*! Q3 (selects third quartile of all non-NODATA contributing pixels) */ GRA_Q3=12
} GDALResampleAlg;
%rename (AsyncStatusType) GDALAsyncStatusType;
diff --git a/swig/include/gdal_array.i b/swig/include/gdal_array.i
index 1bf8caa..ffd2c5a 100644
--- a/swig/include/gdal_array.i
+++ b/swig/include/gdal_array.i
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: gdal_array.i 39834 2017-08-16 12:20:23Z rouault $
+ * $Id: gdal_array.i 40119 2017-09-15 13:04:16Z rouault $
*
* Name: gdal_array.i
* Project: GDAL Python Interface
@@ -1065,7 +1065,6 @@ retStringAndCPLFree* GetArrayFilename(PyArrayObject *psArray)
%pythoncode %{
import numpy
-from . import _gdal_array
import gdalconst
import gdal
diff --git a/swig/include/gdalconst.i b/swig/include/gdalconst.i
index d1d36bc..0656c85 100644
--- a/swig/include/gdalconst.i
+++ b/swig/include/gdalconst.i
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: gdalconst.i 35418 2016-09-13 13:37:01Z rouault $
+ * $Id: gdalconst.i 40765 2017-11-20 10:03:14Z rouault $
*
* Name: gdalconst.i
* Project: GDAL Python Interface
@@ -112,6 +112,11 @@
%constant GRA_Lanczos = GRA_Lanczos;
%constant GRA_Average = GRA_Average;
%constant GRA_Mode = GRA_Mode;
+%constant GRA_Max = GRA_Max;
+%constant GRA_Min = GRA_Min;
+%constant GRA_Med = GRA_Med;
+%constant GRA_Q1 = GRA_Q1;
+%constant GRA_Q3 = GRA_Q3;
// GDALPaletteInterp
%constant GPI_Gray = GPI_Gray;
diff --git a/swig/include/perl/gdal_perl.i b/swig/include/perl/gdal_perl.i
index f87bced..e2e2c87 100644
--- a/swig/include/perl/gdal_perl.i
+++ b/swig/include/perl/gdal_perl.i
@@ -143,8 +143,8 @@ use Geo::GDAL::Const;
# Note that the 1/100000 digits may be used to create more than one
# CPAN release from one GDAL release.
-our $VERSION = '2.0202';
-our $GDAL_VERSION = '2.2.2';
+our $VERSION = '2.0203';
+our $GDAL_VERSION = '2.2.3';
=pod
@@ -186,7 +186,7 @@ None by default.
The GDAL home page is L<http://gdal.org/>
The documentation of this module is written in Doxygen format. See
-L<http://ajolma.net/Geo-GDAL/snapshot/>
+L<http://arijolma.org/Geo-GDAL/snapshot/>
=head1 AUTHOR
diff --git a/swig/include/perl/ogr_perl.i b/swig/include/perl/ogr_perl.i
index 69a11fb..613c50d 100644
--- a/swig/include/perl/ogr_perl.i
+++ b/swig/include/perl/ogr_perl.i
@@ -126,7 +126,7 @@ ALTERED_DESTROY(OGRGeometryShadow, OGRc, delete_Geometry)
%perlcode %{
package Geo::OGR;
-our $VERSION = '2.0202'; # this needs to be the same as that in gdal_perl.i
+our $VERSION = '2.0203'; # this needs to be the same as that in gdal_perl.i
Geo::GDAL->import(qw(:INTERNAL));
diff --git a/swig/perl/gdalconst_wrap.c b/swig/perl/gdalconst_wrap.c
index 79f60d1..1a257e1 100644
--- a/swig/perl/gdalconst_wrap.c
+++ b/swig/perl/gdalconst_wrap.c
@@ -2158,6 +2158,31 @@ XS(SWIG_init) {
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+ SV *sv = get_sv((char*) SWIG_prefix "GRA_Max", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(GRA_Max)));
+ SvREADONLY_on(sv);
+ } while(0) /*@SWIG@*/;
+ /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+ SV *sv = get_sv((char*) SWIG_prefix "GRA_Min", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(GRA_Min)));
+ SvREADONLY_on(sv);
+ } while(0) /*@SWIG@*/;
+ /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+ SV *sv = get_sv((char*) SWIG_prefix "GRA_Med", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(GRA_Med)));
+ SvREADONLY_on(sv);
+ } while(0) /*@SWIG@*/;
+ /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+ SV *sv = get_sv((char*) SWIG_prefix "GRA_Q1", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(GRA_Q1)));
+ SvREADONLY_on(sv);
+ } while(0) /*@SWIG@*/;
+ /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+ SV *sv = get_sv((char*) SWIG_prefix "GRA_Q3", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(GRA_Q3)));
+ SvREADONLY_on(sv);
+ } while(0) /*@SWIG@*/;
+ /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "GPI_Gray", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(GPI_Gray)));
SvREADONLY_on(sv);
diff --git a/swig/perl/lib/Geo/GDAL.pm b/swig/perl/lib/Geo/GDAL.pm
index 0c116bf..46a26f8 100644
--- a/swig/perl/lib/Geo/GDAL.pm
+++ b/swig/perl/lib/Geo/GDAL.pm
@@ -1056,8 +1056,8 @@ use Geo::GDAL::Const;
# Note that the 1/100000 digits may be used to create more than one
# CPAN release from one GDAL release.
-our $VERSION = '2.0202';
-our $GDAL_VERSION = '2.2.2';
+our $VERSION = '2.0203';
+our $GDAL_VERSION = '2.2.3';
=pod
@@ -1099,7 +1099,7 @@ None by default.
The GDAL home page is L<http://gdal.org/>
The documentation of this module is written in Doxygen format. See
-L<http://ajolma.net/Geo-GDAL/snapshot/>
+L<http://arijolma.org/Geo-GDAL/snapshot/>
=head1 AUTHOR
diff --git a/swig/perl/lib/Geo/GDAL/Const.pm b/swig/perl/lib/Geo/GDAL/Const.pm
index 677a954..4fbd6ae 100644
--- a/swig/perl/lib/Geo/GDAL/Const.pm
+++ b/swig/perl/lib/Geo/GDAL/Const.pm
@@ -103,6 +103,11 @@ package Geo::GDAL::Const;
*GRA_Lanczos = *Geo::GDAL::Constc::GRA_Lanczos;
*GRA_Average = *Geo::GDAL::Constc::GRA_Average;
*GRA_Mode = *Geo::GDAL::Constc::GRA_Mode;
+*GRA_Max = *Geo::GDAL::Constc::GRA_Max;
+*GRA_Min = *Geo::GDAL::Constc::GRA_Min;
+*GRA_Med = *Geo::GDAL::Constc::GRA_Med;
+*GRA_Q1 = *Geo::GDAL::Constc::GRA_Q1;
+*GRA_Q3 = *Geo::GDAL::Constc::GRA_Q3;
*GPI_Gray = *Geo::GDAL::Constc::GPI_Gray;
*GPI_RGB = *Geo::GDAL::Constc::GPI_RGB;
*GPI_CMYK = *Geo::GDAL::Constc::GPI_CMYK;
diff --git a/swig/perl/lib/Geo/OGR.pm b/swig/perl/lib/Geo/OGR.pm
index 2852978..4da05d6 100644
--- a/swig/perl/lib/Geo/OGR.pm
+++ b/swig/perl/lib/Geo/OGR.pm
@@ -960,7 +960,7 @@ package Geo::OGR;
package Geo::OGR;
-our $VERSION = '2.0202'; # this needs to be the same as that in gdal_perl.i
+our $VERSION = '2.0203'; # this needs to be the same as that in gdal_perl.i
Geo::GDAL->import(qw(:INTERNAL));
diff --git a/swig/perl/t/00-measures-01.t b/swig/perl/t/00-measures-01.t
index 7a9bfe8..265a1ac 100644
--- a/swig/perl/t/00-measures-01.t
+++ b/swig/perl/t/00-measures-01.t
@@ -12,7 +12,7 @@ my @wkt = (
'POINT M EMPTY' => ['POINT M EMPTY', 'POINT EMPTY'],
'POINT ZM EMPTY' => ['POINT ZM EMPTY', 'POINT EMPTY'],
'POINT (EMPTY)' => ['POINT EMPTY', 'POINT EMPTY'],
- 'POINT EMPTY (1 2)' => ['error', 'error'],
+ #'POINT EMPTY (1 2)' => ['error', 'error'],
'POINT (1)' => ['error', 'error'],
'POINT (1 2)' => ['POINT (1 2)', 'POINT (1 2)'],
'POINT (1 2 3)' => ['POINT Z (1 2 3)', 'POINT (1 2 3)'],
@@ -33,7 +33,7 @@ my @wkt = (
'LINESTRING M EMPTY' => ['LINESTRING M EMPTY', 'LINESTRING EMPTY'],
'LINESTRING ZM EMPTY' => ['LINESTRING ZM EMPTY', 'LINESTRING EMPTY'],
'LINESTRING (EMPTY)' => ['LINESTRING EMPTY', 'LINESTRING EMPTY'],
- 'LINESTRING EMPTY (1 2, 3 4)' => ['error', 'error'],
+ #'LINESTRING EMPTY (1 2, 3 4)' => ['error', 'error'],
'LINESTRING (1, 3)' => ['error', 'error'],
'LINESTRING (1 2, 3 4)' => ['LINESTRING (1 2,3 4)', 'LINESTRING (1 2,3 4)'],
'LINESTRING (1 2, 3 4 5)' => ['LINESTRING Z (1 2 0,3 4 5)', 'LINESTRING (1 2 0,3 4 5)'],
diff --git a/swig/python/README.txt b/swig/python/README.txt
index 169f0a4..eeee398 100644
--- a/swig/python/README.txt
+++ b/swig/python/README.txt
@@ -16,7 +16,7 @@ reference documentation, but the `GDAL API Tutorial`_ includes Python examples.
Dependencies
------------
- * libgdal (2.2.2 or greater) and header files (gdal-devel)
+ * libgdal (2.2.3 or greater) and header files (gdal-devel)
* numpy (1.0.0 or greater) and header files (numpy-devel) (not explicitly
required, but many examples and utilities will not work without it)
diff --git a/swig/python/extensions/gdalconst_wrap.c b/swig/python/extensions/gdalconst_wrap.c
index af32e68..5fed486 100644
--- a/swig/python/extensions/gdalconst_wrap.c
+++ b/swig/python/extensions/gdalconst_wrap.c
@@ -3617,6 +3617,61 @@ SWIGINTERN PyObject *GRA_Mode_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObj
}
+SWIGINTERN PyObject *GRA_Max_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *module;
+ PyObject *d;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+ d = PyModule_GetDict(module);
+ if (!d) return NULL;
+ SWIG_Python_SetConstant(d, "GRA_Max",SWIG_From_int((int)(GRA_Max)));
+ return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *GRA_Min_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *module;
+ PyObject *d;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+ d = PyModule_GetDict(module);
+ if (!d) return NULL;
+ SWIG_Python_SetConstant(d, "GRA_Min",SWIG_From_int((int)(GRA_Min)));
+ return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *GRA_Med_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *module;
+ PyObject *d;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+ d = PyModule_GetDict(module);
+ if (!d) return NULL;
+ SWIG_Python_SetConstant(d, "GRA_Med",SWIG_From_int((int)(GRA_Med)));
+ return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *GRA_Q1_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *module;
+ PyObject *d;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+ d = PyModule_GetDict(module);
+ if (!d) return NULL;
+ SWIG_Python_SetConstant(d, "GRA_Q1",SWIG_From_int((int)(GRA_Q1)));
+ return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *GRA_Q3_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *module;
+ PyObject *d;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+ d = PyModule_GetDict(module);
+ if (!d) return NULL;
+ SWIG_Python_SetConstant(d, "GRA_Q3",SWIG_From_int((int)(GRA_Q3)));
+ return SWIG_Py_Void();
+}
+
+
SWIGINTERN PyObject *GPI_Gray_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *module;
PyObject *d;
@@ -4680,6 +4735,11 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"GRA_Lanczos_swigconstant", GRA_Lanczos_swigconstant, METH_VARARGS, NULL},
{ (char *)"GRA_Average_swigconstant", GRA_Average_swigconstant, METH_VARARGS, NULL},
{ (char *)"GRA_Mode_swigconstant", GRA_Mode_swigconstant, METH_VARARGS, NULL},
+ { (char *)"GRA_Max_swigconstant", GRA_Max_swigconstant, METH_VARARGS, NULL},
+ { (char *)"GRA_Min_swigconstant", GRA_Min_swigconstant, METH_VARARGS, NULL},
+ { (char *)"GRA_Med_swigconstant", GRA_Med_swigconstant, METH_VARARGS, NULL},
+ { (char *)"GRA_Q1_swigconstant", GRA_Q1_swigconstant, METH_VARARGS, NULL},
+ { (char *)"GRA_Q3_swigconstant", GRA_Q3_swigconstant, METH_VARARGS, NULL},
{ (char *)"GPI_Gray_swigconstant", GPI_Gray_swigconstant, METH_VARARGS, NULL},
{ (char *)"GPI_RGB_swigconstant", GPI_RGB_swigconstant, METH_VARARGS, NULL},
{ (char *)"GPI_CMYK_swigconstant", GPI_CMYK_swigconstant, METH_VARARGS, NULL},
diff --git a/swig/python/osgeo/gdal_array.py b/swig/python/osgeo/gdal_array.py
index fd6b555..eccb70e 100644
--- a/swig/python/osgeo/gdal_array.py
+++ b/swig/python/osgeo/gdal_array.py
@@ -159,7 +159,6 @@ def RATValuesIONumPyRead(poRAT, nField, nStart, nLength):
return _gdal_array.RATValuesIONumPyRead(poRAT, nField, nStart, nLength)
import numpy
-from . import _gdal_array
import gdalconst
import gdal
diff --git a/swig/python/osgeo/gdalconst.py b/swig/python/osgeo/gdalconst.py
index 43dd8b5..9ea5987 100644
--- a/swig/python/osgeo/gdalconst.py
+++ b/swig/python/osgeo/gdalconst.py
@@ -238,6 +238,21 @@ GRA_Average = _gdalconst.GRA_Average
_gdalconst.GRA_Mode_swigconstant(_gdalconst)
GRA_Mode = _gdalconst.GRA_Mode
+_gdalconst.GRA_Max_swigconstant(_gdalconst)
+GRA_Max = _gdalconst.GRA_Max
+
+_gdalconst.GRA_Min_swigconstant(_gdalconst)
+GRA_Min = _gdalconst.GRA_Min
+
+_gdalconst.GRA_Med_swigconstant(_gdalconst)
+GRA_Med = _gdalconst.GRA_Med
+
+_gdalconst.GRA_Q1_swigconstant(_gdalconst)
+GRA_Q1 = _gdalconst.GRA_Q1
+
+_gdalconst.GRA_Q3_swigconstant(_gdalconst)
+GRA_Q3 = _gdalconst.GRA_Q3
+
_gdalconst.GPI_Gray_swigconstant(_gdalconst)
GPI_Gray = _gdalconst.GPI_Gray
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/gdal.git
More information about the Pkg-grass-devel
mailing list