getShape w/ OGR and MapInfo Tabs

Stephan Holl holl at GDF-HANNOVER.DE
Tue May 10 02:00:12 EDT 2005


Hello Frank,

On Mon, 9 May 2005 16:46:28 -0400 Frank Warmerdam
<fwarmerdam at GMAIL.COM> wrote:

> 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.

I see. THanks for pointing this out. I will check how I can adopt my
script knowing this information now!

Thanks for your help

best
        Stephan
--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office (TCH) -  Vahrenwalder Straße 7   -   D-30165 Hannover
Internet: www.gdf-hannover.de      -      Email: holl at gdf-hannover.de
Phone : ++49-(0)511-9357560       -          Fax: ++49-(0)511-9357100



More information about the mapserver-users mailing list