mapnik-org/mapnik — Issue #340: Allow memory-mapping of shapefiles to be optional param for shape.input
Author: artemp
Created: 2011-10-11 07:50:08+00:00
State: open
Labels: Core_Library

The use of boost memory-mapped filesources on windows can create problems when access to shapefiles is shared. It seems that on windows the shape.input needs exclusive access so that if the shapefile it open (read-only) in another program Mapnik will fail to open the file and boost will throw an 'invalid handle' error:

{{{
>>> Shapefile(file='c:/temp_files/world_borders.shp')
got exception ...
Traceback (most recent call last):
File "", line 1, in
File "C:\mapnik_0_6_0\site-packages\mapnik\__init__.py", line 132, in Shapefile
return CreateDatasource(keywords)
RuntimeError: failed opening file: The handle is invalid.
}}}

So, it would be great to have memory-mapped file loading be able to be a parameter that could be turned off. This will also benefit Mapnik usage on systems with less memory.