[PROJ] problem with c++ API coding

Daniel Suson djsuson at gmail.com
Wed May 31 15:32:22 PDT 2023


Dear Gregg,

     Thank you for the rapid response. Based on what you wrote I 
essentially recreated parts of the source code that already did what I 
needed but wasn't in the API. This got me to the following:

   util::PropertyMap crsProperty = 
util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, "WGS 84")
.set(metadata::Identifier::CODESPACE_KEY, metadata::Identifier::EPSG)
.set(metadata::Identifier::CODE_KEY, 4979);
   util::PropertyMap datumProperty = 
util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, "World 
Geodetic System 1984")
.set(metadata::Identifier::CODESPACE_KEY, metadata::Identifier::EPSG)
.set(metadata::Identifier::CODE_KEY, 6326);
   util::PropertyMap ellipsoidProperty = 
util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, "WGS 84")
.set(metadata::Identifier::CODESPACE_KEY, metadata::Identifier::EPSG)
.set(metadata::Identifier::CODE_KEY, 7030);
   crs::GeodeticCRSNNPtr inputCRS = crs::GeodeticCRS::create(crsProperty,
datum::GeodeticReferenceFrame::create(datumProperty,
datum::Ellipsoid::createSphere(ellipsoidProperty,common::Length(radius)),
util::optional<std::string>(),
datum::PrimeMeridian::GREENWICH),
cs::CartesianCS::createGeocentric(common::UnitOfMeasure::METRE));
   util::PropertyMap mollweideProperty = 
util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, "Mollweide");
   operation::ConversionNNPtr mollweideConversion = 
operation::Conversion::createMollweide(mollweideProperty,
common::Angle(0.0),
common::Length(0.0),
common::Length(0.0));

My next question is pretty dumb. Now that I have the input CRS and the 
conversion created, how to I take a array position (which represent 
long/lat) from the input CRS and get the converted position for the map? 
I looked at the operation API but am not familiar enough with basic GIS 
to recognize what I need.

Sincerely,

Dan

On 5/31/23 07:30, Greg Troxel wrote:
> Daniel Suson <djsuson at gmail.com> writes:
>
>> My problem is that createMapNameEPSGCode is included in
>> operations/oputils.hpp, which is not copied into the include directory
>> when PROJ is built. Is this a problem with how PROJ was installed, or
>> am I missing something regarding how to get access to this?
> The first question to resolve is the definition of the C++, and whether
> what you want is formally part of that API.
>
> https://proj.org/en/latest/development/reference/cpp/index.html
>
> Searching for
>
>    site:proj.org "createMapNameEPSGCode"
>
> comes up empty.  So it might be that this function is not actually part
> of the API.
>


More information about the PROJ mailing list