question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confusing comment in the code regarding getGDALMetadata

See original GitHub issue

It is saying here:

If sample is passed to null, dataset-level metadata will be returned.

The question is what dataset-level metadata is? As I can see it simply returns metadata of the last band:

> img.fileDirectory.GDAL_METADATA;
'<GDALMetadata>\n' +
  '  <Item name="STATISTICS_MAXIMUM" sample="0">255</Item>\n' +
  '  <Item name="STATISTICS_MEAN" sample="0">161.13451304075</Item>\n' +
  '  <Item name="STATISTICS_MINIMUM" sample="0">27</Item>\n' +
  '  <Item name="STATISTICS_STDDEV" sample="0">47.78883943453</Item>\n' +
  '  <Item name="STATISTICS_VALID_PERCENT" sample="0">98.67</Item>\n' +
  '  <Item name="STATISTICS_MAXIMUM" sample="1">255</Item>\n' +
  '  <Item name="STATISTICS_MEAN" sample="1">156.19044508527</Item>\n' +
  '  <Item name="STATISTICS_MINIMUM" sample="1">17</Item>\n' +
  '  <Item name="STATISTICS_STDDEV" sample="1">45.653592048342</Item>\n' +
  '  <Item name="STATISTICS_VALID_PERCENT" sample="1">98.67</Item>\n' +
  '  <Item name="STATISTICS_MAXIMUM" sample="2">255</Item>\n' +
  '  <Item name="STATISTICS_MEAN" sample="2">156.71097900011</Item>\n' +
  '  <Item name="STATISTICS_MINIMUM" sample="2">1</Item>\n' +
  '  <Item name="STATISTICS_STDDEV" sample="2">41.777101570921</Item>\n' +
  '  <Item name="STATISTICS_VALID_PERCENT" sample="2">98.67</Item>\n' +
  '</GDALMetadata>\n' +
  '\x00'
> JSON.stringify(img.getGDALMetadata(0)) == JSON.stringify(img.getGDALMetadata())
false
> JSON.stringify(img.getGDALMetadata(1)) == JSON.stringify(img.getGDALMetadata())
false
> JSON.stringify(img.getGDALMetadata(2)) == JSON.stringify(img.getGDALMetadata())
true

cc @rouault

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DanielJDufourcommented, Jan 26, 2022

I’m on it

1reaction
constantiniuscommented, Jan 26, 2022

Sorry, have missed this. I think it is most useful for getGDALMetadata() with no argument to only return global metadata, not any band specific metadata. Feel free to draft a PR @DanielJDufour

Read more comments on GitHub >

github_iconTop Results From Across the Web

Provisions on the Management of Internet Post Comments ...
Article 4 : Post comment service providers shall strictly implement primary responsibility for the management of post comment services, ...
Read more >
Feature Request: Mouseover and Mouseout for sidebar - Vitmalina ...
Confusing comment in the code regarding getGDALMetadata, 5, 2021-12-01, 2022-07-22. bug: ameba failed to compile, 2, 2021-03-18, 2022-08-07.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found