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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
71e0e2b2
Commit
71e0e2b2
authored
15 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
ENH: better handling of projections for VectorDataToImageFilter
parent
f714626b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Common/otbVectorDataToImageFilter.txx
+21
-4
21 additions, 4 deletions
Code/Common/otbVectorDataToImageFilter.txx
Testing/Code/Common/otbVectorDataToImageFilter.cxx
+1
-1
1 addition, 1 deletion
Testing/Code/Common/otbVectorDataToImageFilter.cxx
with
22 additions
and
5 deletions
Code/Common/otbVectorDataToImageFilter.txx
+
21
−
4
View file @
71e0e2b2
...
...
@@ -34,6 +34,8 @@
#include <mapnik/value.hpp>
#include "ogr_spatialref.h"
namespace otb
{
...
...
@@ -210,10 +212,23 @@ namespace otb
VectorDataConstPointer input = this->GetInput();
InternalTreeNodeType * inputRoot = const_cast<InternalTreeNodeType *>(input->GetDataTree()->GetRoot());
std::string vectorDataProjection;
// itk::ExposeMetaData<std::string>(input->GetMetaDataDictionary(), MetaDataKey::ProjectionRefKey, vectorDataProjection);
vectorDataProjection = "+proj=utm +zone=31 +ellps=WGS84";
m_Map.set_srs(vectorDataProjection);
//Converting the projection string to the porj.4 format
std::string vectorDataProjectionWKT;
itk::ExposeMetaData<std::string>(input->GetMetaDataDictionary(), MetaDataKey::ProjectionRefKey, vectorDataProjectionWKT);
// OGRSpatialReference oSRS;
// oSRS.importFromWkt(vectorDataProjectionWKT.c_str());
// std::cout << "WKT -> " << vectorDataProjectionWKT << std::endl;
OGRSpatialReference oSRS(vectorDataProjectionWKT.c_str());
char * pszProj4;
oSRS.exportToProj4(&pszProj4);
std::string vectorDataProjectionProj4(pszProj4);
CPLFree(pszProj4);
// std::cout << "Proj.4 -> " << vectorDataProjectionProj4 << std::endl;
// std::string vectorDataProjectionProj4 = "+proj=utm +zone=31 +ellps=WGS84";
m_Map.set_srs(vectorDataProjectionProj4);
ProcessNode(inputRoot,mDatasource);
...
...
@@ -221,6 +236,7 @@ namespace otb
std::cout << "Datasource size: " << mDatasource->size() << std::endl;
mapnik::Layer lyr("world");
lyr.set_srs(vectorDataProjectionProj4);
lyr.set_datasource(mDatasource);
// lyr.add_style("river");
lyr.add_style("minor-roads-casing");
...
...
@@ -352,6 +368,7 @@ namespace otb
// std::cout << " -> " << (*mfeature)["name"] << std::endl;
// std::cout << "Type: " << dataNode->GetFieldAsString("type") << std::endl;
// std::cout << "OSM ID: " << dataNode->GetFieldAsString("osm_id") << std::endl;
boost::put(*mfeature, "highway", tr.transcode((dataNode->GetFieldAsString("type")).c_str()));
mDatasource->push(mfeature);
...
...
This diff is collapsed.
Click to expand it.
Testing/Code/Common/otbVectorDataToImageFilter.cxx
+
1
−
1
View file @
71e0e2b2
...
...
@@ -88,7 +88,7 @@ int otbVectorDataToImageFilter(int argc, char * argv[])
typedef
otb
::
VectorDataExtractROI
<
VectorDataType
>
ExtractROIType
;
ExtractROIType
::
Pointer
extractROI
=
ExtractROIType
::
New
();
extractROI
->
SetRegion
(
region
);
extractROI
->
SetInput
(
reader
->
GetOutput
());
extractROI
->
SetInput
(
projection
->
GetOutput
());
typedef
otb
::
VectorDataToImageFilter
<
VectorDataType
,
ImageType
>
VectorDataToImageFilterType
;
VectorDataToImageFilterType
::
Pointer
vectorDataRendering
=
VectorDataToImageFilterType
::
New
();
...
...
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