Way to transform coordinates given an osgeo::proj::operation::CoordinateOperation?
Martin Desruisseaux <[email protected]>
| Newsgroups | gmane.comp.gis.proj-4.devel |
|---|---|
| Organization | Geomatys |
| Message-ID | <[email protected]> |
Hello
I'm trying to find the best way to transform coordinate tupples given an
osgeo::proj::operation::CoordinateOperation instance. My current
understanding is that I need to get a PJ object as below. Is that correct?
CoordinateOperationNNPtr operation = ...
PJ_CONTEXT *ctx = ...
PJ *pj = (ctx, operation);
// Then use PJ as documented in "getting started" guide.
If above is the right approach, looking at the source code of
pj_obj_create, there is two things I would like to do differently:
* Use an existing osgeo::proj::io::DatabaseContext instance.
* Do not fallback on pj_new() if the main block could not create the PJ.
So would the following block be okay (I know if use an internal method
call, but I didn't saw a way to avoid it yet):
DatabaseContext dbContext = ...;
auto formatter = PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_5, dbContext);
auto projString = coordop->exportToPROJString(formatter.get());
PJ *pj = pj_create_internal(ctx, projString.c_str());
// Done; do not touch to pj->iso_obj or pj->cpp_context.
Or is there a better way to "execute" a CoordinateOperation with C++ API?
Thanks,
Martin
_______________________________________________
PROJ mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/proj