Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RDB #1538

Merged
merged 6 commits into from
Jul 9, 2019
Merged

Support RDB #1538

merged 6 commits into from
Jul 9, 2019

Conversation

tnixeu
Copy link
Contributor

@tnixeu tnixeu commented May 14, 2019

What does this PR do?

Adds a driver for reading *.mpx files in the RIEGL RDB format. Needs an external, proprietary library.

What are related issues/pull requests?

Tasklist

  • Adds base implementation of rdb driver
  • Add support for overviews
  • Add test case(s)
  • Review
  • Adjust for comments
  • All CI builds and checks have passed

Environment

@rouault
Copy link
Member

rouault commented May 23, 2019

Can you update your pull request to use the new Sphinx based documentation in gdal/docs/source ?

@tnixeu
Copy link
Contributor Author

tnixeu commented May 27, 2019

I will do that, as soon as I'm done with the overviews and update the pull request then.

* removes html frmt_rdb.html
* adds rdb.rst
* some code cleanup
Copy link
Member

@rouault rouault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides my comments, is there anything to add from your side in this PR before it is merged ?

@@ -0,0 +1,122 @@
#ifndef RDB_DATASET_INCLUDED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a header with copyright & license here as well

static int Identify(GDALOpenInfo *poOpenInfo);

CPLErr GetGeoTransform(double *padfTransform) override;
const char *_GetProjectionRef() override;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_GetProjectionRef() is useless here as GetSpatialRef() has a dedicated implementation not calling the GetSpatialRefFromOldGetProjectionRef() compatibility shim that would call itself _GetProjectionRef()


double RDBRasterBand::GetNoDataValue(int *pbSuccess)
{
if(pbSuccess == nullptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pbSuccess == nullptr should not cause the method to return 0 prematurely.
This is just below that you should protect the two *pbSuccess = TRUE / FALSE affectations against a potential nullptr

}
const char *RDBDataset::_GetProjectionRef()
{
ReadGeoreferencing();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call to ReadGeoreferening() should be moved to GetSpatialRef()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed that function and did not put it into GetSpatialRef() since that function is const and ReadGeoreferening() is called in the constructor anyway.


CPLErr RDBDataset::GetGeoTransform(double *padfTransform)
{
padfTransform[0] = dfXMin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is a "bottom-up" image ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, since the Webmercator coordinates start in southwest of the earth.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the Webmercator coordinates start in southwest of the earth.

not sure that it answers my question, I just wanted to share attention that in most (like 99%) raster formats line 0 of the image is the one that is displayed at the top of your screen, that is the line with the max georeferenced Y value, hence padfTransform[3] is generally maxY, and padfTransform[5] a negative value. But I assume you've verified by gdal_translate'ing to GeoTIFF and displaying in QGIS or whatever that you get a correctly positionned raster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. You are correct. I used gdal_translate and dumpoverviews in order to create tif files from the .mpx file and checked if the data fits to a map.


.. shortname:: RDB

.. versionadded:: 3.x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.1

double GetNoDataValue(int *pbSuccess) override
{
double dfInvalidValue = RDBRasterBand::GetNoDataValue(pbSuccess);
if(pbSuccess == nullptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment of RDBRasterBand::GetNoDataValue() regarding pbSuccess == nullptr

}
try
{
RDBDataset *poDS = new RDBDataset(poOpenInfo);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exceptions might occur, it might be wiser to wrap the new in a std::unique_ptr, and .release() it in the return

if(poWkt != nullptr)
{
osWktString = json_object_get_string(poWkt);
oSpatialReference.importFromWkt(osWktString.c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a call to oSpatialReference.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER); should likely be added in case you return a geographic CRS whose official axis order is lat, long (like EPSG:4326 WGS84), but that the raster horizontal axis is the longitude one (as usual)

@tnixeu
Copy link
Contributor Author

tnixeu commented Jun 25, 2019

Not for now. Thank you for reviewing.

I plan on building gdal with the rdblib in travis and appveyor, however, this needs easier access to the rdblib in order to this automatically. I will move this in a future pull request if this is okay. Should that be even in the master branch?
In another future pull request I will add load ingthe rdblib dynamically like we talked about.
I may also in a future pull request hide the rdb fully behind a VRT, since currently the base layer is expanded in order to be aligned with the Webmercator tiles.

@rouault
Copy link
Member

rouault commented Jun 25, 2019

Should that be even in the master branch?

That can. For a few Travis configurations, we pull already build GDAL against proprietary libs when they can be downloaded for free and without authentication.

@tnixeu
Copy link
Contributor Author

tnixeu commented Jun 27, 2019

ok, I will do that, when this is possible

It seems that some Travis runs Fail in code that is, I think, not changed by my code. Can you rerun them or are they going to fail again anyway?

@rouault
Copy link
Member

rouault commented Jun 27, 2019

Can you rerun them or are they going to fail again anyway?

I've restarted them. They unfortunately fail randomly quite often for unknown reason.

@tnixeu
Copy link
Contributor Author

tnixeu commented Jul 9, 2019

This time around all of them passed. For now, I'm not planing to change anything in the context of this pull request.

@rouault rouault merged commit aac0f4e into OSGeo:master Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants