[PROJ] Efficiently obtaining all known ellipsoid details

Nyall Dawson nyall.dawson at gmail.com
Mon May 18 15:00:50 PDT 2020


Hi list,

In QGIS we need to obtain a list of all known ellipsoid definitions
from proj. Currently we do this via the approach:

  if ( PROJ_STRING_LIST authorities =
proj_get_authorities_from_database( context ) )
  {
    PROJ_STRING_LIST authoritiesIt = authorities;
    while ( char *authority = *authoritiesIt )
    {
      if ( PROJ_STRING_LIST codes = proj_get_codes_from_database(
context, authority, PJ_TYPE_ELLIPSOID, 0 ) )
      {
        PROJ_STRING_LIST codesIt = codes;
        while ( char *code = *codesIt )
        {
          proj_create_from_database( context, authority, code,
PJ_CATEGORY_ELLIPSOID, 0, nullptr ) );
           proj_get_name(...)
           proj_ellipsoid_get_parameters(...)
         }
     }
   }
}

While this works, it's quite slow -- understandably, because it's
doing one-by-one lookups in the proj sqlite database. Is there a more
efficient approach which could be used to obtain all these details in
bulk?

Nyall


More information about the PROJ mailing list