generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: break out projection wrapper into new component
- Loading branch information
Showing
6 changed files
with
87 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef NGEN_GEOPACKAGE_PROJ_HPP | ||
#define NGEN_GEOPACKAGE_PROJ_HPP | ||
|
||
#include <boost/geometry/srs/projection.hpp> | ||
|
||
namespace ngen { | ||
namespace srs { | ||
|
||
namespace bg = boost::geometry; | ||
|
||
struct epsg | ||
{ | ||
using srs_type = bg::srs::dpar::parameters<double>; | ||
|
||
enum { | ||
wgs84 = 4326, | ||
conus_albers = 5070, | ||
mercator = 3857 | ||
}; | ||
|
||
static srs_type get(uint32_t srid); | ||
|
||
private: | ||
static const srs_type epsg5070_; | ||
static const srs_type epsg3857_; | ||
}; | ||
|
||
} // namespace srs | ||
} // namespace ngen | ||
|
||
#endif // NGEN_GEOPACKAGE_PROJ_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "proj.hpp" | ||
#include <boost/geometry/srs/projections/epsg.hpp> | ||
|
||
namespace ngen { | ||
namespace srs { | ||
|
||
const epsg::srs_type epsg::epsg5070_ = | ||
epsg::srs_type(bg::srs::dpar::proj_aea) | ||
(bg::srs::dpar::ellps_grs80) | ||
(bg::srs::dpar::towgs84, {0,0,0,0,0,0,0}) | ||
(bg::srs::dpar::lat_0, 23) | ||
(bg::srs::dpar::lon_0, -96) | ||
(bg::srs::dpar::lat_1, 29.5) | ||
(bg::srs::dpar::lat_2, 45.5) | ||
(bg::srs::dpar::x_0, 0) | ||
(bg::srs::dpar::y_0, 0); | ||
|
||
const epsg::srs_type epsg::epsg3857_ = | ||
epsg::srs_type(bg::srs::dpar::proj_merc) | ||
(bg::srs::dpar::units_m) | ||
(bg::srs::dpar::no_defs) | ||
(bg::srs::dpar::a, 6378137) | ||
(bg::srs::dpar::b, 6378137) | ||
(bg::srs::dpar::lat_ts, 0) | ||
(bg::srs::dpar::lon_0, 0) | ||
(bg::srs::dpar::x_0, 0) | ||
(bg::srs::dpar::y_0, 0) | ||
(bg::srs::dpar::k, 1); | ||
|
||
auto epsg::get(uint32_t srid) -> srs_type | ||
{ | ||
switch (srid) { | ||
case 5070: | ||
return epsg5070_; | ||
case 3857: | ||
return epsg3857_; | ||
default: | ||
return bg::projections::detail::epsg_to_parameters(srid); | ||
} | ||
} | ||
|
||
} // namespace srs | ||
} // namespace ngen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters