Artem, Okay, good to know.
Compiling the ogr plugin on windows would probably also offer a workaround to allowing shared access of shapefiles on windows. It seems the ogr plugin is not included in the windows binaries, right? Dane On May 12, 2009, at 9:08 AM, Artem Pavlenko wrote: > Hi Dane, > > You're right, this most likely to do with how mapped files are created > on diff platforms. I wonder if we should compile shape.input without > memory mapped files on windows. I think, on win32 all std::fstream's > implemented as memory mapped files anyway. We'll need to check this, > though. > > Artem > > 2009/5/12 Dane Springmeyer <[email protected]>: >> I've confirmed that QGIS's OGR driver opens with both >> FILE_SHARE_READ and >> FILE_SHARE_WRITE and show allow more than one process to open the >> file for >> update access at once (thanks to Frank Warmerdam). >> So, I figure that something about the way that Mapnik's use of >> boost is >> creating the need for exclusive access to the file on windows. If >> figure >> this must have to do with our implementation of memory mapped read >> access to >> the shapefiles. >> The boost docs indicate that a 'mapped_file_source' should be >> opened for >> read-only access: >> http://www.boost.org/doc/libs/1_38_0/libs/iostreams/doc/classes/mapped_file.html#mapped_file_source >> Does this really require exclusive access? >> Looking into: >> http://www.boost.org/doc/libs/1_39_0/boost/iostreams/device/mapped_file.hpp >> seems to indicate that on Windows (depending on compiler version) >> things may >> actually be opened in 'app' (append) mode: >> >> #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && >> defined(BOOST_RWSTD_VER) || >> \ >> defined(__BORLANDC__) && defined(_CPPLIB_VER) >> /**/ >> : mode(std::ios_base::openmode(0)), >> >> So, some leads but I'm not sure where to go from here. >> Anyone have thoughts? >> Dane >> >> On May 11, 2009, at 10:47 PM, Dane Springmeyer wrote: >> >> So I'm trying to debug a strange thing on windows where a shapefile >> opened in another application cannot be opened by Mapnik. >> >> I say strange because the problem does not occur on mac and linux - >> only on windows. But it does make logical sense that opening the same >> file in two running Python processes may create problems. >> >> Essentially, I've written a Python plugin to QGIS that loops through >> all active datasources open in QGIS, builds up a Mapnik map, and >> allows export to XML or rendering in the QGIS canvas. >> >> It works great on mac and linux, but on Windows I get an error like: >> >> shp = Shapefile(file='c:/temp_files/world_borders.shp') >> >> got exception ... >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> 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. >> >> QGIS uses the OGR C++ api to open the shapefile in read/write mode. I >> assume that the mapnik shapefile input opens read-only. >> >> Anyone have any ideas of potential workarounds? >> >> - Dane >> _______________________________________________ >> Mapnik-devel mailing list >> [email protected] >> https://lists.berlios.de/mailman/listinfo/mapnik-devel >> >> >> _______________________________________________ >> Mapnik-devel mailing list >> [email protected] >> https://lists.berlios.de/mailman/listinfo/mapnik-devel >> >> _______________________________________________ Mapnik-devel mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-devel
