Ticket #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
Note: See
TracTickets for help on using
tickets.
