[gdal-dev] unable to write a shapefile using ogr

Beau Taylor purelyamethyst at gmail.com
Fri Sep 12 22:54:58 PDT 2014


Even Rouault

Thanks, I got it.

On Fri, Sep 12, 2014 at 5:18 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> Selon Beau Taylor <purelyamethyst at gmail.com>:
>
> > I tried to insert the 'feature name', but could not. Can some one correct
> > it?
> >
> > field_defn = ogr.FieldDefn("Name", ogr.OFTString)
> > field_defn.SetWidth(32)
>
> There's a missing call to :
> layer.CreateField(field_defn)
>
> and you should make sure to instanciate the feature *after* having added
> the
> field to the layer, otherwise crash is likely.
>
>
> > feature.SetField("Name", name)
> >
> >
> >
> > On Thu, Sep 11, 2014 at 6:33 AM, Jukka Rahkonen <
> jukka.rahkonen at mmmtike.fi>
> > wrote:
> >
> > > Kyle Shannon <kyle <at> pobox.com> writes:
> > >
> > > >
> > > > Style is usually dictated by the application.  You can set them in
> the
> > > > app, or for some formats/drivers you can use the OGR style API:
> > > >
> > > > http://gdal.org/ogr_feature_style.html
> > > >
> > > > AFAIK, shapefiles do not support styles
> > >
> > > As you said, style is dictated by application. If you create an
> "OGR_STYLE"
> > > column into shapefile and populate it with OGR feature style strings
> some
> > > programs can utilize them. I know that Mapserver can do it as well as
> GDAL
> > > when it writes PDF files.
> > >
> > > -Jukka Rahkonen-
> > >
> > > _______________________________________________
> > > gdal-dev mailing list
> > > gdal-dev at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > >
> >
>
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140913/71b9c37a/attachment.html>


More information about the gdal-dev mailing list