Skip to content

Commit

Permalink
Merge pull request geo-data#1 from angelswing-team/fix-#DPP-26
Browse files Browse the repository at this point in the history
Support GDAL 3.0 in cesium-terrain-builder
  • Loading branch information
koriel-angelswing authored Jun 9, 2020
2 parents 08d105f + d304da1 commit 363131a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/GDALTiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ GDALTiler::GDALTiler(GDALDataset *poDataset, const Grid &grid, const TilerOption
OGRSpatialReference srcSRS = OGRSpatialReference(srcWKT);
OGRSpatialReference gridSRS = mGrid.getSRS();

#if ( GDAL_VERSION_MAJOR >= 3 )
srcSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
gridSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif

if (!srcSRS.IsSame(&gridSRS)) { // it doesn't match
// Check the srs is valid
switch(srcSRS.Validate()) {
Expand Down
5 changes: 5 additions & 0 deletions src/GlobalGeodetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ using namespace ctb;
static OGRSpatialReference
setSRS(void) {
OGRSpatialReference srs;

#if ( GDAL_VERSION_MAJOR >= 3 )
srs.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif

srs.importFromEPSG(4326);
return srs;
}
Expand Down
5 changes: 5 additions & 0 deletions src/GlobalMercator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const double GlobalMercator::cOriginShift = GlobalMercator::cEarthCircumference
static OGRSpatialReference
setSRS(void) {
OGRSpatialReference srs;

#if ( GDAL_VERSION_MAJOR >= 3 )
srs.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif

srs.importFromEPSG(3857);
return srs;
}
Expand Down
6 changes: 5 additions & 1 deletion src/Grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ class ctb::Grid {
mXOriginShift(extent.getWidth() / 2),
mYOriginShift(extent.getHeight() / 2),
mZoomFactor(zoomFactor)
{}
{
#if ( GDAL_VERSION_MAJOR >= 3 )
mSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif
}

/// Overload the assignment operator
Grid &
Expand Down
5 changes: 5 additions & 0 deletions src/TerrainTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ TerrainTile::heightsToRaster() const {

// Create the spatial reference system for the raster
OGRSpatialReference oSRS;

#if ( GDAL_VERSION_MAJOR >= 3 )
oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif

if (oSRS.importFromEPSG(4326) != OGRERR_NONE) {
throw CTBException("Could not create EPSG:4326 spatial reference");
}
Expand Down
5 changes: 5 additions & 0 deletions tools/ctb-tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ createEmptyRootElevationFile(std::string &fileName, const Grid &grid, const Tile

// Create the spatial reference system for the file
OGRSpatialReference oSRS;

#if ( GDAL_VERSION_MAJOR >= 3 )
oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif

if (oSRS.importFromEPSG(4326) != OGRERR_NONE) {
throw CTBException("Could not create EPSG:4326 spatial reference");
}
Expand Down

0 comments on commit 363131a

Please sign in to comment.