[gdal-dev] I couldn't use OGRCreateCoordinateTransformation
Ahmet Temiz
ahmettemiz88 at gmail.com
Sun Jun 20 01:28:26 PDT 2021
Thank you,
I am reading a shape file with line geometry in epsg:3857 projection.
.I create buffer from lines (polyCollect)
.union them (unionCascaded)
. then convert it to multipolygon (poOGRMultiPolygon)
. then transform is necessary for each polygon in poPolygon from epsg:3857
to epsg:4326
Here is the code:
OGRGeometry * unionCascaded = polyCollect->UnionCascaded();
OGRMultiPolygon * poOGRMultiPolygon= ( OGRMultiPolygon * )
unionCascaded;
int NumberOfGeometries= poOGRMultiPolygon->getNumGeometries();
OGRSpatialReference source;
OGRSpatialReference dest;
source.SetWellKnownGeogCS( "EPSG:3857" );
dest.SetWellKnownGeogCS( "EPSG:4326" );
OGRCoordinateTransformation* ct =
OGRCreateCoordinateTransformation(&source, &dest);
for (int j=0; j< NumberOfGeometries ;j++ ){
OGRGeometry * polyGeometry = poOGRMultiPolygon -> getGeometryRef(j);
OGRPolygon *poPolygon= ( OGRPolygon *) polyGeometry;
OGRErr err=poPolygon->transform(ct) ;
On Sun, Jun 20, 2021 at 11:02 AM Brad Hards <bradh at frogmouth.net> wrote:
> What is the `polyGeometry`?
>
>
>
> Can you try to generate a compilable, minimal, self-contained example that
> demonstrates the problem?
>
>
>
> Brad
>
>
>
> *From:* gdal-dev <gdal-dev-bounces at lists.osgeo.org> *On Behalf Of *Ahmet
> Temiz
> *Sent:* Sunday, 20 June 2021 5:56 PM
> *To:* gdal-dev <gdal-dev at lists.osgeo.org>
> *Subject:* [gdal-dev] I couldn't use OGRCreateCoordinateTransformation
>
>
>
> Hi,
>
> ..
>
>
>
> source.SetWellKnownGeogCS( "EPSG:3857" );
> dest.SetWellKnownGeogCS( "EPSG:4326" );
>
> OGRCoordinateTransformation* ct =
> OGRCreateCoordinateTransformation(&source, &dest);
>
>
>
> OGRPolygon *poPolygon= ( OGRPolygon *) polyGeometry;
>
> OGRErr err=poPolygon->transform(ct) ; // it generates this error.
>
>
>
> ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
>
>
>
> I think, this occurs, because I could not assign any SRS value to polygon
>
>
>
> How can I solve this problem?
>
>
>
> regards
>
>
>
> --
>
> Ahmet Temiz
> Jeoloji Müh.
> Afet ve Acil Durum Yönetimi Başkanlığı
> Deprem Dairesi Başkanlığı
>
>
> ________________________
>
> Ahmet Temiz
> Geological Eng.
>
> Disaster and Emergency Management
> of Presidency
>
--
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Deprem Dairesi Başkanlığı
________________________
Ahmet Temiz
Geological Eng.
Disaster and Emergency Management
of Presidency
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210620/2a80c4e8/attachment.html>
More information about the gdal-dev
mailing list