artemp/trac2github — Issue #343: Allow memory-mapping of shapefiles to be optional param for shape.input
Author: artemp
Created: 2011-10-09 20:28:47+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.