Monday, December 16, 2013

node-mapnik on windows

1) Cleaning up mess
npm cache clean if encounter issues despite changes

2) binding.gyp

2a) From the dos command prompt, running npm install
set protobuf_src=
eg set protobuf_src=x:\progra~1\protobuf\src
set cairo_src=
eg set cairo_src=x:\progra~1\cairo\src

2b) Modifying binding.gyp in directory node-mapnik
from
 'conditions': [
      ['OS=="win"', {
        'variables': {
          'PROTOBUF_INCLUDES%':'C:/dev2/protobuf/vsprojects/include',
          'PROTOBUF_LIBS%':'C:/dev2/protobuf/vsprojects/Release',
          'PROTOBUF_LIBRARY%':'libprotobuf-lite.lib',
to
 'conditions': [
      ['OS=="win"', {
        'variables': {
          'CAIRO_INCLUDES%':'$(CAIRO_SRC)',
          'PROTOBUF_INCLUDES%':'$(PROTOBUF_SRC)',
          'PROTOBUF_LIBS%':'$(PROTOBUF_SRC)/../vsprojects/Release',
          'PROTOBUF_LIBRARY%':'libprotobuf-lite.lib',

2c) from
'conditions': [
        ['OS=="win"', {
            'include_dirs':[
                '<!@(mapnik-config --includes)',
                '<!@(mapnik-config --dep-includes)',
                '<@(PROTOBUF_INCLUDES)'
              ],

to
'conditions': [
        ['OS=="win"', {
            'include_dirs':[
                '<!@(mapnik-config --includes)',
                '<!@(mapnik-config --dep-includes)',
                '<@(PROTOBUF_INCLUDES)',
                '<@(CAIRO_INCLUDES)'
              ],


3) As advised in binding.gyp, make changes to .node-gyp\*\common.gypi under user directory
xp - c:\documents and settings\username\...
win7 - c:\users\username\...


see https://groups.google.com/forum/?fromgroups=#!topic/gyp-developer/p98GJxYJuH4
see https://github.com/TooTallNate/node-gyp/issues/26


4)  Testing
npm install -g mocha
npm install sphericalmercator

Grab a copy of GDAL for windows from http://www.gisinternals.com/sdk/
sdkshell.bat to set the environment for
4a) PROJ_LIB
4b) GDAL_DATA


mocha -R spec to list details


Monday, September 09, 2013

Pay-it-forward

Decades of sustained, methodical development of Singapore’s water policies has its many players, from multi-national corporations to international organisations, all of whom have performed a crucial role. During the dialogue, Mr Lee acknowledged their contributions, and in a pay-it-forward move, Singapore now wants to share its expertise with other countries facing water shortages.

"We did not do this by ourselves. We climbed on other people’s shoulders. We brought this [technology] together and improved on them. We’re happy to have people climb on our shoulders, whether they are from the Middle East, China, India, whatever. It’s a collaborative effort. The world will need this because what we have assumed was limitless — endless supplies of water — is not so. We’ve found it not to be so, and that we’ve got a way out of it.” -MM Lee

C++ build environment for mapnik project on Windows

C/C++ General
\mapnik\mapnik-v2.2.0\include;\mapnik\mapnik-v2.2.0\include\mapnik\agg;.;%(AdditionalIncludeDirectories)


C/C++ Preprocessor
LINUX;_WINDOWS;HAVE_JPEG;HAVE_PNG;HAVE_TIFF;MAPNIK_USE_PROJ4;BOOST_REGEX_HAS_ICU;MAPNIK_THREADSAFE;BIGINT;HAVE_LIBXML2;HAVE_CAIRO;%(PreprocessorDefinitions)


Linker General
Additional Library Directories \mapnik\mapnik-v2.2.0\lib

Linker Input
mapnik.lib;icuuc.lib;icuin.lib;cairo.lib;libboost_system-vc100-mt-1_49.lib


main include

#include "mapnik/layer.hpp"
#include "mapnik/rule.hpp"
#include "mapnik/line_symbolizer.hpp"
#include "mapnik/polygon_symbolizer.hpp"
#include "mapnik/text_symbolizer.hpp"
#include "mapnik/feature_type_style.hpp"
#include "mapnik/graphics.hpp"
#include "mapnik/datasource_cache.hpp"
#include "mapnik/font_engine_freetype.hpp"
#include "mapnik/agg_renderer.hpp"
#include "mapnik/expression.hpp"
#include "mapnik/color_factory.hpp"
#include "mapnik/image_util.hpp"

#if defined(HAVE_CAIRO)
#include "mapnik/cairo_renderer.hpp"
#include "mapnik/cairo_context.hpp"
#endif

#include <iostream>



Remarks:
Build with
C/C++ Code Generation>Basic Runtime Checks>Default
C/C++ Code Generation>Runtime Library>Multi-threaded DLL (/MD)
If you attempt to build with C/C++ Code Generation>Runtime Library>Multi-threaded Debug DLL (/MDd)
1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_49.lib'

Sunday, August 18, 2013

Changing someone

“But we have each come to the understanding that there is no need to try to influence the other to your own point of view. We cannot change them. They cannot change us,” -Former MM Lee

Monday, April 08, 2013

log4cxx debugging

Add debug="true" to enable debugging example: log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' debug="true"\

QML extension

1. QML2_IMPORT_PATH is necessary for QML dll
example
set QML2_IMPORT_PATH=d:\qt\imports

2.uri
From the QML2_IMPORT_PATH, the uri comes into play
with a uri of qml.test (case sensitive),
the directory structure shall be %QML2_IMPORT_PATH%\qml\test

3.qmldir
Under the directory %QML2_IMPORT_PATH%\qml\test,
you shall have qmldir,
where the bare minimum configuration contains
plugin yourDllPluginName

optional
module uri

4.qmlpluginsdump
qmlpluginsdump will
first look at QML2_IMPORT_PATH
then the uri
The following command shall dump some values
qmlpluginsdump qml.test 1.0

5.qmltypes
Generate qmltypes with qmlpluginsdump
qmlpluginsdump qml.test 1.0 d:\qt\imports\ > d:\qt\imports\qml\test\dllname.qmltypes

6. Append typeinfo logger.qmltypes to qmldir


Title case for module name is a must to work -
Need to use Logger instead of logger for qmlRegisterType(uri, 1, 0, "logger");

Building log4cxx with VS 2010 express

Refers to http://www.lextm.com/2010/09/how-to-build-log4cxx-in-visual-studio.html

In addition, the dsp will not open in 2010, a conversion in 2008 is necessary to upgrade the project!