3

In my project I'm using ogr (python bindings) for inserting spatial data in PostGIS.

The spatial data comes in all different formats (CSV, Shapefile, GeoJSON) etc and before creating new tables in PstGIS I'm reading the properties (or attributes) of the features and do some processing.

I've ran into an issue when I want to create a boolean field in the PostGis table. I could not find a boolean type in the OGR variable list that can be used for creating a field definition as I do with string and integer types:

    # For string type
        ogr.FieldDefn(field_name, ogr.OFTString)

    # For integer type
        ogr.FieldDefn(field_name, ogr.OFTInteger)

Does anyone know how to create the Postgresql boolean type with OGR Python? Have I missed something in the OGR Python docs ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.