Skip to content

Commit

Permalink
Merge pull request #3 from OSGeo/master
Browse files Browse the repository at this point in the history
refresh
  • Loading branch information
lucianpls authored Jul 9, 2018
2 parents 14f96f0 + a0d366c commit d7971ea
Show file tree
Hide file tree
Showing 502 changed files with 25,562 additions and 8,832 deletions.
28 changes: 28 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Reference:
# - http://editorconfig.org/
# - https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options
## Visual Studio IDE support for editing .editorconfig files:
# - https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{sln,*proj,*proj.filters,rc,rc2}]
charset = unset
end_of_line = crlf
insert_final_newline = unset
indent_style = unset
indent_size = unset

[{configure,configure.*,config.*,*.{sh,yml}}]
indent_size = 2

[{GNUmakefile,*.{in,opt,vc}}]
indent_style = tab
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for new features.
## Expected behavior and actual behavior.

For example: I expected to be able to open this raster file (with a link to
the raster file, or it as an attachement) and it returns an error message
the raster file, or it as an attachment) and it returns an error message
instead.

## Steps to reproduce the problem.
Expand Down
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ matrix:
compiler: gcc
language: cpp
sudo: required
dist: precise
dist: trusty
cache:
apt: true
directories:
- $HOME/.ccache
env:
- BUILD_NAME=precise
- DETAILS="debug build, no libtool"
- BUILD_NAME=ubuntu_1804
- DETAILS=""

- os: linux
compiler: clang
language: cpp
Expand Down Expand Up @@ -45,7 +46,7 @@ matrix:
compiler: gcc
language: cpp
sudo: required
dist: precise
dist: trusty
cache:
apt: true
directories:
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Git workflows with GDAL
=======================

This is not a git tutorial or reference manual by any means. This just collects
a few best practice for git usage for GDAL developement.
a few best practice for git usage for GDAL development.

Commit message
--------------
Expand All @@ -49,7 +49,7 @@ Fork OSGeo/gdal from github UI, and then
```
git clone https://github.com/OSGeo/gdal
cd gdal
git remote add my_user_name git@github.com/my_user_name/gdal.git
git remote add my_user_name https://github.com/my_user_name/gdal.git
```

Updating your local master against upstream master
Expand Down Expand Up @@ -82,7 +82,7 @@ git fetch origin
git rebase origin/master
# At end of your work, make sure history is reasonable by folding non
# significant commits into a consistant set
# significant commits into a consistent set
git rebase -i master (use fixup for example to merge several commits together)
# push your branch
Expand All @@ -92,7 +92,7 @@ From GitHub UI, issue a pull request

If the pull request discussion or Travis-CI/AppVeyor checks require changes,
commit locally and push. To get a reasonable history, you may need to
```git rebase -i master```, in whish case you will have to force-push your
```git rebase -i master```, in which case you will have to force-push your
branch with ```git push -f my_user_name my_new_feature_branch```


Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
GDAL - Geospatial Data Abstraction Library
====

| Environment | Status |
| ------------------------ |:-------------:|
| Ubuntu 12.04 64 bit | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=precise&label=precise)](https://travis-ci.org/OSGeo/gdal) |
| Ubuntu 14.04 32 bit | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=trusty_32bit&label=trusty_32bit)](https://travis-ci.org/OSGeo/gdal) |
| Ubuntu 14.04 64 bit | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=trusty_clang&label=trusty_clang)](https://travis-ci.org/OSGeo/gdal) |
| Ubuntu 16.04 64 / CL 3.9 | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=ubuntu_1604&label=ubuntu_1604)](https://travis-ci.org/OSGeo/gdal) |
| Python 3 | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=python3&label=python3)](https://travis-ci.org/OSGeo/gdal) |
| MacOS X | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=osx&label=osx)](https://travis-ci.org/OSGeo/gdal) |
| MSVC 2015-64b & 2017-32b | [![Build status](https://ci.appveyor.com/api/projects/status/jtwx0pcr0y01i17p/branch/trunk?svg=true)](https://ci.appveyor.com/project/OSGeo/gdal) |
| MinGW_W64 | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=mingw_w64&label=mingw_w64)](https://travis-ci.org/OSGeo/gdal) |
| Android | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=android&label=android)](https://travis-ci.org/OSGeo/gdal) |
| Big endian host | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=big_endian&label=big_endian)](https://travis-ci.org/OSGeo/gdal) |
| GCC 5.2 C++14 -fsanitize | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=gcc52_stdcpp14_sanitize&label=gcc52_stdcpp14_sanitize)](https://travis-ci.org/OSGeo/gdal) |
| Clang Static Analyzer | [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=csa_part_1&label=csa_part_1)](https://travis-ci.org/OSGeo/gdal) [![Build Status](http://badges.herokuapp.com/travis/OSGeo/gdal?branch=master&env=BUILD_NAME=csa_part_2&label=csa_part_2)](https://travis-ci.org/OSGeo/gdal) |
| Coverity Scan | [![Build Status](https://scan.coverity.com/projects/749/badge.svg?flat=1)](https://scan.coverity.com/projects/gdal) |
[![Build Status](https://travis-ci.com/OSGeo/gdal.svg?branch=master)](https://travis-ci.com/OSGeo/gdal)
[![Build status](https://ci.appveyor.com/api/projects/status/jtwx0pcr0y01i17p/branch/master?svg=true)](https://ci.appveyor.com/project/OSGeo/gdal)
[![Build Status](https://scan.coverity.com/projects/749/badge.svg?flat=1)](https://scan.coverity.com/projects/gdal)

| Environment |
| ------------------------ |
| Ubuntu 14.04 32 bit |
| Ubuntu 14.04 64 bit |
| Ubuntu 16.04 64 / CL 3.9 |
| Python 3 |
| MacOS X |
| MSVC 2015-64b & 2017-32b |
| MinGW_W64 |
| Android |
| Big endian host |
| GCC 5.2 C++14 -fsanitize |
| Clang Static Analyzer |
| Coverity Scan |

GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats.

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ install:
$env:NMAKE_LOCAL+="POPPLER_0_20_OR_LATER = YES`n"
$env:NMAKE_LOCAL+="POPPLER_0_23_OR_LATER = YES`n"
$env:NMAKE_LOCAL+="POPPLER_BASE_STREAM_HAS_TWO_ARGS = YES`n"
$env:NMAKE_LOCAL+="POPPLER_LIBS = `$(SDK_LIB)\poppler.lib `$(SDK_LIB)\freetype2411.lib advapi32.lib gdi32.lib`n"
$env:NMAKE_LOCAL+="POPPLER_LIBS = `$(SDK_LIB)\poppler.lib `$(SDK_LIB)\freetype.lib `$(SDK_LIB)\harfbuzz.lib advapi32.lib gdi32.lib`n"
$env:NMAKE_LOCAL+="OPENJPEG_ENABLED = YES`n"
$env:NMAKE_LOCAL+="OPENJPEG_CFLAGS = -I`$(SDK_INC)\openjpeg-2.1`n"
$env:NMAKE_LOCAL+="OPENJPEG_LIB = `$(SDK_LIB)\openjp2.lib`n"
Expand Down
24 changes: 24 additions & 0 deletions autotest/cpp/test_alg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "gdal_alg.h"
#include "gdalwarper.h"
#include "gdal_priv.h"

namespace tut
{
Expand Down Expand Up @@ -266,5 +267,28 @@ namespace tut
GDALDestroyWarpOptions(psOptions);
}

// Test GDALAutoCreateWarpedVRT() with creatino of an alpha band
template<> template<> void object::test<8>()
{
GDALDatasetUniquePtr poDS(
GDALDriver::FromHandle(
GDALGetDriverByName("MEM"))->Create("", 1, 1, 1, GDT_Byte, nullptr));
poDS->SetProjection( SRS_WKT_WGS84);
double adfGeoTransform[6] = { 10, 1, 0, 20, 0, -1 };
poDS->SetGeoTransform(adfGeoTransform);
GDALWarpOptions* psOptions = GDALCreateWarpOptions();
psOptions->nDstAlphaBand = 2;
GDALDatasetH hWarpedVRT =
GDALAutoCreateWarpedVRT(GDALDataset::ToHandle(poDS.get()), nullptr, nullptr,
GRA_NearestNeighbour, 0.0,
psOptions);
ensure( hWarpedVRT != nullptr );
ensure_equals( GDALGetRasterCount(hWarpedVRT), 2 );
ensure_equals( GDALGetRasterColorInterpretation(
GDALGetRasterBand(hWarpedVRT, 2)), GCI_AlphaBand );
GDALDestroyWarpOptions(psOptions);
GDALClose(hWarpedVRT);
}


} // namespace tut
22 changes: 22 additions & 0 deletions autotest/cpp/test_cpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2443,4 +2443,26 @@ namespace tut
ensure_equals(cpl::down_cast<Derived*>(static_cast<Base*>(nullptr)), static_cast<Derived*>(nullptr));
}

// Test CPLPrintTime() in particular case of RFC822 formatting in C locale
template<>
template<>
void object::test<35>()
{
char szDate[64];
struct tm tm;
tm.tm_sec = 56;
tm.tm_min = 34;
tm.tm_hour = 12;
tm.tm_mday = 20;
tm.tm_mon = 6-1;
tm.tm_year = 2018 - 1900;
tm.tm_wday = 3; // Wednesday
tm.tm_yday = 0; // unused
tm.tm_isdst = 0; // unused
int nRet = CPLPrintTime(szDate, sizeof(szDate)-1,
"%a, %d %b %Y %H:%M:%S GMT", &tm, "C");
szDate[nRet] = 0;
ensure_equals( std::string(szDate), std::string("Wed, 20 Jun 2018 12:34:56 GMT") );
}

} // namespace tut
2 changes: 1 addition & 1 deletion autotest/cpp/tut/tut_exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct failure : public tut_error
};

/**
* Exception to be throwed when test desctructor throwed an exception.
* Exception to be thrown when test destructor threw an exception.
*/
struct warning : public tut_error
{
Expand Down
Binary file added autotest/gcore/data/byte_lerc.tif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added autotest/gcore/data/reproduce_average_issue.tif
Binary file not shown.
Binary file added autotest/gcore/data/tar_with_star_base256_fields.tar
Binary file not shown.
1 change: 1 addition & 0 deletions autotest/gcore/data/text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
22 changes: 21 additions & 1 deletion autotest/gcore/gdal_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def stats_approx_nodata():

ds = gdal.Open('tmp/minfloat.tif')
stats = ds.GetRasterBand(1).GetStatistics(0, 1)
md = ds.GetRasterBand(1).GetMetadata()
nodata = ds.GetRasterBand(1).GetNoDataValue()
ds = None

Expand All @@ -151,6 +152,11 @@ def stats_approx_nodata():
print(stats)
return 'fail'

if md != {'STATISTICS_MEAN': '1', 'STATISTICS_MAXIMUM': '5', 'STATISTICS_MINIMUM': '-3', 'STATISTICS_STDDEV': '4', 'STATISTICS_VALID_PERCENT': '50'}:
gdaltest.post_reason('did not get expected metadata')
print(md)
return 'fail'

if minmax != (-3.0, 5.0):
gdaltest.post_reason('did not get expected minmax')
print(minmax)
Expand Down Expand Up @@ -816,7 +822,7 @@ def stats_approx_stats_flag(dt=gdal.GDT_Byte, struct_frmt='B'):
print(stats)
return 'fail'
md = ds.GetRasterBand(1).GetMetadata()
if md != {'STATISTICS_MEAN': '0', 'STATISTICS_MAXIMUM': '0', 'STATISTICS_MINIMUM': '0', 'STATISTICS_APPROXIMATE': 'YES', 'STATISTICS_STDDEV': '0'}:
if md != {'STATISTICS_MEAN': '0', 'STATISTICS_MAXIMUM': '0', 'STATISTICS_MINIMUM': '0', 'STATISTICS_APPROXIMATE': 'YES', 'STATISTICS_STDDEV': '0', 'STATISTICS_VALID_PERCENT': '100'}:
gdaltest.post_reason('did not get expected metadata')
print(md)
return 'fail'
Expand Down Expand Up @@ -876,6 +882,19 @@ def stats_all_nodata():

return 'success'


def stats_float32_with_nodata_slightly_above_float_max():

ds = gdal.Open('data/float32_with_nodata_slightly_above_float_max.tif')
my_min, my_max = ds.GetRasterBand(1).ComputeRasterMinMax()
if (my_min, my_max) != (-1.0989999771118164, 0.703338623046875):
gdaltest.post_reason('did not get expected stats')
print(my_min, my_max)
return 'fail'

return 'success'


###############################################################################
# Run tests

Expand Down Expand Up @@ -907,6 +926,7 @@ def stats_all_nodata():
stats_approx_stats_flag,
stats_approx_stats_flag_float,
stats_all_nodata,
stats_float32_with_nodata_slightly_above_float_max,
]

if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion autotest/gcore/hdf4_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def hdf4_read_online_6():
if not gdaltest.download_file('http://download.osgeo.org/gdal/data/hdf4/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf', 'MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf'):
return 'skip'

tst = gdaltest.GDALTest('HDF4Image', 'HDF4_EOS:EOS_GRID:tmp/cache/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf:MODIS_NACP_EVI:MODIS_EVI', 1, 12197, filename_absolute=1)
# Test with quoting of components
tst = gdaltest.GDALTest('HDF4Image', 'HDF4_EOS:EOS_GRID:"tmp/cache/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf":"MODIS_NACP_EVI":"MODIS_EVI"', 1, 12197, filename_absolute=1)

ret = tst.testOpen()
if ret != 'success':
Expand Down
6 changes: 6 additions & 0 deletions autotest/gcore/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def mask_1():
print(cs)
return 'fail'

my_min, my_max, mean, stddev = band.GetMaskBand().ComputeStatistics(0)
if (my_min, my_max, mean, stddev) != (255, 255, 255, 0):
gdaltest.post_reason('Got wrong mask stats')
print(my_min, my_max, mean, stddev)
return 'fail'

return 'success'

###############################################################################
Expand Down
34 changes: 31 additions & 3 deletions autotest/gcore/tiff_ovr.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def tiff_ovr_check(src_ds):
return 'fail'

if ovr_band.Checksum() != 1087:
msg = 'overview wrong checkum: band %d, overview 0, checksum = %d,' % (i, ovr_band.Checksum())
msg = 'overview wrong checksum: band %d, overview 0, checksum = %d,' % (i, ovr_band.Checksum())
gdaltest.post_reason(msg)
return 'fail'

Expand All @@ -70,7 +70,7 @@ def tiff_ovr_check(src_ds):
return 'fail'

if ovr_band.Checksum() != 328:
msg = 'overview wrong checkum: band %d, overview 1, checksum = %d,' % (i, ovr_band.Checksum())
msg = 'overview wrong checksum: band %d, overview 1, checksum = %d,' % (i, ovr_band.Checksum())
gdaltest.post_reason(msg)
return 'fail'
return 'success'
Expand Down Expand Up @@ -2297,6 +2297,33 @@ def tiff_ovr_too_many_levels_external():

return 'success'

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


def tiff_ovr_average_multiband_vs_singleband():

gdal.Translate('/vsimem/tiff_ovr_average_multiband_band.tif', 'data/reproduce_average_issue.tif', creationOptions=['INTERLEAVE=BAND'])
gdal.Translate('/vsimem/tiff_ovr_average_multiband_pixel.tif', 'data/reproduce_average_issue.tif', creationOptions=['INTERLEAVE=PIXEL'])

ds = gdal.Open('/vsimem/tiff_ovr_average_multiband_band.tif', gdal.GA_Update)
ds.BuildOverviews('AVERAGE', [2])
cs_band = [ds.GetRasterBand(i+1).GetOverview(0).Checksum() for i in range(3)]
ds = None

ds = gdal.Open('/vsimem/tiff_ovr_average_multiband_pixel.tif', gdal.GA_Update)
ds.BuildOverviews('AVERAGE', [2])
cs_pixel = [ds.GetRasterBand(i+1).GetOverview(0).Checksum() for i in range(3)]
ds = None

gdal.GetDriverByName('GTiff').Delete('/vsimem/tiff_ovr_average_multiband_band.tif')
gdal.GetDriverByName('GTiff').Delete('/vsimem/tiff_ovr_average_multiband_pixel.tif')

if cs_band != cs_pixel:
gdaltest.post_reason('fail')
print(cs_band, cs_pixel)
return 'fail'

return 'success'

###############################################################################
# Cleanup
Expand Down Expand Up @@ -2424,7 +2451,8 @@ def tiff_ovr_restore_endianness():
tiff_ovr_54,
tiff_ovr_too_many_levels_contig,
tiff_ovr_too_many_levels_separate,
tiff_ovr_too_many_levels_external]
tiff_ovr_too_many_levels_external,
tiff_ovr_average_multiband_vs_singleband ]

if __name__ == '__main__':

Expand Down
Loading

0 comments on commit d7971ea

Please sign in to comment.