This project has moved and is read-only. For the latest updates, please go here.

slow rendering when fiirst loading shapefiles

Topics: SharpMap v0.9 / v1.x
Sep 11, 2013 at 2:24 PM
  I'm new in using sharpmap.I use sharpmap 1.0 final versioin. I have encounterd a problem when loading a large shapefile(5m but more than 20000 polygons). i set the zoom to the whole extant, but the mapbox just render it too slowly, it almost takes 20 seconds.  I found out there is a same issue "" ,so i set zoomlevel to 1000. This works pretty well. 
   But still, i'm wondering if there is a better solution in zoom to the whole layer while consumes less time because arcgis can achieve this in 3 seconds. The topic i mentioned above said it will be solved in 2.0 release, but i can't find this version.
   Much thanks!
Sep 12, 2013 at 5:59 AM
Does it always take 20seconds to render? or only the first time...
Rendering of 20 000 polygons will always take some time (20seconds however seems a little bit to long). Do you really need to show all 20 000 polygons when viewing the whole extent?
Sep 12, 2013 at 6:48 AM
Thank you petlof, it's only when i load the file that takes 20 seconds, after that the program goes quite smooth. I don't need to render 20 000 polygons when viewing to the whole extent. Some one mentioned setting filters according to zoom level, but i just don't know how to implement. Filter according to what condition? The area of the polygon or something else?
Or is there any other way to speed up the first load rendering?
Sep 12, 2013 at 6:52 AM
Ok,, in general, the first time a Shapefile is accessed the spatial index is loaded into RAM. If this is big, it will take some time.
To minimize startup-costs you could try instead using a SQLite file for your data. Then dataaccess and especially spatial index access is much more faster
Sep 12, 2013 at 7:15 AM
Oh, i find these code in Sharpmap.extention, I'll try it.
Many thanks, petlof!