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
getGDALMetadata error #18
Comments
Right now, geotiff.js relies on the Browsers DOM capabilities to parse the GDAL metadata (which is included as XML). I'm hesitant to include a third-party library, as I want to keep the size of geotiff.js as small as possible. A workaround is to use the var xpath = require('xpath')
, dom = require('xmldom').DOMParser
function getGDALMetadata(image) {
var metadata = {};
if (!image.fileDirectory.GDAL_METADATA) {
return null;
}
var string = image.fileDirectory.GDAL_METADATA;
var doc = new dom().parseFromString(image.fileDirectory.GDAL_METADATA)
var nodes = xpath.select("//GDALMetadata/Item", doc)
for (var i=0; i < nodes.length; ++i) {
var node = nodes(i);
metadata[node.getAttribute("name")] = node.textContent;
}
return metadata;
} I'll keep this issue open, as I'm still deciding on how to proceed. |
Yep. But I used a different approach:
Also this patch changes GDALMetadData. From my best knowledge in GeoTIFF GDALMetadat all Items bounded not only to item name, but also can be bound to certain sample. So I modified getGDALMetadata in that way that it return string value for Items without sample bounding and array of strings in other case |
@constantinius , I believe this issue can be closed as fixed. |
Node.js 4.2.6.
Got
The text was updated successfully, but these errors were encountered: