I am wondering what storage method will result in the fastest reading of the map vectors for rendering. SHP? PostGres? SQLite? (They do not change often and I do not need spatial functions for these vectors).
|
Speed TestsThere are some very speed tests of shapefiles versus database (PostGIS) for MapServer in this presentation (from 2007). In summary:
And the times in detail, which can also help to decide if the storage format is an important factor.
Always use FastCGI in MapServer if using a database, as the database connections can be reused, otherwise a new connection must be created on every request. Implementations for Shapefile ReadersThe speed of reading a shapefile (and data from a database) depends on the specific coding implementation. The source code for MapServer opening a shapefile can be seen here. Following the comments you can see how important it is to have an index. Normally you can only read a file in one direction to get a record, but with an index you can read in two directions.
Another is example of opening a shapefile can be seen in the Python source for PyShp. Again you can see how an index is used to find specific shapes directly. Other Factors to CondsiderThe limitations of the DBF format (limits on field size, no null support, limits on text storage), should also be taken into consideration when deciding on whether or not to use a database. A database also offers means of securing data, easier joining and creation of views, logging and many other features you won't get with a standalone file. |
|||
|
|
|
Contrary to what dariapra says, my experience in developing Maperitive tells me that the greatest bottleneck is in actual loading of the data before rendering. It all very much depends on how large the overall stored dataset is and how large is the dataset you are trying to render in one go. If you can load it all up into memory, then shapefiles are probably better than using a database engine. |
|||||||||||
|
|
Which program will you use for rendering? This may influence the results. Anyway, having a shapefile with a spatial index (eg http://mapserver.org/utilities/shptree.html ) which is used is often the fastest technique. Apart from that: it depends on you application, but caching your rendered results is often much more useful for improving performance. |
|||
|
|
Shapefile will be the quickest and probably your best bet. There is overhead for any SQL database, then there is managing the return of large result sets (conversion from database datatypes to native datatypes will also slow things). Try using an open source package from maptools.org to do your reads. The ArcGIS tools, though purpose built, do have a bit of overhead to get started and are expensive. Hope this helps |
|||
|
|