After successfully working with node-mapnik (and the gorgeous vector tiles) on Linux I'm trying to set them up on Windows too, but have come to a dead end.

What I've done so far:

  • Installed mapnik 2.2.0 SDK and added the bin and lib directories to the PATH.
  • Using npm install mapnik shows an error about a missing cairo header file.
  • Cloning the repository and adding the cairo directory to binding.gyp solved the header issue.
  • Next error is about the target architecture (32 vs. 64bit), because the generated solution is 64bit only. I solved this by adjusting the gyp config parameters to get a Win32 target.
  • Next errors are about missing boost libraries. I followed the tutorial on how to build mapnik dependencies on Windows to the letter and added the boost-49-vc100\lib directory to the AdditionalLibraryDirectories. Which results in this error:

    Creating library C:\dev2\node-mapnik\node-mapnik\build\Release\_mapnik.lib and object C:\dev2\node-mapnik\node-mapnik\build\Release\_mapnik.exp LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\dev2\node-mapnik\node-m apnik\build\_mapnik.vcxproj] mapnik_image_view.obj : error LNK2001: unresolved external symbol "void __cdecl boost::throw_exception(class std::exception const & )" (?throw_exception@boost@@YAXABVexception@std@@@Z) [C:\dev2\node-mapnik\ node-mapnik\build\_mapnik.vcxproj] C:\dev2\node-mapnik\node-mapnik\build\Release\_mapnik.node : fatal error LNK1120: 1 unresolved externals [C:\dev2\node-mapnik\node- mapnik\ build\_mapnik.vcxproj]

Any suggestions on how to get node-mapnik (with vector tile support) running on Windows?


I think the problem is a linking issue: you likely need /MD while /MT is being set. See Step 3 in my comment at https://github.com/mapnik/node-mapnik/issues/202#issuecomment-31876610.

|improve this answer|||||

Solution (tested on W7-64 with node.js-32. 64bit currently not supported):

  • use node-mapnik from Github
  • get cairo sources: http://www.cairographics.org/
  • copy cairo-svg-surface.c, cairo-svg.h and cairo-svg-surface-private.h to C:\mapnik-v2.2.0\include
  • make proj4 epsg files available: SET PROJ_LIB=C:\mapnik-v2.2.0\share\proj
  • now npm install should finish successfully, provided that all other requirements are met: mapnik SDK, Python, protobuf, etc, ...
  • register all needed input plugins in your script (not auto registered in current Github source) e.g. shapefile input: mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'shape.input'));
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.