MCPcopy Create free account
hub / github.com/OSGeo/PROJ / pj_vgrid_init

Function pj_vgrid_init

src/grids.cpp:3753–3800  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

3751
3752/**********************************************/
3753ListOfVGrids pj_vgrid_init(PJ *P, const char *gridkey) {
3754 /**********************************************
3755
3756 Initizalize and populate gridlist.
3757
3758 Takes a PJ-object and the plus-parameter
3759 name that is used in the proj-string to
3760 specify the grids to load, e.g. "+grids".
3761 The + should be left out here.
3762
3763 Returns the number of loaded grids.
3764
3765 ***********************************************/
3766
3767 std::string key("s");
3768 key += gridkey;
3769 const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s;
3770 if (gridnames == nullptr)
3771 return {};
3772
3773 auto listOfGridNames = internal::split(std::string(gridnames), ',');
3774 ListOfVGrids grids;
3775 for (const auto &gridnameStr : listOfGridNames) {
3776 const char *gridname = gridnameStr.c_str();
3777 bool canFail = false;
3778 if (gridname[0] == '@') {
3779 canFail = true;
3780 gridname++;
3781 }
3782 auto gridSet = VerticalShiftGridSet::open(P->ctx, gridname);
3783 if (!gridSet) {
3784 if (!canFail) {
3785 if (proj_context_errno(P->ctx) !=
3786 PROJ_ERR_OTHER_NETWORK_ERROR) {
3787 proj_context_errno_set(
3788 P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID);
3789 }
3790 return {};
3791 }
3792 proj_context_errno_set(P->ctx,
3793 0); // don't treat as a persistent error
3794 } else {
3795 grids.emplace_back(std::move(gridSet));
3796 }
3797 }
3798
3799 return grids;
3800}
3801
3802/***********************************************/
3803double pj_vgrid_value(PJ *P, const ListOfVGrids &grids, PJ_LP lp,

Callers 4

pj_vgridshift_forward_3dFunction · 0.85
pj_vgridshift_reverse_3dFunction · 0.85
vgridshift.cppFile · 0.85
deformation.cppFile · 0.85

Calls 4

pj_paramFunction · 0.85
splitFunction · 0.85
proj_context_errnoFunction · 0.85
proj_context_errno_setFunction · 0.85

Tested by

no test coverage detected