[Gdal-dev] using a feature to store a "Track"

Frank Warmerdam warmerdam at pobox.com
Wed Dec 10 12:39:18 EST 2003


mathieu_gdal wrote:
> Dear All,
> 
> I have a very basic question, I would like to know if my approach is
> good or not at all.
> 
> I have a list of points, called "a track". Each point is defined by :
> - a position (in lat,lon,WGS84)
> - an altitude
> - a heading (it is an example)
> 
> I would like to use the class OGRFeature to store this "Track".
> The Track's Geometry (lat, lon, and altitude) is very well managed in
> the OGRFeature (OGRFeature::poGeometry)
> But how to store the other attributes, such as heading?
> 
> My idea is to store the heading in a feature's special attribute, as a
> list of double. 
> This size of this list would be the same as the geometry size.
> To retrieve a specific point, I will have to retrieve its position with
> the geometry, and the heading with the "double list" attribute.
> It might be costly if I want to store many other parameters for each
> point. 

Mathieu,

This approach will work but the caveat is that very view OGR file formats
are going to support saving the list of doubles attribute type.  One low
tech alternative is to just keep the list of headings in string attribute
with commas between the values.  As long as the format you want to work
with supports long strings this should be OK.

The Shapefile format can actually store X, Y, Z and "M" for each geometry
vertex.  It would be ideal to map your heading to this measure value; however,
the current OGR Shapefile driver has no support for reading or writing to the
measure value.  Another approach might be to try and take advantage of this
by updating the Shapefile driver (the lower level Shapelib works just fine
for the measure values).

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