[Gdal-dev] Label Styles and MapInfo Formats

Frank Warmerdam warmerdam at pobox.com
Tue May 25 16:15:38 EDT 2004


L Pool wrote:
> Hi,
> 
> I've posted this question before and I'm still stuck with this problem,
> can anybody offer some advice?
> 
> I'm using OGR Style String Management to manage the Styles from Vector Map
> Formats. Sofar its been going well. Because I'd like to be able to handle a
> variety of Vector Maps, I'd like to stick to the common interface provided
> by the OGR Style Tools and Style Definitions. And not delve into the Field
> Definitions of the Vector Tables.
> 
> Currently I've hit a bit of a hitch with one of the Vector Formats I've been
> processing - the Table is defined as (below is an excerpt from the console
> output of my program):
> 
> For layer 2
> Layer Schema Definition   - Country_Name
> With 3 Field(s)
> Field 1 - Name: "Countries" Type: "String"
> Field 2 - Name: "Longitude" Type: "Double"
> Field 3 - Name: "Latitude" Type: "Double"
> Layer has 64 features
> Layer has a Geographic Spatial Ref
> Layer has bounds - (73.546,-42.04) to (229.78,46.77)
> 
> The Geometry is OGRPoint and one would expect that the Point would the
> Lat/Long pair where the Country Name should be placed - but the Style Tool
> is not defined as a Label Tool and the Country Name Text is therefore not
> available by using the Style Tools. For the moment I'm hacking it a bit by
> looking for Fields defined as String when getting an OGRPoint Geometry and
> then extracting the Field Value from the Feature - but I would like to know
> if there is a more eloquent and generic way to acquire the Text.

Louis,

You don't mention what format you are working with.  I will warn you that only
a few formats (MapInfo and DGN?) actually return styling information via OGR.
Other formats operate on a pure GIS data level and you have to infer or supply
the styling information from somewhere else.  Many GIS formats have no styling
information in the basic vector data files (eg Shapefile).

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    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list