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
Antoine Belvire
otb
Commits
d5b1f586
Commit
d5b1f586
authored
16 years ago
by
Jordi Inglada
Browse files
Options
Downloads
Patches
Plain Diff
DOC: minor formatting of MapProjectionExample
parent
fa88c743
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/Projections/MapProjectionExample.cxx
+40
-29
40 additions, 29 deletions
Examples/Projections/MapProjectionExample.cxx
with
40 additions
and
29 deletions
Examples/Projections/MapProjectionExample.cxx
+
40
−
29
View file @
d5b1f586
...
...
@@ -25,20 +25,24 @@
// Software Guide : BeginLatex
//
// Map projection is an important issue when working with satellite images. In the
// orthorectification process, converting between geographic and cartographic
// coordinates is a key step. In this process, everything is integrated and you
// don't need to know the details.
// Map projection is an important issue when working with satellite
// images. In the orthorectification process, converting between
// geographic and cartographic coordinates is a key step. In this
// process, everything is integrated and you don't need to know the
// details.
//
// However, sometimes, you need to go hands-on and find out the nitty-gritty details.
// This example shows you how to play with map projections in OTB and how to convert
// coordinates. In most cases, the underlying work is done by ossim.
// However, sometimes, you need to go hands-on and find out the
// nitty-gritty details. This example shows you how to play with map
// projections in OTB and how to convert coordinates. In most cases,
// the underlying work is done by OSSIM.
//
// First, we start by including the otbMapProjections header. In this file, over 30
// projections are defined and ready to use. It is easy to add new one.
// First, we start by including the otbMapProjections header. In this
// file, over 30 projections are defined and ready to use. It is easy
// to add new one.
//
// The otbGenericMapProjection enables you to instanciate a map projection from a
// WKT (Well Known Text) string, which is popular with OGR for example.
// The otbGenericMapProjection enables you to instanciate a map
// projection from a WKT (Well Known Text) string, which is popular
// with OGR for example.
//
// Software Guide : EndLatex
...
...
@@ -58,8 +62,9 @@ int main( int argc, char* argv[] )
// Software Guide : BeginLatex
//
// We retrieve the command line parameters and put them in the correct variables. The
// transforms are going to work with an \doxygen{itk}{Point}.
// We retrieve the command line parameters and put them in the
// correct variables. The transforms are going to work with an
// \doxygen{itk}{Point}.
//
// Software Guide : EndLatex
...
...
@@ -75,8 +80,8 @@ int main( int argc, char* argv[] )
// Software Guide : BeginLatex
//
// The output of this program will be save in a text file. We also want
// to make sure the precision of the digit will be enough.
// The output of this program will be save
d
in a text file. We also want
// to make sure
that
the precision of the digit
s
will be enough.
//
// Software Guide : EndLatex
...
...
@@ -88,23 +93,24 @@ int main( int argc, char* argv[] )
// Software Guide : BeginLatex
//
// We can now instanciate our first map projection. Here, it is a UTM projection
// we also need to provide the information concerning the zone and the hemisphere
// for the projection. These are specific to UTM projection.
// We can now instantiate our first map projection. Here, it is a
// UTM projection. We also need to provide the information about
// the zone and the hemisphere for the projection. These are
// specific to the UTM projection.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
otb
::
UtmForwardProjection
::
Pointer
utmProjection
=
otb
::
UtmForwardProjection
::
New
();
=
otb
::
UtmForwardProjection
::
New
();
utmProjection
->
SetZone
(
31
);
utmProjection
->
SetHemisphere
(
'N'
);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The TransformPoint() method return the coordinates of the point in the
// The TransformPoint() method return
s
the coordinates of the point in the
// new projection.
//
// Software Guide : EndLatex
...
...
@@ -136,13 +142,16 @@ int main( int argc, char* argv[] )
// Software Guide : BeginLatex
//
// If you follow carefully the previous examples, you've noticed that the target
// projection have been directly coded, which mean that they can't be changed at
// run-time. What happens if you don't know the target projection when you're writing
// the program? It can depends on some input provided by the user (image, shapefile).
// If you followed carefully the previous examples, you've noticed
// that the target projections have been directly coded, which means
// that they can't be changed at run-time. What happens if you don't
// know the target projection when you're writing the program? It
// can depend on some input provided by the user (image,
// shapefile).
//
// In this situation, you can use the \doxygen{otb}{GenericMapProjection}. It will
// accept a string to set the projection. This string should be in the WKT format.
// In this situation, you can use the
// \doxygen{otb}{GenericMapProjection}. It will accept a string to
// set the projection. This string should be in the WKT format.
//
// For example:
//
...
...
@@ -163,16 +172,18 @@ int main( int argc, char* argv[] )
// Software Guide : BeginLatex
//
// This string is then passed to the projection using the SetWkt() method.
// This string is then passed to the projection using the
// \code{SetWkt()} method.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
otb
::
GenericMapProjection
<
otb
::
FORWARD
>
GenericMapProjection
;
GenericMapProjection
::
Pointer
genericMapProjection
=
GenericMapProjection
::
New
();
GenericMapProjection
::
Pointer
genericMapProjection
=
GenericMapProjection
::
New
();
genericMapProjection
->
SetWkt
(
projectionRefWkt
);
file
<<
"Forward ge
ren
ic projection: "
<<
std
::
endl
;
file
<<
"Forward ge
ner
ic projection: "
<<
std
::
endl
;
file
<<
point
<<
" -> "
;
file
<<
genericMapProjection
->
TransformPoint
(
point
);
file
<<
std
::
endl
<<
std
::
endl
;
...
...
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