Skip to content

Commit b4cc04b

Browse files
committed
Acquire epsg from tif
1 parent 9523525 commit b4cc04b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

grid_map_geo/src/grid_map_geo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ bool GridMapGeo::initializeFromGeotiff(const std::string &path) {
8585

8686
const OGRSpatialReference *spatial_ref = dataset->GetSpatialRef();
8787
std::string name_coordinate = spatial_ref->GetAttrValue("geogcs");
88+
std::string epsg_code = spatial_ref->GetAttrValue("AUTHORITY", 1);
8889
// Get image metadata
8990
unsigned width = dataset->GetRasterXSize();
9091
unsigned height = dataset->GetRasterYSize();
@@ -99,7 +100,7 @@ bool GridMapGeo::initializeFromGeotiff(const std::string &path) {
99100

100101
double mapcenter_e = originX + pixelSizeX * width * 0.5;
101102
double mapcenter_n = originY + pixelSizeY * height * 0.5;
102-
maporigin_.espg = ESPG::CH1903_LV03;
103+
maporigin_.espg = static_cast<ESPG>(std::stoi(epsg_code));
103104
maporigin_.position = Eigen::Vector3d(mapcenter_e, mapcenter_n, 0.0);
104105

105106
Eigen::Vector2d position{Eigen::Vector2d::Zero()};

0 commit comments

Comments
 (0)