Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Re: Problem: Opening a 20-30MB sized ShapeFile
Chirag Modh wrote: > Hi All, > > I am opening ShapeFile (.shp) in IDL by using IDLffShape class. > My code run nicely for small ShapeFile, but when I am loading 5MB sized > ShapeFile it takes 2-3 Minuts and for 30MB sized ShapeFile it takes too > much time to open some time it's hangs up . > For same file ENVI not takes too much time it opens it very quickly. > My programme is written bellow > what I am doing. > > oWin= obj_new('IDLgrWindow') > oView=obj_new('IDLgrView') > oModel=obj_new('IDLgrModel') > oView->Add,oModel > > entity=self->IDLffShape::GetEntity(/ALL) > for i=0, self.nRecord-1 do begin ; self.nRecord = 1,00,000 > > DATA= (*entity[i].vertices) > oPolygon=OBJ_NEW('IDLgrPolygon') > oPolygon->SetProperty,DATA=temporary(data) > > oModel->Add, oPolygon > self->IDLffShape::DestroyEntity, entity[i] > endfor > oWin->Draw,oView I trust that while your title leads me to believe that you can't open a large shapefile your problem is that you can't display the data within the shapefile. I don't work with shape files but right away I see that you are most likely creating a 100,000 (or did you mean 1,000,000) polygon objects and that can be an issue. Since you aren't providing any connectivity data, these must be individual points? Why aren't you just combining all of the vertices into a single polygon object? What exactly is (*entity[i].vertices)? Why are you using IDLgrPolygon vs IDLgrPolyline? Just guessing, but I would try to limit the number of polygon objects by combining vertices and providing connectivity data. I would guess IDL can draw 1000, 1000 vertex lines a lot faster than 1,000,000 individual objects representing points. Without knowing what your data is, it is hard to be more specific. -Rick