[gdal-dev] Polygonize: are these steps the right ones?

Jorge Arevalo jorgearevalo at gis4free.org
Fri Mar 12 08:00:00 EST 2010


On Fri, Mar 12, 2010 at 1:54 PM, Ari Jolma <ari.jolma at gmail.com> wrote:
> I should have sent this to the list and not just Jorge. Anyway, the problem
> is solved.
>
> Jorge Arevalo kirjoitti:
>>
>> The problem is that the MEM-based layer doesn't have fields. So, if I
>> use "0" as iPixValField, I get an error, because there's no field with
>> index 0 in the Feature. Of course, the same result if I use any value
>>
>>>
>>> 0.
>>>
>>
>> I thought the solution was to "modify" the Layer's Feature Definition
>> to allow fields in the Features created. So, I created a new Feature
>> Defintion, with a Field Definition of one field, of type OFTReal.
>> Then, I created a new Feature following this schema, and I added this
>> Feature to the Layer. I know, it's not the best way, and it didn't
>> work. But I don't know how to "force" the MEM-based layer to allow
>> fields in its features.
>
> Jorge,
>
> You can manipulate (well, add fields only) the schema of the layer with
> the CreateField method:
> http://www.gdal.org/ogr/classOGRLayer.html#00b1376a1eabb1298ef278f92f6d84be
>
> This works for in-memory layers. Depending on the driver, when you add a
> feature, the schema may become read-only.
>
> Best regards,
>
> Ari
>

Yes, I should have added the list direction too. Sorry. Thanks for
solution, it was easier than my code.

Best regards,
Jorge


> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list