[Qgis-developer] What's the difference between provider.geometryType() and layer.geometryType()
Anita Graser
anitagraser at gmx.at
Sat Oct 19 12:49:41 PDT 2013
Thanks for the explanation Martin! I hope here is a way to have
consistency again without necessarily breaking working code.
@Victor: A few comments in the example scripts explaining the issue would
already help a lot I think.
Best wishes,
Anita
Am 19.10.2013, 19:54 Uhr, schrieb Victor Olaya <volayaf at gmail.com>:
> I wasn't aware of that difference that Martin mentions. I guess that,
> from the Processing side, the only thing to do is to document clearly
> which find of enumeration value is expected, and also how to convert
> it in case you have a value corresponding to the other enumeration. I
> will try to add that to the Processing documentation
>
> thanks for finding this issue
>
> 2013/10/19 Martin Dobias <wonder.sk at gmail.com>:
>> 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