Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Peillet
otb
Commits
8f755e1f
Commit
8f755e1f
authored
7 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
BUG: #1507: rework the priority order in metadata loading
parent
3726a2fc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
+5
-50
5 additions, 50 deletions
Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
Modules/IO/ImageIO/include/otbImageFileReader.txx
+20
-5
20 additions, 5 deletions
Modules/IO/ImageIO/include/otbImageFileReader.txx
with
25 additions
and
55 deletions
Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
+
5
−
50
View file @
8f755e1f
...
...
@@ -287,60 +287,15 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
}
/**********************************************************/
/* Third try : look for
external geom file and
RPC tags */
/* Third try : look for RPC tags */
/**********************************************************/
if
(
!
hasMetaData
)
if
(
!
hasMetaData
&&
checkRpcTag
)
{
// If still no metadata, try the ".geom" file
ossimFilename
ossimGeomFile
=
ossimFilename
(
filename
).
setExtension
(
".geom"
);
otb_kwl
=
ReadGeometryFromGEOMFile
(
ossimGeomFile
);
// also check any RPC tags
ImageKeywordlist
rpc_kwl
;
if
(
checkRpcTag
)
{
rpc_kwl
=
ReadGeometryFromRPCTag
(
filename
);
}
if
(
otb_kwl
.
HasKey
(
"type"
))
{
// external geom has a "type" keyword
std
::
string
geomType
(
otb_kwl
.
GetMetadataByKey
(
"type"
));
ossimProjection
*
testProj
=
ossimProjectionFactoryRegistry
::
instance
()
->
createProjection
(
ossimString
(
geomType
));
if
(
dynamic_cast
<
ossimSensorModel
*>
(
testProj
))
{
// "type" keyword corresponds to a sensor model : don't erase it
if
(
rpc_kwl
.
GetSize
()
>
0
)
{
rpc_kwl
.
ClearMetadataByKey
(
"type"
);
}
ossimKeywordlist
ossim_test_kwl
;
otb_kwl
.
convertToOSSIMKeywordlist
(
ossim_test_kwl
);
testProj
=
ossimProjectionFactoryRegistry
::
instance
()
->
createProjection
(
ossim_test_kwl
);
if
(
testProj
)
{
// external geom contains a valid sensor geometry
hasMetaData
=
true
;
}
}
}
// check any RPC tags
otb_kwl
=
ReadGeometryFromRPCTag
(
filename
);
// copy keywords found in RPC tags if the external geom is not valid
if
(
!
hasMetaData
&&
rpc_kwl
.
GetSize
()
>
0
)
if
(
!
otb_kwl
.
Empty
())
{
const
ImageKeywordlist
::
KeywordlistMap
&
kwlMap
=
rpc_kwl
.
GetKeywordlist
();
for
(
ImageKeywordlist
::
KeywordlistMap
::
const_iterator
it
=
kwlMap
.
begin
();
it
!=
kwlMap
.
end
();
++
it
)
{
if
(
it
->
second
!=
""
)
{
otb_kwl
.
AddKey
(
it
->
first
,
it
->
second
);
}
}
hasMetaData
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Modules/IO/ImageIO/include/otbImageFileReader.txx
+
20
−
5
View file @
8f755e1f
...
...
@@ -398,18 +398,33 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
{
std::string lFileNameOssimKeywordlist = GetDerivedDatasetSourceFileName(m_FileName);
std::string extension = itksys::SystemTools::GetFilenameLastExtension(lFileNameOssimKeywordlist);
std::string attachedGeom = lFileNameOssimKeywordlist.substr(
0,
lFileNameOssimKeywordlist.size() - extension.size()) + std::string(".geom");
// Update otb Keywordlist
ImageKeywordlist otb_kwl;
if (!m_FilenameHelper->ExtGEOMFileNameIsSet())
// Case 1: external geom supplied through extended filename
if (m_FilenameHelper->ExtGEOMFileNameIsSet())
{
otb_kwl = ReadGeometryFrom
Image(lFileNameOssimKeywordlist,!
m_FilenameHelper->Get
SkipRpcTag
());
otbMsgDevMacro(<< "Loading
in
ternal kwl");
otb_kwl = ReadGeometryFrom
GEOMFile(
m_FilenameHelper->Get
ExtGEOMFileName
());
otbMsgDevMacro(<< "Loading
ex
ternal kwl");
}
// Case 2: attached geom (if present)
else if (itksys::SystemTools::FileExists(attachedGeom))
{
otb_kwl = ReadGeometryFromGEOMFile(attachedGeom);
otbMsgDevMacro(<< "Loading attached kwl");
}
// Case 3: find an ossimPluginProjection
// Case 4: find an ossimProjection
// Case 5: find RPC tags in TIF
else
{
otb_kwl = ReadGeometryFrom
GEOMFile(
m_FilenameHelper->Get
ExtGEOMFileName
());
otbMsgDevMacro(<< "Loading
ex
ternal kwl");
otb_kwl = ReadGeometryFrom
Image(lFileNameOssimKeywordlist,!
m_FilenameHelper->Get
SkipRpcTag
());
otbMsgDevMacro(<< "Loading
in
ternal kwl");
}
// Don't add an empty ossim keyword list
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment