Hi Pawell, A shapefile is not usually spatially indexed, and ogr cannot use the ESRI index anyway, so the entire dataset is read every time to plot it. For a large shapefile this is considerable overhead, especially when you are zoomed in & only want to render a small region.
See the info here on how to create a spatial index for your shapefile: http://www.gdal.org/ogr/drv_shapefile.html either with a sql via ogr or using the shptree command. Essentially you have a data management issue - as an alternative approach, I suggest you look at a spatially enabled database (Postgis) if you want better performance & more effective indexes when rendering a large dataset, but zoomed in to a small area. You can use ogr2ogr or shp2pgsql to load shapefiles into a database, & the data management capabilities of a "proper" database are generally far better than managing shapefiles. HTH, Brent Wood --- On Sat, 3/6/10, Paweł Byszewski <[email protected]> wrote: > From: Paweł Byszewski <[email protected]> > Subject: [gdal-dev] faster way to display shapeFile > To: [email protected] > Date: Saturday, March 6, 2010, 9:16 AM > 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). > 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? > > > Regards, > Paweł > > -----Inline Attachment Follows----- > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
