Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#3141 closed enhancement (fixed)

Schema of attributes of subsequent layers does not match ... terminating.

Reported by: peifer Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: default Version: 1.6.2
Severity: normal Keywords:
Cc:

Description

I am doing the following to create a tile index for about 500 shapefiles:

ogrtindex tindex1.shp clc90/*.shp

I am getting an index file with 30 tiles, then the fatal error. If I re-run the command, then I have about 50 tiles in the index file, after the 3rd run, I have 90 tiles and so on.

If I create the index file in a bash loop, then I have all tiles in the index file:

for tile in clc90/*.shp ; do ogrtindex tindex2.shp $tile ; done

Change History (5)

comment:1 Changed 12 years ago by Even Rouault

Milestone: 1.7.0
Resolution: fixed
Status: newclosed
Type: defectenhancement

This is not really a bug. The message means that you are trying to index a layer whose schema of attributes does not match the schema of the first layer in the tile index (all layers referenced by a tileindex must have the same schema in order MapServer? to work correctly).

If you look closely you'll see that even with the 'for tile in clc90/*.shp ; do ogrtindex tindex2.shp $tile ; done' all shapefiles are not referenced in your tileindex.

In r17887, instead of aborting the whole process, we now just skip layers whose schema does not match. The error message is improved to quote the layer and dataset names which cause problems.

comment:2 in reply to:  1 Changed 12 years ago by peifer

Replying to rouault:

If you look closely you'll see that even with the 'for tile in clc90/*.shp ; do ogrtindex tindex2.shp $tile ; done' all shapefiles are not referenced in your tileindex.

Hmm. I can't confirm your above statement. At the time I did of course check this immediately and the number of shapefiles in clc90/ and the number of polygon features in tindex2.shp was consistent.

Anyway, thanks for improving the tool's behaviour and error reporting.

comment:3 Changed 12 years ago by peifer

I just looked again into the issue. Indeed, the attribute schema is not consistent across all shapefiles. But ogrtindex doesn't seem to bother, when processing them one by one, in the shell loop.

And why should it actually make a difference, as the only attribute in the index file is LOCATION. (BTW, my usage of ogrtindex is unrelated to MapServer?. I just want a visual overview of the extents of my shapefile collection.)

comment:4 Changed 12 years ago by Even Rouault

  • "But ogrtindex doesn't seem to bother, when processing them one by one, in the shell loop."

--> this was indeed a defect of ogrtindex. The test of layer schema consistency was done just for the second and following layers added in the same ogrtindex session. That explains why it worked for you in the loop but not in the ogrtindex *.shp case. I've fixed that in r17889.

ogrtindex is meant to be primarily used with MapServer?. But your use case can make sense, so I've added a -accept_different_schemas flag that can be used to disable the test, at the expense of MapServer? compatibility.

  • "why should it actually make a difference, as the only attribute in the index file is LOCATION"

--> yes, the tileindex has always only one attribute, the 'LOCATION' field. The schema consistency check I'm refering about is about the schemas of the underlying layers referenced by the tileindex. MapServer? does care a lot that all the layers referenced by a tileindex have the same exact schema.

comment:5 Changed 12 years ago by peifer

Thanks again for the enhancement. I also learned that I can (mis-)use ogrtindex to quickly check that a collection of shapefiles has the same attribute schema. Occasionally, I need to know this, again completely unrelated to any Mapserver usage.

Note: See TracTickets for help on using tickets.