[gdal-dev] Can't access to points in a buffer returned geometry with OGR_G_GetX

Even Rouault even.rouault at spatialys.com
Mon Mar 29 08:42:33 PDT 2021


OGR_G_GetX() can only work on a Point or a LineString/LinearRing

for a polygon, you need to extract the ring first with 
OGR_G_GetGeometryRef() / OGR_G_GetGeometryCount()

Even

Le 29/03/2021 à 17:26, Joaquim Manuel Freire Luís a écrit :
>
> OK, one more from the Julia wrappers. Playing with buffers now, and it 
> works but I want to get the points and that fails
>
> julia> wkt = "POINT (1198054.34 648493.09)";
>
> julia> dbf = Gdal.buffer(Gdal.fromWKT(wkt), 500)
>
> Geometry: POLYGON ((1198554.34 648493.09,1198553.65476738 64 ... .09))
>
> julia> toWKT(dbf)[1:90]
>
> "POLYGON ((1198554.34 648493.09,1198553.65476738 
> 648466.922021879,1198551.60094768 648440.8"
>
> The ‘toWKT()’ function calls OGR_G_ExportToWkt()
>
> But now if I try to extract the points with OGR_G_GetX() it errors
>
> julia> Gdal.OGR_G_GetX(dbf.ptr, 0)
>
> ERROR 6: Incompatible geometry for operation                    # 
> ç============= ????
>
> 0.0
>
> julia> Gdal.OGR_G_GetPointCount(dbf.ptr)          # ç============= Why so?
>
> 0
>
> Although the toWKT() works, tat’s an ascii representation but I want I 
> want to access them in binary (not in WKB) to send to GMT.
>
> Joaquim
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210329/6ca2b415/attachment.html>


More information about the gdal-dev mailing list