[Qgis-developer] What's the difference between provider.geometryType() and layer.geometryType()

Martin Dobias wonder.sk at gmail.com
Sat Oct 19 08:33:09 PDT 2013


Hi Anita

looking into the code... the unintuitive part is that these
geometryType() methods return values from different enumerations:
- provider's geometryType() returns value from WKBType enumeration
- layer's geometryType() returns value from GeometryType enumeration
(translated from provider's geometryType())

GeometryType has just coarse differentiation (Point, Line, Polygon,
UnknownGeometry, NoGeometry), while WKBType is more fine grained
(WKBPoint, WKBPoint2D, WKBMultiPoint, ...)

I totally agree that it is confusing... they should be at least called
differently (e.g. geometryWkbType vs geometryType).

Regards
Martin


On Sat, Oct 19, 2013 at 9:46 PM, Anita Graser <anitagraser at gmx.at> wrote:
> Hi Victor,
>
> I've been porting one of my scripts to the new Processing. Everything seems
> fine but I'm confused about one issue:
> It seems like almost everything can be accessed via the layer now, e.g.
> crs(), pendingFields(), etc. However, if I try to use layer.geometryType()
> in the VectorWriter constructor, I get an error. It only works if I do:
>
> writer = VectorWriter(output, None, fields, provider.geometryType(),
> layer.crs() )
>
> What's the reason for this unintuitive behavior?
>
> Thanks and best wishes,
> Anita
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list