getShape w/ OGR and MapInfo Tabs

Frank Warmerdam fwarmerdam at GMAIL.COM
Mon May 9 13:46:28 PDT 2005


On 5/9/05, Stephan Holl <holl at gdf-hannover.de> wrote:
> I have created a sample dataset with a small snippet and both mapinfo-
> tabs and shapedata, it is located here:
> 
> http://www.gdf-hannover.de/holl/tmp/example_mapinfo_problem.tar.gz
> 
> Perhaps you can have a look at it and point me to a solution for the
> problem.

Stephan, 

The problem with your script is that you are passing "0" for the
"shapeid".  For TAB files the feature ids are assigned sequentially
starting at 1, so in this case your getShape() isn't finding any shape.
 
Specific OGR drivers use different schemes for how to assign 
shapids.  For Shapefiles they start at zero.  for mapinfo files they
start at 1.  For DGN files they are "sparse" and indicate the sequential
element in the file corresponding to the feature (not all elements count
as features though). 

So, what you need is a way to fetch the first shape without assumption
about what feature id that might be.  That is fairly straight forward if you
use a query on the layer to get a list of shapeid's.  There may be
other sensible means too, that I am not familiar with.

In summary, there is no apparent bug, just confusion about legal
fetching mechanisms.

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 MapServer-users mailing list