[gdal-dev] faster way to display shapeFile

Frank Warmerdam warmerdam at pobox.com
Fri Mar 5 16:05:13 EST 2010


Paweł Byszewski wrote:
> Hello,
> I have some map in ShapeFile and I am using OGR to display it. I folow 
> the example od OGR website: OGR C++ API Read/Write Tutorial 
> <http://gdal.org/ogr/ogr_apitut.html>(http://gdal.org/ogr/ogr_apitut.html). 
> Unfortunately that way is very slow. I have map of whole country(only 
> roads) and even when I try to display onlu one big city and I set 
> spatial filter it takes very much times. Could you tell me if gdal/ogr 
> has oportunity to read big files in faster way?

Paweł,

I get the impression you have a very large shapefile and are only wanting
to draw a subarea.  I would suggest you spatially index the file and use
the SetSpatialFilter() method to fetch only features in the area of interest.

There is some information on spatial indexing for shapefiles at:

   http://www.gdal.org/ogr/drv_shapefile.html

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 gdal-dev mailing list