[PROJ] problem with c++ API coding

Even Rouault even.rouault at spatialys.com
Wed May 31 15:40:38 PDT 2023


https://proj.org/en/latest/development/quickstart_cpp.html could be of 
help, but some part of it, namely the coordinateTransformer() that 
bridges the C++ API back to the C one, are only in PROJ 9.3dev. With 
older releases, you'd need to call exportToProj() on transformation 
objects, and instanciate a PJ* from that with proj_create().

Or use the C API: https://proj.org/en/latest/development/quickstart.html


Le 01/06/2023 à 00:32, Daniel Suson a écrit :
> 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.
>>
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the PROJ mailing list