[gdal-dev] ogr2ogr MapInfo Tab + Styling

Simon Greener simon at spatialdbadvisor.com
Tue Sep 29 20:57:39 EDT 2009


I am using ogr2ogr I would like to know how to use it to write styling information to the MapInfo TAB files it generates.

Scenario: I am trying to create a styled MapInfo tab file from an Oracle Spatial database. I don't have the MAPINFO.MAPINFO_MAPCATALOG tables created or populated. But I can create views which have any column I like such as MI_STYLE or OGR_STYLE with the appropriate MapInfo styling (PEN etc) or OGR styling information. For example, I have done this:

drop   table australian_cities;
create table australian_cities (
   abbr      varchar2(10),
   city_name varchar2(100),
   geom      mdsys.sdo_geometry

insert into australian_cities values('ADL','Adelaide',mdsys.sdo_geometry('POINT(138.60 -34.93)',4326));
insert into australian_cities values('BNE','Brisbane',mdsys.sdo_geometry('POINT(153.02 -27.47)',4326));
insert into australian_cities values('CBR','Canberra',mdsys.sdo_geometry('POINT(149.13 -35.30)',4326));
insert into australian_cities values('DRW','Darwin',mdsys.sdo_geometry('POINT(130.83 -12.45)',4326));
insert into australian_cities values('HBA','Hobart',mdsys.sdo_geometry('POINT(147.32 -42.88)',4326));
insert into australian_cities values('MEL','Melbourne',mdsys.sdo_geometry('POINT(144.97 -37.82)',4326));
insert into australian_cities values('PER','Perth',mdsys.sdo_geometry('POINT(115.85 -31.95)',4326));
insert into australian_cities values('SYD','Sydney',mdsys.sdo_geometry('POINT(151.20 -33.87)',4326));

select ac.geom.Get_WKB() from australian_cities ac;

create or replace view vw_australian_cities
select rownum as rid,
        a.abbr as abbreviation,
        a.geom.Get_WKB() as geom,
        CAST('SYMBOL(c:#00FF00,id:''points.sym-45,ogr-sym-' || to_char(rownum + 6) || ''')' as varchar2(255)) as OGR_STYLE
   from australian_cities a;

select * from vw_australian_cities;

Notice that I have create a view an OGR_STYLE column that is varchar(255) as in "2.9 Using OGR SQL to transfer the style between the data sources"
in http://www.gdal.org/ogr/ogr_feature_style.html

Yet when I use ogr2ogr to create the tab file the per-row styling is ignored.

Anyone able to help me?

I would be happy to start with ogr2ogr being able to write a dataset level (not per row) style for all records in the tab file and build up.

SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
Email: simon at spatialdbadvisor.com
Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515 (147° 12' 18" E)
Latitude: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg

More information about the gdal-dev mailing list