[gdal-dev] OGR style fields

Frank Warmerdam warmerdam at pobox.com
Fri Jan 18 15:56:58 EST 2008


Tamas Szekeres wrote:
> Folks,
> 
> Currently only a few of the OGR data sources have built in style
> support, however we might want to preserve the style information when
> copying the data from one data source to another.
> As of the implementation of GDAL RFC 6 we could do such things easily
> regardless of the target data source type, like for example:
> 
> ogr2ogr -overwrite -f "ESRI Shapefile" -sql "select *,OGR_STYLE from
> rivers where OGR_GEOMETRY='POLYGON'" rivers.shp rivers.tab
> 
> would copy all of the polygons from a mapinfo layer and add a new
> field containing the style string for each of the features.
> 
> It would be quite trivial to prepare a data source independent support
> to consume this information and return meaningful value when
> OGRFeature::GetStyleString is called.
> 
> As the benefit of this change we could consider each of these layer as
> having internal style information. For example we could use the
> mapserver STYLEITEM "AUTO" functionality with these layers.
> 
> The most trivial implementation to achieve this would changing
> OGRFeature::GetStyleString as follows:
> 
> const char *OGRFeature::GetStyleString()
> {
>     int  iStyleField;
> 
>     if (m_pszStyleString)
>         return m_pszStyleString;
> 
>     iStyleField = GetFieldIndex("OGR_STYLE");
>     if (iStyleField >= 0)
>         return GetFieldAsString(iStyleField);
> 
>     return NULL;
> }
> 
> What do you think about this kind of addition?

Tamas,

I would not object to this though I'd note I plan to prepare a MapServer
RFC to allow using OGR style strings from any datasource (not just through
CONNECTIONTYPE OGR) in the next few weeks.  So from a mapserver point of
view, I don't think this change is particularly necessary.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list