mapnik / mapnik

Mapnik is an open source toolkit for developing mapping applications

Home Page:http://mapnik.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mapnik on Windows10

lebtorte opened this issue · comments

Hello, I am very new to the whole mapnik topic and tried to install mapnik togehter with the python bindigs on a windwos 10 machine. Unfortunatelly without any success. I followed the windows installation guide but it does not work. I read some articles that mapnik is no longer supported at windows at all. Is this correct? I allways get the error: Module not found error: No module found named mapnik. I set the variables according to the installation guide but i am was wondering that for example there is no ..python\2.7\site-packages folder. I used the latest mapnik version 3.1.0 and python 3.10.5 version.

To build the current master for Windows, the easiest way is to go with vcpkg. There is also mapnik/python-mapnik#242 if you want the Python bindings as well (this is not merged into the official repo yet, so you will have to build the fork)

Can't comment on the old non-vcpkg method, you can see the page was last updated in 2018 (so probably it is meant for an older version of mapnik from the same period)

Since I didn't succeed building mapnik on OpenSuse, i tried on windows using vcpkg.
But I always get an error : Package proj4 does not have a database feature .
Anyone an idea?

Looks like your vcpkg is outdated. The proj4 database feature was removed several month ago.

Update vcpkg by:

cd <your_vcpkg_path>
git pull
./bootstrap-vcpkg

Then you should be able to compile mapnik simply by typing vcpkg install mapnik

I built mapnik with vcpkg successfully. Now I am trying to run the demo that comes with mapnic called rundemo.cpp. But i always get the same error:

LNK2019 Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class std::shared_ptr<class mapbox::util::variant<struct mapnik::value_null,bool,int,double,class icu_71::UnicodeString,struct mapnik::attribute,struct mapnik::global_attribute,struct mapnik::geometry_type_attribute,class mapbox::util::recursive_wrapper<struct mapnik::unary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::unary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper,class mapbox::util::recursive_wrapper,class mapbox::util::recursive_wrapper,class mapbox::util::recursive_wrapper > > __cdecl mapnik::parse_expression(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (_imp?parse_expression@mapnik@@ya?AV?$shared_ptr@V?$variant@Uvalue_null@mapnik@@_NHNVUnicodeString@icu_71@@Uattribute@2@Uglobal_attribute@2@Ugeometry_type_attribute@2@V?$recursive_wrapper@U?$unary_node@Unegate@tags@mapnik@@@mapnik@@@Util@mapbox@@v?$recursive_wrapper@U?$binary_node@Uplus@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uminus@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Umult@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Udiv@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Umod@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uless@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uless_equal@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ugreater@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ugreater_equal@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uequal_to@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Unot_equal_to@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$unary_node@Ulogical_not@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ulogical_and@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ulogical_or@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@Uregex_match_node@mapnik@@@9mapbox@@v?$recursive_wrapper@Uregex_replace_node@mapnik@@@9mapbox@@v?$recursive_wrapper@Uunary_function_call@mapnik@@@9mapbox@@v?$recursive_wrapper@Ubinary_function_call@mapnik@@@9mapbox@@@Util@mapbox@@@std@@abv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@3@@z)" in Funktion "_main". ConsoleApplication1 C:\Users\lt\source\repos\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1

did i miss something?

@lebtorte I need a bit more info.
especially how you include mapnik in your console application.
If you use msbuild, I can't help you that much. Make sure that the library is included correctly.
If you use cmake, it would be helpful if you could share the CMakeLists.txt

@mathisloge I shortened the programm so it became very easy. So now it is only an one liner:

#include <expression.hpp>
#include

int main()
{
mapnik::parse_expression("[NAME_EN] = 'Ontario'");
}

this causes the error:

LNK2019 Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class std::shared_ptr<class mapbox::util::variant<struct mapnik::value_null,bool,int,double,class icu_71::UnicodeString,struct mapnik::attribute,struct mapnik::global_attribute,struct mapnik::geometry_type_attribute,class mapbox::util::recursive_wrapper<struct mapnik::unary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::unary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper<struct mapnik::binary_node >,class mapbox::util::recursive_wrapper,class mapbox::util::recursive_wrapper,class mapbox::util::recursive_wrapper,class mapbox::util::recursive_wrapper > > __cdecl mapnik::parse_expression(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (_imp?parse_expression@mapnik@@ya?AV?$shared_ptr@V?$variant@Uvalue_null@mapnik@@_NHNVUnicodeString@icu_71@@Uattribute@2@Uglobal_attribute@2@Ugeometry_type_attribute@2@V?$recursive_wrapper@U?$unary_node@Unegate@tags@mapnik@@@mapnik@@@Util@mapbox@@v?$recursive_wrapper@U?$binary_node@Uplus@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uminus@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Umult@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Udiv@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Umod@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uless@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uless_equal@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ugreater@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ugreater_equal@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Uequal_to@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Unot_equal_to@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$unary_node@Ulogical_not@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ulogical_and@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@U?$binary_node@Ulogical_or@tags@mapnik@@@mapnik@@@9mapbox@@v?$recursive_wrapper@Uregex_match_node@mapnik@@@9mapbox@@v?$recursive_wrapper@Uregex_replace_node@mapnik@@@9mapbox@@v?$recursive_wrapper@Uunary_function_call@mapnik@@@9mapbox@@v?$recursive_wrapper@Ubinary_function_call@mapnik@@@9mapbox@@@Util@mapbox@@@std@@abv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@3@@z)" in Funktion "_main". MapTest C:\Projects\MapTest\MapTest\MapTest.obj 1

In visual studio In the VC++ Directories property page at library paths i added the directory that contains all the LIB files created by vcpkg . Then i added the path of the library headers directory created by vcpkg to Include Directories. In the Linker Input property page i added all names of the lib files. I copied all the dll´s created by vcpkg to the output folder.

Sorry, I can't help you that much with your setup. I recommend checking you visual studio settings, vcpkg setup or using cmake.

@lebtorte Did you find anything, I'm running into a very similar issue, also using vcpkg.

@lebtorte, in case you didn't find or for others. Some defines are to be manually added in a vcxproj. If using cmake, the find_package will pick up defines from vcpkg_installed\x64-windows\share\mapnik\mapnikTargets.cmake:

MAPNIK_THREADSAFE;BOOST_REGEX_HAS_ICU;BOOST_REGEX_HAS_ICU;BIGINT;MAPNIK_MEMORY_MAPPED_FILE;HAVE_PNG;HAVE_JPEG;HAVE_TIFF;HAVE_WEBP;MAPNIK_USE_PROJ;MAPNIK_PROJ_VERSION=90001;GRID_RENDERER;SVG_RENDERER

Add those to your project file and the linker errors should go away.