Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4169 closed enhancement (fixed)

Improvement to reduce size of .qix files

Reported by: rouault Owned by: rouault
Priority: normal Milestone: 6.2 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords: shapefile qix
Cc: warmerdam

Description

This ticket ports the improvement done in shapelib's shptree.c to reduce the size of .qix files, when a node has only one subnode child.

See http://trac.osgeo.org/gdal/ticket/4472 for the details.

I've verified that after the improvement both 'ogrinfo -sql "create spatial index on ogr_shape_qix' ogr_shape_qix.shp' and 'shptree ogr_shape_qix.shp' produce binary identical files. Where ogr_shape_qix is produced by the following OGR Python script

###############################################################################
def build_rectangle_from_point(x, y, radius = 0.1):
    return ogr.CreateGeometryFromWkt('POLYGON((%f %f,%f %f,%f %f,%f %f,%f %f))' % \
        (x-radius,y-radius,x-radius,y+radius,x+radius,y+radius,x+radius,y-radius,x-radius,y-radius))

from osgeo import ogr
shape_drv = ogr.GetDriverByName('ESRI Shapefile')
ds = shape_drv.CreateDataSource('ogr_shape_qix.shp')
lyr = ds.CreateLayer("ogr_shape_qix")

for x in range(100):
    for y in range(100):
        feat = ogr.Feature(lyr.GetLayerDefn())
        feat.SetGeometry(build_rectangle_from_point(x,y))
        lyr.CreateFeature(feat)
        feat = None

Change History (2)

comment:1 by rouault, 12 years ago

Resolution: fixed
Status: newclosed

Commited in trunk (r13020)

comment:2 by rouault, 12 years ago

Note: on the above sample, the size of the .qix after the patch is 706924 bytes, whereas it was 1275228 before. So a significant improvement.

Note: See TracTickets for help on using tickets.