diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..8488c7561f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.vscode +.git +build +build-tmp* +node_modules +package-lock.json +vcpkg +lib/binding diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml new file mode 100644 index 0000000000..d9d3964ad6 --- /dev/null +++ b/.github/workflows/npm-publish-github-packages.yml @@ -0,0 +1,81 @@ +name: Node.js Package + +on: + release: + types: [created] + +env: + VCPKG_SHA: 5ef52b5b75887fb150711f5effb221dd98b99e6f, + NUGET_REGISTRY: https://nuget.pkg.github.com/mathisloge/index.json + NUGET_USERNAME: mathisloge + VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite" + VCPKG_NUGET_REPOSITORY: https://github.com/mathisloge/vcpkg-nuget.git +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + #- os: windows-latest + # architecture: x64 + # node_version: 16 + + - os: ubuntu-latest + mono: mono + architecture: x64 + node_version: 16 + + #- os: macos-latest + # mono: mono + # architecture: x64 + # node_version: 16 + + permissions: + contents: read + packages: write + + steps: + - uses: ilammy/msvc-dev-cmd@v1 + + - uses: actions/checkout@v2 + + - name: checkout vcpkg + uses: actions/checkout@v2 + with: + repository: "dg0yt/vcpkg" + ref: gdal-paths + path: vcpkg + + - name: "Setup vcpkg" + shell: bash + run: ./vcpkg/bootstrap-vcpkg.sh + + - name: "Setup NuGet Credentials" + shell: "bash" + run: > + ${{ matrix.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1` + sources add + -source "${{ env.NUGET_REGISTRY }}" + -storepasswordincleartext + -name "GitHub" + -username "${{ env.NUGET_USERNAME }}" + -password "${{ secrets.NUGET_REGISTRY_PAT }}" + + - name: "Setup NuGet apikey" + shell: "bash" + run: > + ${{ matrix.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1` + setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ env.NUGET_REGISTRY }}" + + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + architecture: ${{ matrix.architecture }} + registry-url: 'https://registry.npmjs.org' + + - run: npm install + + - name: upload release assets + run: npm run postpublish + env: + NODE_PRE_GYP_GITHUB_TOKEN: ${{secrets.NUGET_REGISTRY_PAT}} diff --git a/.github/workflows/npm-test.yml b/.github/workflows/npm-test.yml new file mode 100644 index 0000000000..7b60480a3b --- /dev/null +++ b/.github/workflows/npm-test.yml @@ -0,0 +1,83 @@ +name: Node.js Test + +on: + push: + +env: + VCPKG_SHA: 5ef52b5b75887fb150711f5effb221dd98b99e6f + NUGET_REGISTRY: https://nuget.pkg.github.com/mathisloge/index.json + NUGET_USERNAME: mathisloge + VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite" + VCPKG_NUGET_REPOSITORY: https://github.com/mathisloge/vcpkg-nuget.git +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + #- os: windows-latest + # architecture: x64 + # node_version: 16 + + - os: ubuntu-latest + mono: mono + architecture: x64 + node_version: 16 + + #- os: macos-latest + # mono: mono + # architecture: x64 + # node_version: 16 + + steps: + - name: Install required system packages + shell: "bash" + run: | + sudo apt-get install -y gperf libxxf86vm-dev ninja-build make + - uses: ilammy/msvc-dev-cmd@v1 + + - uses: actions/checkout@v2 + + - name: checkout vcpkg + uses: actions/checkout@v2 + with: + repository: "mathisloge/vcpkg" + ref: test/mapnik-static + path: vcpkg + + - name: "Setup vcpkg" + shell: bash + run: ./vcpkg/bootstrap-vcpkg.sh + + - name: "Setup NuGet Credentials" + shell: "bash" + run: > + ${{ matrix.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1` + sources add + -source "${{ env.NUGET_REGISTRY }}" + -storepasswordincleartext + -name "GitHub" + -username "${{ env.NUGET_USERNAME }}" + -password "${{ secrets.NUGET_REGISTRY_PAT }}" + + - name: "Setup NuGet apikey" + shell: "bash" + run: > + ${{ matrix.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1` + setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ env.NUGET_REGISTRY }}" + + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + architecture: ${{ matrix.architecture }} + registry-url: 'https://registry.npmjs.org' + + - run: npm install --build-from-source + #- run: npm test + + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: vcpkg-logs + path: vcpkg/buildtrees/**/*.log + retention-days: 2 diff --git a/.gitignore b/.gitignore index a850f492e7..1943f6b341 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .DS_Store archive build +build-tmp* +build-cmake lib/binding lib/mapnik_settings.js node_modules @@ -27,3 +29,5 @@ mason-postgis-config.env local-postgres/ postgres.log local-unix-socket/ +package-lock.json +prebuilds/ diff --git a/.gitmodules b/.gitmodules index 7d03ead399..9754af81dd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "deps/wagyu"] - path = deps/wagyu - url = https://github.com/mapbox/wagyu.git [submodule "deps/geometry"] path = deps/geometry url = https://github.com/mapbox/geometry.hpp.git [submodule "deps/protozero"] path = deps/protozero url = https://github.com/mapbox/protozero.git +[submodule "deps/wagyu"] + path = deps/wagyu + url = https://github.com/mapbox/wagyu.git diff --git a/.npmignore b/.npmignore index 40a51b149f..b7b9d6a6ca 100644 --- a/.npmignore +++ b/.npmignore @@ -7,6 +7,7 @@ bench node_modules lib/binding build +build-tmp* test benchmark configure @@ -37,3 +38,5 @@ deps/protozero/test mason-postgis-config.env local.env postgres.log +vcpkg +.vscode diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..0f598f258b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.associations": { + "iosfwd": "cpp" + }, + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "cmake.configureOnEdit": false +} diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..9bfb0608da --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,143 @@ +cmake_minimum_required(VERSION 3.15) +set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake") +project(node-mapnik) + +set(MAPBOX_WAGYU_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/deps/wagyu/include" CACHE INTERNAL "wagyu include dir") +set(BUILD_TESTING OFF) +set(MAPNIK_VECTOR_TILE_ENABLE_INSTALL OFF) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +find_package(Threads REQUIRED) +find_package(PkgConfig) +pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo) +pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) +find_package(Protobuf REQUIRED) +find_package(mapnik CONFIG REQUIRED COMPONENTS shapeindex mapnik-index) + +include(FetchContent) +FetchContent_Declare( + napi_modules + GIT_REPOSITORY https://github.com/mathisloge/cmake-napi.git + GIT_TAG cdc5203c12f7e44ccb260b315256590d54b574af +) +FetchContent_Declare( + mapnik_vector_tile + GIT_REPOSITORY https://github.com/mathisloge/mapnik-vector-tile.git + GIT_TAG 4ad96069d5241a592d326ee0eca1ce89cf33372f + GIT_SUBMODULES "src" # https://gitlab.kitware.com/cmake/cmake/-/issues/20579 +) +FetchContent_MakeAvailable(mapnik_vector_tile napi_modules) +FetchContent_GetProperties(napi_modules SOURCE_DIR napi_src) +list(APPEND CMAKE_MODULE_PATH "${napi_src}/modules") +include(napi-gyp) + + +execute_process(COMMAND node -p "require('node-addon-api').include" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE NODE_ADDON_API_DIR +) +string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR}) +string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR}) + +add_subdirectory(deps) +mapnik_find_plugin_dir(MAPNIK_PLUGINS_DIR) +message(STATUS "Using plugins from ${MAPNIK_PLUGINS_DIR}") + +add_library(node-mapnik MODULE + src/mapnik_logger.cpp + src/node_mapnik.cpp + src/blend.cpp + src/mapnik_map.cpp + src/mapnik_map_load.cpp + src/mapnik_map_from_string.cpp + src/mapnik_map_render.cpp + src/mapnik_map_query_point.cpp + src/mapnik_color.cpp + src/mapnik_geometry.cpp + src/mapnik_feature.cpp + src/mapnik_image.cpp + src/mapnik_image_encode.cpp + src/mapnik_image_open.cpp + src/mapnik_image_fill.cpp + src/mapnik_image_save.cpp + src/mapnik_image_from_bytes.cpp + src/mapnik_image_from_svg.cpp + src/mapnik_image_solid.cpp + src/mapnik_image_multiply.cpp + src/mapnik_image_clear.cpp + src/mapnik_image_copy.cpp + src/mapnik_image_resize.cpp + src/mapnik_image_compositing.cpp + src/mapnik_image_filter.cpp + src/mapnik_image_view.cpp + src/mapnik_grid.cpp + src/mapnik_grid_view.cpp + src/mapnik_palette.cpp + src/mapnik_projection.cpp + src/mapnik_layer.cpp + src/mapnik_datasource.cpp + src/mapnik_featureset.cpp + src/mapnik_expression.cpp + src/mapnik_cairo_surface.cpp + src/mapnik_vector_tile.cpp + src/mapnik_vector_tile_data.cpp + src/mapnik_vector_tile_query.cpp + src/mapnik_vector_tile_json.cpp + src/mapnik_vector_tile_info.cpp + src/mapnik_vector_tile_simple_valid.cpp + src/mapnik_vector_tile_render.cpp + src/mapnik_vector_tile_clear.cpp + src/mapnik_vector_tile_image.cpp + src/mapnik_vector_tile_composite.cpp +) +set_target_properties(node-mapnik PROPERTIES PREFIX "" OUTPUT_NAME "mapnik" SUFFIX ".node") +target_include_directories(node-mapnik PRIVATE + ${NODE_ADDON_API_DIR} +) + +target_compile_definitions(node-mapnik PRIVATE + _USE_MATH_DEFINES + MAPNIK_GIT_REVISION=1 +) + +if(MSVC) + target_compile_definitions(node-mapnik PRIVATE /wd4068) +endif() + +target_link_libraries(node-mapnik + mapnik::core + mapnik::json + mapnik::wkt + mapnik::mapnik + mapbox-geometry + mapbox-wagyu + mapbox-protozero + node::napi + mapnik::mapnik-vector-tile +) + +# post build +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$_copy.cmake" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/post_build.cmake" +) + +# installation +macro(install_variable var) + install(CODE "set(${var} \"${${var}}\")") +endmacro() + +install(TARGETS node-mapnik + RUNTIME_DEPENDENCY_SET node-mapnik-deps + RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}" + LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}" +) +install_variable(MAPNIK_FONTS_DIR) +install_variable(MAPNIK_PLUGINS_DIR) +install_variable(VCPKG_INSTALLED_DIR) +install_variable(VCPKG_TARGET_TRIPLET) +install(CODE "set(SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\")") +install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/$_copy.cmake) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..b691bbf90e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM ghcr.io/mathisloge/mapnik:docker +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y nodejs npm git libprotobuf-dev protobuf-compiler && mkdir /nodemapnik + +WORKDIR /nodemapnik +COPY . . +RUN npm install && rm -rf build* +RUN npm run test diff --git a/binding.gyp b/binding.gyp index 3ab49ba92f..a86466e572 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,176 +1,27 @@ { - 'includes': [ 'common.gypi' ], - 'variables': { - 'ENABLE_GLIBC_WORKAROUND%':'false', # can be overriden by a command line variable because of the % sign - 'enable_sse%':'true' - }, - 'targets': [ - { - 'target_name': '<(module_name)', - 'product_dir': '<(module_path)', - 'sources': [ - "src/mapnik_logger.cpp", - "src/node_mapnik.cpp", - "src/blend.cpp", - "src/mapnik_map.cpp", - "src/mapnik_map_load.cpp", - "src/mapnik_map_from_string.cpp", - "src/mapnik_map_render.cpp", - "src/mapnik_map_query_point.cpp", - "src/mapnik_color.cpp", - "src/mapnik_geometry.cpp", - "src/mapnik_feature.cpp", - "src/mapnik_image.cpp", - "src/mapnik_image_encode.cpp", - "src/mapnik_image_open.cpp", - "src/mapnik_image_fill.cpp", - "src/mapnik_image_save.cpp", - "src/mapnik_image_from_bytes.cpp", - "src/mapnik_image_from_svg.cpp", - "src/mapnik_image_solid.cpp", - "src/mapnik_image_multiply.cpp", - "src/mapnik_image_clear.cpp", - "src/mapnik_image_copy.cpp", - "src/mapnik_image_resize.cpp", - "src/mapnik_image_compositing.cpp", - "src/mapnik_image_filter.cpp", - "src/mapnik_image_view.cpp", - "src/mapnik_grid.cpp", - "src/mapnik_grid_view.cpp", - "src/mapnik_palette.cpp", - "src/mapnik_projection.cpp", - "src/mapnik_layer.cpp", - "src/mapnik_datasource.cpp", - "src/mapnik_featureset.cpp", - "src/mapnik_expression.cpp", - "src/mapnik_cairo_surface.cpp", - "src/mapnik_vector_tile.cpp", - "src/mapnik_vector_tile_data.cpp", - "src/mapnik_vector_tile_query.cpp", - "src/mapnik_vector_tile_json.cpp", - "src/mapnik_vector_tile_info.cpp", - "src/mapnik_vector_tile_simple_valid.cpp", - "src/mapnik_vector_tile_render.cpp", - "src/mapnik_vector_tile_clear.cpp", - "src/mapnik_vector_tile_image.cpp", - "src/mapnik_vector_tile_composite.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_compression.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_datasource_pbf.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_featureset_pbf.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_geometry_decoder.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_geometry_encoder_pbf.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_layer.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_processor.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_raster_clipper.cpp", - "node_modules/mapnik-vector-tile/src/vector_tile_tile.cpp" - ], - 'include_dirs': [ - './mason_packages/.link/include/', - './mason_packages/.link/include/freetype2', - './mason_packages/.link/include/cairo', - './mason_packages/.link/include/mapnik', - './src', - " REQUIRED) +find_program(PATH_SHAPEINDEX shapeindex HINTS $ REQUIRED) + +file(COPY "${PATH_MAPNIK_INDEX}" DESTINATION "${MODULE_BIN_PATH}/") +file(COPY "${PATH_SHAPEINDEX}" DESTINATION "${MODULE_BIN_PATH}/") + +# write settings file +# determine relative paths to the settings file +file(RELATIVE_PATH MODULE_FONTS_DIR_REL "${MODULE_SETTINGS_PATH}" "${MODULE_FONTS_DIR}") +file(RELATIVE_PATH MODULE_PLUGINS_DIR_REL "${MODULE_SETTINGS_PATH}" "${MODULE_PLUGINS_DIR}") +file(RELATIVE_PATH MODULE_PROJ_PATH_REL "${MODULE_SETTINGS_PATH}" "${MODULE_PROJ_PATH}") + +# get mapnik-index and shapeindex name without extension +get_filename_component(MAPNIK_INDEX_NAME "${PATH_MAPNIK_INDEX}" NAME) +get_filename_component(SHAPEINDEX_NAME "${PATH_SHAPEINDEX}" NAME) +# determine relative paths to the settings file for mapnik-index and shapeindex +file(RELATIVE_PATH MODULE_MAPNIK_INDEX_REL "${MODULE_SETTINGS_PATH}" "${MODULE_BIN_PATH}/${MAPNIK_INDEX_NAME}") +file(RELATIVE_PATH MODULE_SHAPEINDEX_REL "${MODULE_SETTINGS_PATH}" "${MODULE_BIN_PATH}/${SHAPEINDEX_NAME}") + +# write settings file +if(WIN32) + set(PROJ_DB_PATH "'PROJ_LIB': path.join(__dirname, '${MODULE_PROJ_PATH_REL}')") +endif() +configure_file("${SOURCE_DIR}/mapnik_settings.js.in" "${MODULE_SETTINGS_PATH}/mapnik_settings.js") +# copy dlls on windows + +if(WIN32) + message(STATUS "Copy windows dependencies") + file(GET_RUNTIME_DEPENDENCIES + RESOLVED_DEPENDENCIES_VAR RESOLVED_DEPS + UNRESOLVED_DEPENDENCIES_VAR UNRESOLVED_DEPS + CONFLICTING_DEPENDENCIES_PREFIX CONFLICTING_DEPS + EXECUTABLES + "${MODULE_BIN_PATH}/${MAPNIK_INDEX_NAME}" + "${MODULE_BIN_PATH}/${SHAPEINDEX_NAME}" + MODULES + "${MODULE_FILE_PATH}" + "${MODULE_PLUGINS_DIR}/csv.input" + "${MODULE_PLUGINS_DIR}/gdal.input" + "${MODULE_PLUGINS_DIR}/geobuf.input" + "${MODULE_PLUGINS_DIR}/geojson.input" + "${MODULE_PLUGINS_DIR}/ogr.input" + "${MODULE_PLUGINS_DIR}/pgraster.input" + "${MODULE_PLUGINS_DIR}/postgis.input" + "${MODULE_PLUGINS_DIR}/raster.input" + "${MODULE_PLUGINS_DIR}/shape.input" + "${MODULE_PLUGINS_DIR}/sqlite.input" + "${MODULE_PLUGINS_DIR}/topojson.input" + DIRECTORIES + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/$<$:debug/>bin/" + PRE_EXCLUDE_REGEXES "api-ms-*" "ext-ms-*" + POST_EXCLUDE_REGEXES ".*system32[/\\].*\\.dll" + ) + file(COPY ${RESOLVED_DEPS} DESTINATION "${MODULE_PATH}") + message(STATUS "resolved: ${RESOLVED_DEPS}") + message(STATUS "conflicting: ${CONFLICTING_DEPS}") + foreach(dep ${UNRESOLVED_DEPS}) + message(WARNING "Runtime dependency ${dep} could not be resolved.") + endforeach() +else() + message(STATUS "Copy mapnik shared lib $") + file(COPY "$" DESTINATION "${MODULE_PATH}") +endif() diff --git a/common.gypi b/common.gypi deleted file mode 100644 index 8d7b555120..0000000000 --- a/common.gypi +++ /dev/null @@ -1,75 +0,0 @@ -{ - 'target_defaults': { - 'default_configuration': 'Release', - # the v140 refers to vs2015 - 'msbuild_toolset':'v140', - 'msvs_disabled_warnings': [ 4503, 4068,4244,4005,4506,4345,4804,4805,4661 ], - 'cflags_cc' : [ - '-std=c++14', - ], - 'cflags_cc!': ['-std=gnu++0x','-fno-rtti', '-fno-exceptions'], - 'configurations': { - 'Debug': { - 'defines!': [ - 'NDEBUG' - ], - 'cflags_cc!': [ - '-O3', - '-Os', - '-DNDEBUG', - ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS!': [ - '-O3', - '-Os', - '-DDEBUG' - ], - 'GCC_OPTIMIZATION_LEVEL': '0', - 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES' - }, - 'msvs_settings': { - 'VCCLCompilerTool': { - 'ExceptionHandling': 1, # /EHsc - 'RuntimeTypeInfo': 'true', # /GR - 'RuntimeLibrary': '2', # /MD - "AdditionalOptions": [ - "/MP", # compile across multiple CPUs - "/bigobj", #compiling: x86 fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj - ], - } - } - }, - 'Release': { - 'defines': [ - 'NDEBUG' - ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS!': [ - '-Os', - '-O2' - ], - 'GCC_OPTIMIZATION_LEVEL': '3', - 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO', - 'DEAD_CODE_STRIPPING': 'YES', - 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' - }, - 'msvs_settings': { - 'VCCLCompilerTool': { - 'ExceptionHandling': 1, # /EHsc - 'RuntimeTypeInfo': 'true', # /GR - 'RuntimeLibrary': '2', # /MD - "AdditionalOptions": [ - "/MP", # compile across multiple CPUs - "/bigobj", #compiling: x86 fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj - ], - "DebugInformationFormat": "3" - }, - "VCLinkerTool": { - "GenerateDebugInformation": "true", - "ProgramDatabaseFile": "$(OutDir)$(TargetName)$(TargetExt).pdb", - } - } - } - } - } -} diff --git a/demo.js b/demo.js new file mode 100644 index 0000000000..4c34890fd7 --- /dev/null +++ b/demo.js @@ -0,0 +1,23 @@ +var mapnik = require('./lib'); +var fs = require('fs'); + +// register fonts and datasource plugins +mapnik.register_default_fonts(); +mapnik.register_default_input_plugins(); + +var map = new mapnik.Map(256, 256); +map.load('./test/raster.xml', function(err,map) { + if (err) throw err; + map.zoomAll(); + var im = new mapnik.Image(256, 256); + map.render(im, function(err,im) { + if (err) throw err; + im.encode('png', function(err,buffer) { + if (err) throw err; + fs.writeFile('map.png',buffer, function(err) { + if (err) throw err; + console.log('saved map image to map.png'); + }); + }); + }); +}); diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt new file mode 100644 index 0000000000..8f80c45470 --- /dev/null +++ b/deps/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(mapbox-geometry INTERFACE) +target_include_directories(mapbox-geometry INTERFACE geometry/include) + +add_library(mapbox-wagyu INTERFACE) +target_include_directories(mapbox-wagyu INTERFACE wagyu/include) + +add_library(mapbox-protozero INTERFACE) +target_include_directories(mapbox-protozero INTERFACE protozero/include) diff --git a/deps/geometry b/deps/geometry index c83a2ab18a..12ac5412bf 160000 --- a/deps/geometry +++ b/deps/geometry @@ -1 +1 @@ -Subproject commit c83a2ab18a225254f128b6f5115aa39d04f2de21 +Subproject commit 12ac5412bf85571852ad1cd7c30456faef8d6464 diff --git a/deps/protozero b/deps/protozero index 7487f8109a..49acea746b 160000 --- a/deps/protozero +++ b/deps/protozero @@ -1 +1 @@ -Subproject commit 7487f8109acc8637b48e3cb291784cd58f943a1c +Subproject commit 49acea746bff44b4e627e85676c49fca94a7a20a diff --git a/deps/wagyu b/deps/wagyu index 9c87e553a5..2e003548fa 160000 --- a/deps/wagyu +++ b/deps/wagyu @@ -1 +1 @@ -Subproject commit 9c87e553a51170e4ce85fd2ef3160bc3434eb751 +Subproject commit 2e003548fa72f44e3e8c52c1a4754132fb1b780d diff --git a/lib/mapnik.js b/lib/mapnik.js index 50c4964172..785a5bb142 100644 --- a/lib/mapnik.js +++ b/lib/mapnik.js @@ -32,6 +32,8 @@ var binding = require(binding_path); var mapnik = module.exports = exports = binding; exports.module_path = path.dirname(binding_path); +// add dlls to search path... +process.env["PATH"] = exports.module_path + separator + settings.env["PATH"]; exports.settings = settings; diff --git a/mapnik_settings.js.in b/mapnik_settings.js.in new file mode 100644 index 0000000000..9adb461868 --- /dev/null +++ b/mapnik_settings.js.in @@ -0,0 +1,10 @@ +var path = require('path'); +module.exports.paths = { + 'fonts': path.join(__dirname, '@MODULE_FONTS_DIR_REL@'), + 'input_plugins': path.join(__dirname, '@MODULE_PLUGINS_DIR_REL@'), + 'mapnik_index': path.join(__dirname, '@MODULE_MAPNIK_INDEX_REL@'), + 'shape_index': path.join(__dirname, '@MODULE_SHAPEINDEX_REL@') +}; +module.exports.env = { + @PROJ_DB_PATH@ +}; diff --git a/package.json b/package.json index 117a151fb5..8ec03cf4aa 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,25 @@ { - "name": "mapnik", + "name": "@mathisloge/mapnik", + "repository": { + "type": "git", + "url": "git://github.com/mathisloge/node-mapnik.git" + }, "description": "Tile rendering library for node", "url": "http://github.com/mapnik/node-mapnik", "homepage": "http://mapnik.org", "author": "Dane Springmeyer (mapnik.org)", - "version": "4.5.9", + "version": "5.0.0-devbuild10", "mapnik_version": "e553f55dc", "main": "./lib/mapnik.js", "binary": { "module_name": "mapnik", - "module_path": "./lib/binding/", - "host": "https://mapbox-node-binary.s3.amazonaws.com", - "remote_path": "./{name}/v{version}/{configuration}/{toolset}/", - "package_name": "{platform}-{arch}.tar.gz" + "module_path": "./lib/binding/napi-v{napi_build_version}", + "remote_path": "v{version}", + "package_name": "{platform}-{arch}-napi-v{napi_build_version}.tar.gz", + "host": "https://github.com/mathisloge/node-mapnik/releases/download", + "napi_versions": [ + 3 + ] }, "bugs": { "email": "dane@mapbox.com", @@ -26,10 +33,6 @@ "mapnik", "carto" ], - "repository": { - "type": "git", - "url": "git://github.com/mapnik/node-mapnik.git" - }, "contributors": [ "Konstantin Käfer", "Blake Thompson" @@ -37,7 +40,6 @@ "license": "BSD-3-Clause", "dependencies": { "@mapbox/node-pre-gyp": "^1.x", - "mapnik-vector-tile": "3.0.1", "node-addon-api": "4.2.0" }, "bin": { @@ -49,10 +51,14 @@ "scripts": { "test": "tape test/*.test.js", "install": "node-pre-gyp install --fallback-to-build", - "docs": "documentation build src/*.cpp src/mapnik_plugins.hpp --polyglot -o documentation -f html --github --name Mapnik" + "docs": "documentation build src/*.cpp src/mapnik_plugins.hpp --polyglot -o documentation -f html --github --name Mapnik", + "package": "node-pre-gyp package", + "upload": "node-pre-gyp-github publish", + "postpublish": "npm run package && npm run upload" }, "devDependencies": { "@mapbox/sphericalmercator": "~1.0.2", + "@mathisloge/node-pre-gyp-github": "^1.0.8", "aws-sdk": "2.0.12", "bytes": "~2.1.0", "nyc": "^14.1.1", diff --git a/src/mapnik_image_from_bytes.cpp b/src/mapnik_image_from_bytes.cpp index 529dc0fc8e..378c169d88 100644 --- a/src/mapnik_image_from_bytes.cpp +++ b/src/mapnik_image_from_bytes.cpp @@ -4,7 +4,7 @@ #include // for get_image_reader, etc #include "mapnik_image.hpp" - +#include namespace detail { struct AsyncFromBytes : Napi::AsyncWorker diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp index f703709fa9..acb823353d 100644 --- a/src/mapnik_map.cpp +++ b/src/mapnik_map.cpp @@ -85,7 +85,7 @@ Napi::Object Map::Initialize(Napi::Env env, Napi::Object exports, napi_property_ * @param {int} width in pixels * @param {int} height in pixels * @param {string} [projection='+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'] projection as a proj4 code - * typically used with '+init=epsg:3857' + * typically used with 'epsg:3857' * @property {string} src * @property {number} width * @property {number} height @@ -97,7 +97,7 @@ Napi::Object Map::Initialize(Napi::Env env, Napi::Object exports, napi_property_ * @property {} parameters * @property {} aspect_fix_mode * @example - * var map = new mapnik.Map(600, 400, '+init=epsg:3857'); + * var map = new mapnik.Map(600, 400, 'epsg:3857'); * console.log(map); * // { * // aspect_fix_mode: 0, @@ -113,7 +113,7 @@ Napi::Object Map::Initialize(Napi::Env env, Napi::Object exports, napi_property_ * // bufferSize: 0, * // height: 400, * // width: 600, - * // srs: '+init=epsg:3857' + * // srs: 'epsg:3857' * // } */ diff --git a/src/mapnik_projection.cpp b/src/mapnik_projection.cpp index fd4b49b3ba..0ba7612e3b 100644 --- a/src/mapnik_projection.cpp +++ b/src/mapnik_projection.cpp @@ -36,7 +36,7 @@ Napi::Object Projection::Initialize(Napi::Env env, Napi::Object exports, napi_pr * @throws {Error} the projection could not be initialized - it was not found * in proj4's tables or the string was malformed * @example - * var wgs84 = new mapnik.Projection('+init=epsg:4326'); + * var wgs84 = new mapnik.Projection('epsg:4326'); */ Projection::Projection(Napi::CallbackInfo const& info) @@ -87,7 +87,7 @@ Projection::Projection(Napi::CallbackInfo const& info) * @param {Array} position as [x, y] or extent as [minx,miny,maxx,maxy] * @returns {Array} projected coordinates * @example - * var merc = new mapnik.Projection('+init=epsg:3857'); + * var merc = new mapnik.Projection('epsg:3857'); * var long_lat_coords = [-122.33517, 47.63752]; * var projected = merc.forward(long_lat_coords); */ @@ -315,7 +315,7 @@ Napi::Value ProjTransform::forward(Napi::CallbackInfo const& info) { std::ostringstream s; s << "Failed to forward project " - << x << "," << y << " from " << proj_transform_->source().params() << " to " << proj_transform_->dest().params(); + << x << "," << y << " " << proj_transform_->definition(); Napi::Error::New(env, s.str().c_str()).ThrowAsJavaScriptException(); return env.Undefined(); } @@ -334,7 +334,7 @@ Napi::Value ProjTransform::forward(Napi::CallbackInfo const& info) { std::ostringstream s; s << "Failed to forward project " - << box << " from " << proj_transform_->source().params() << " to " << proj_transform_->dest().params(); + << box << " " << proj_transform_->definition(); Napi::Error::New(env, s.str()).ThrowAsJavaScriptException(); return env.Undefined(); } @@ -385,7 +385,7 @@ Napi::Value ProjTransform::backward(Napi::CallbackInfo const& info) { std::ostringstream s; s << "Failed to back project " - << x << "," << y << " from " << proj_transform_->dest().params() << " to: " << proj_transform_->source().params(); + << x << "," << y << " " << proj_transform_->definition(); Napi::Error::New(env, s.str()).ThrowAsJavaScriptException(); return env.Null(); } @@ -404,7 +404,7 @@ Napi::Value ProjTransform::backward(Napi::CallbackInfo const& info) { std::ostringstream s; s << "Failed to back project " - << box << " from " << proj_transform_->source().params() << " to " << proj_transform_->dest().params(); + << box << " " << proj_transform_->definition(); Napi::Error::New(env, s.str()).ThrowAsJavaScriptException(); return env.Null(); } diff --git a/src/mapnik_vector_tile_composite.cpp b/src/mapnik_vector_tile_composite.cpp index 4072c22c10..72425be44d 100644 --- a/src/mapnik_vector_tile_composite.cpp +++ b/src/mapnik_vector_tile_composite.cpp @@ -23,7 +23,7 @@ void _composite(tile_type target_tile, std::launch threading_mode) { // create map - mapnik::Map map(target_tile->size(), target_tile->size(), "+init=epsg:3857"); + mapnik::Map map(target_tile->size(), target_tile->size(), "epsg:3857"); if (max_extent) { map.set_maximum_extent(*max_extent); @@ -575,7 +575,7 @@ Napi::Value VectorTile::composite(Napi::CallbackInfo const& info) std::string image_format = "webp"; mapnik::scaling_method_e scaling_method = mapnik::SCALING_BILINEAR; std::launch threading_mode = std::launch::deferred; - std::string merc_srs("+init=epsg:3857"); + std::string merc_srs("epsg:3857"); if (info.Length() > 2) { diff --git a/src/mapnik_vector_tile_image.cpp b/src/mapnik_vector_tile_image.cpp index 702cf7945e..4b2d65dee4 100644 --- a/src/mapnik_vector_tile_image.cpp +++ b/src/mapnik_vector_tile_image.cpp @@ -127,8 +127,8 @@ Napi::Value VectorTile::addImageSync(Napi::CallbackInfo const& info) try { // create map object - mapnik::Map map(tile_->size(), tile_->size(), "+init=epsg:3857"); - mapnik::layer lyr(layer_name, "+init=epsg:3857"); + mapnik::Map map(tile_->size(), tile_->size(), "epsg:3857"); + mapnik::layer lyr(layer_name, "epsg:3857"); lyr.set_datasource(ds); map.add_layer(lyr); @@ -178,8 +178,8 @@ struct AsyncAddImage : Napi::AsyncWorker ds->envelope(); // can be removed later, currently doesn't work with out this. ds->set_envelope(tile_->extent()); // create map object - mapnik::Map map(tile_->size(), tile_->size(), "+init=epsg:3857"); - mapnik::layer lyr(layer_name_, "+init=epsg:3857"); + mapnik::Map map(tile_->size(), tile_->size(), "epsg:3857"); + mapnik::layer lyr(layer_name_, "epsg:3857"); lyr.set_datasource(ds); map.add_layer(lyr); diff --git a/src/mapnik_vector_tile_json.cpp b/src/mapnik_vector_tile_json.cpp index 9cbc2a14f5..729646d3da 100644 --- a/src/mapnik_vector_tile_json.cpp +++ b/src/mapnik_vector_tile_json.cpp @@ -319,8 +319,8 @@ bool layer_to_geojson(protozero::pbf_reader const& layer, unsigned z) { mapnik::vector_tile_impl::tile_datasource_pbf ds(layer, x, y, z); - mapnik::projection wgs84("+init=epsg:4326", true); - mapnik::projection merc("+init=epsg:3857", true); + mapnik::projection wgs84("epsg:4326", true); + mapnik::projection merc("epsg:3857", true); mapnik::proj_transform prj_trans(merc, wgs84); // This mega box ensures we capture all features, including those // outside the tile extent. Geometries outside the tile extent are @@ -1095,11 +1095,11 @@ Napi::Value VectorTile::addGeoJSON(Napi::CallbackInfo const& info) { // create map object auto tile_size = tile_->tile_size(); - mapnik::Map map(tile_size, tile_size, "+init=epsg:3857"); + mapnik::Map map(tile_size, tile_size, "epsg:3857"); mapnik::parameters p; p["type"] = "geojson"; p["inline"] = geojson_string; - mapnik::layer lyr(geojson_name, "+init=epsg:4326"); + mapnik::layer lyr(geojson_name, "epsg:4326"); lyr.set_datasource(mapnik::datasource_cache::instance().create(p)); map.add_layer(lyr); diff --git a/src/mapnik_vector_tile_query.cpp b/src/mapnik_vector_tile_query.cpp index 340277e9cc..7d3c12e7ca 100644 --- a/src/mapnik_vector_tile_query.cpp +++ b/src/mapnik_vector_tile_query.cpp @@ -175,8 +175,8 @@ std::vector _query(mapnik::vector_tile_impl::merc_tile_ptr const& return arr; } - mapnik::projection wgs84("+init=epsg:4326", true); - mapnik::projection merc("+init=epsg:3857", true); + mapnik::projection wgs84("epsg:4326", true); + mapnik::projection merc("epsg:3857", true); mapnik::proj_transform tr(wgs84, merc); double x = lon; double y = lat; @@ -385,8 +385,8 @@ void _queryMany(queryMany_result& result, // Reproject query => mercator points mapnik::box2d bbox; - mapnik::projection wgs84("+init=epsg:4326", true); - mapnik::projection merc("+init=epsg:3857", true); + mapnik::projection wgs84("epsg:4326", true); + mapnik::projection merc("epsg:3857", true); mapnik::proj_transform tr(wgs84, merc); std::vector points; points.reserve(query.size()); diff --git a/src/mapnik_vector_tile_simple_valid.cpp b/src/mapnik_vector_tile_simple_valid.cpp index 687dfaabde..be5e95f37f 100644 --- a/src/mapnik_vector_tile_simple_valid.cpp +++ b/src/mapnik_vector_tile_simple_valid.cpp @@ -371,8 +371,8 @@ void layer_not_valid(protozero::pbf_reader& layer_msg, { if (lat_lon) { - mapnik::projection wgs84("+init=epsg:4326", true); - mapnik::projection merc("+init=epsg:3857", true); + mapnik::projection wgs84("epsg:4326", true); + mapnik::projection merc("epsg:3857", true); mapnik::proj_transform prj_trans(merc, wgs84); unsigned int n_err = 0; mapnik::util::apply_visitor( diff --git a/src/node_mapnik.cpp b/src/node_mapnik.cpp index 16647a0044..f4bd4cfcb5 100644 --- a/src/node_mapnik.cpp +++ b/src/node_mapnik.cpp @@ -443,7 +443,7 @@ Napi::Object init(Napi::Env env, Napi::Object exports) supports.Set("webp", Napi::Boolean::New(env, false)); #endif -#if defined(MAPNIK_USE_PROJ4) +#if defined(MAPNIK_USE_PROJ) supports.Set("proj4", Napi::Boolean::New(env, true)); #else supports.Set("proj4", Napi::Boolean::New(env, false)); diff --git a/test/data/large_overzoom.xml b/test/data/large_overzoom.xml index d8c249a5a6..6012fcfa45 100644 --- a/test/data/large_overzoom.xml +++ b/test/data/large_overzoom.xml @@ -1,5 +1,5 @@ - + -180,-85.0511,180,85.0511 0,0,3 @@ -30,11 +30,11 @@ - + _image _image-raster - + _image diff --git a/test/data/map.xml b/test/data/map.xml index 97db0858b0..c4f9aedce3 100644 --- a/test/data/map.xml +++ b/test/data/map.xml @@ -1,5 +1,5 @@ - + - + world ./world_merc.shp diff --git a/test/data/markers.xml b/test/data/markers.xml index b707909ec5..f63ddfd2f0 100644 --- a/test/data/markers.xml +++ b/test/data/markers.xml @@ -1,5 +1,5 @@ - + - + style label diff --git a/test/data/postgis_datasource_tokens_query.xml b/test/data/postgis_datasource_tokens_query.xml index b877e217ee..fc896cd619 100644 --- a/test/data/postgis_datasource_tokens_query.xml +++ b/test/data/postgis_datasource_tokens_query.xml @@ -1,6 +1,6 @@ - - + + postgis localhost diff --git a/test/data/roads.xml b/test/data/roads.xml index 40afc1c5d8..890e2736d0 100644 --- a/test/data/roads.xml +++ b/test/data/roads.xml @@ -1,7 +1,7 @@ @@ -79,7 +79,7 @@ + srs="epsg:3857"> casing bridge fill @@ -95,4 +95,4 @@ - \ No newline at end of file + diff --git a/test/data/sat_map.xml b/test/data/sat_map.xml index dcbdc5573c..bdec629f48 100644 --- a/test/data/sat_map.xml +++ b/test/data/sat_map.xml @@ -1,10 +1,10 @@ - + - + style ./images/sat_image.png diff --git "a/test/data/u\314\210nicode_symbols.xml" "b/test/data/u\314\210nicode_symbols.xml" index f10d2f12aa..0f512d25f2 100644 --- "a/test/data/u\314\210nicode_symbols.xml" +++ "b/test/data/u\314\210nicode_symbols.xml" @@ -1,5 +1,5 @@ - + - + style csv @@ -30,7 +30,7 @@ x,y - + frame csv diff --git a/test/data/vector_tile/compositing/badtile.xml b/test/data/vector_tile/compositing/badtile.xml index ed2bb15d94..f69e4c40fc 100644 --- a/test/data/vector_tile/compositing/badtile.xml +++ b/test/data/vector_tile/compositing/badtile.xml @@ -1,5 +1,5 @@ - + -180,-85.0511,180,85.0511 0,0,3 @@ -79,19 +79,19 @@ - + landcover landcover-raster - + hillshade hillshade-raster - + contour contour-raster - + _image diff --git a/test/data/vector_tile/compositing/layers/lines.xml b/test/data/vector_tile/compositing/layers/lines.xml index 5380899ce9..3b2fac73ca 100755 --- a/test/data/vector_tile/compositing/layers/lines.xml +++ b/test/data/vector_tile/compositing/layers/lines.xml @@ -1,4 +1,4 @@ - + - + lines csv @@ -17,5 +17,5 @@ wkt - - \ No newline at end of file + + diff --git a/test/data/vector_tile/compositing/layers/points.xml b/test/data/vector_tile/compositing/layers/points.xml index 716afd6ac6..ed19dc2274 100755 --- a/test/data/vector_tile/compositing/layers/points.xml +++ b/test/data/vector_tile/compositing/layers/points.xml @@ -1,4 +1,4 @@ - + - + points csv @@ -15,5 +15,5 @@ x,y 0,0 - - \ No newline at end of file + + diff --git a/test/data/vector_tile/compositing/styles/all.xml b/test/data/vector_tile/compositing/styles/all.xml index d75b8a8740..0433e57f06 100755 --- a/test/data/vector_tile/compositing/styles/all.xml +++ b/test/data/vector_tile/compositing/styles/all.xml @@ -1,15 +1,15 @@ - + - + raster - + raster @@ -23,31 +23,31 @@ - + lines - + lines - + lines - + lines - + lines - + lines - + lines - + lines - + lines @@ -57,32 +57,32 @@ - + points - + points - + points - + points - + points - + points - + points - + points - + points - + diff --git a/test/data/vector_tile/generic_map.xml b/test/data/vector_tile/generic_map.xml index fa047819d4..800bbae621 100644 --- a/test/data/vector_tile/generic_map.xml +++ b/test/data/vector_tile/generic_map.xml @@ -15,6 +15,6 @@ - + %s diff --git a/test/data/vector_tile/layers.xml b/test/data/vector_tile/layers.xml index aed11c6aec..d67d5e5013 100644 --- a/test/data/vector_tile/layers.xml +++ b/test/data/vector_tile/layers.xml @@ -1,7 +1,7 @@ - + - + style ../../data/world_merc.shp @@ -10,7 +10,7 @@ - + style ../../data/world_merc.shp diff --git a/test/data/vector_tile/pasted/pasted1.xml b/test/data/vector_tile/pasted/pasted1.xml index 05912f2d57..5cc6c4a4f6 100644 --- a/test/data/vector_tile/pasted/pasted1.xml +++ b/test/data/vector_tile/pasted/pasted1.xml @@ -1,5 +1,5 @@ - + - + style pasted1.shp diff --git a/test/data/vector_tile/pasted/pasted10.xml b/test/data/vector_tile/pasted/pasted10.xml index 3045b587ca..1afc0c1576 100644 --- a/test/data/vector_tile/pasted/pasted10.xml +++ b/test/data/vector_tile/pasted/pasted10.xml @@ -1,5 +1,5 @@ - + - + style pasted10.shp diff --git a/test/data/vector_tile/pasted/pasted11.xml b/test/data/vector_tile/pasted/pasted11.xml index 59955b3de7..c63c8361ec 100644 --- a/test/data/vector_tile/pasted/pasted11.xml +++ b/test/data/vector_tile/pasted/pasted11.xml @@ -1,5 +1,5 @@ - + - + style pasted11.shp diff --git a/test/data/vector_tile/pasted/pasted12.xml b/test/data/vector_tile/pasted/pasted12.xml index f64dbf2c29..665549681a 100644 --- a/test/data/vector_tile/pasted/pasted12.xml +++ b/test/data/vector_tile/pasted/pasted12.xml @@ -1,5 +1,5 @@ - + - + style pasted12.geojson diff --git a/test/data/vector_tile/pasted/pasted13.xml b/test/data/vector_tile/pasted/pasted13.xml index 11ade49e37..76a1926dc2 100644 --- a/test/data/vector_tile/pasted/pasted13.xml +++ b/test/data/vector_tile/pasted/pasted13.xml @@ -1,5 +1,5 @@ - + - + style pasted13.geojson diff --git a/test/data/vector_tile/pasted/pasted14.xml b/test/data/vector_tile/pasted/pasted14.xml index a76cedf360..15ff1d0dc2 100644 --- a/test/data/vector_tile/pasted/pasted14.xml +++ b/test/data/vector_tile/pasted/pasted14.xml @@ -1,5 +1,5 @@ - + - + style pasted14.geojson diff --git a/test/data/vector_tile/pasted/pasted15.xml b/test/data/vector_tile/pasted/pasted15.xml index 99fbb2a7b6..d44cf2a904 100644 --- a/test/data/vector_tile/pasted/pasted15.xml +++ b/test/data/vector_tile/pasted/pasted15.xml @@ -1,5 +1,5 @@ - + - + style pasted15.shp diff --git a/test/data/vector_tile/pasted/pasted16.xml b/test/data/vector_tile/pasted/pasted16.xml index ef2f801b16..fa069b7d01 100644 --- a/test/data/vector_tile/pasted/pasted16.xml +++ b/test/data/vector_tile/pasted/pasted16.xml @@ -1,5 +1,5 @@ - + - + style pasted16.shp diff --git a/test/data/vector_tile/pasted/pasted17.xml b/test/data/vector_tile/pasted/pasted17.xml index b516970ebd..3e6a776962 100644 --- a/test/data/vector_tile/pasted/pasted17.xml +++ b/test/data/vector_tile/pasted/pasted17.xml @@ -1,5 +1,5 @@ - + - + style pasted17.geojson diff --git a/test/data/vector_tile/pasted/pasted18.xml b/test/data/vector_tile/pasted/pasted18.xml index 3a8c9e13ff..be9bb15868 100644 --- a/test/data/vector_tile/pasted/pasted18.xml +++ b/test/data/vector_tile/pasted/pasted18.xml @@ -1,5 +1,5 @@ - + - + style pasted18.shp diff --git a/test/data/vector_tile/pasted/pasted19.xml b/test/data/vector_tile/pasted/pasted19.xml index bdb7df6b72..daba1b6233 100644 --- a/test/data/vector_tile/pasted/pasted19.xml +++ b/test/data/vector_tile/pasted/pasted19.xml @@ -1,5 +1,5 @@ - + - + style pasted19.shp diff --git a/test/data/vector_tile/pasted/pasted2.xml b/test/data/vector_tile/pasted/pasted2.xml index a56217c04a..86fb9a7a9f 100644 --- a/test/data/vector_tile/pasted/pasted2.xml +++ b/test/data/vector_tile/pasted/pasted2.xml @@ -1,5 +1,5 @@ - + - + style pasted2.shp diff --git a/test/data/vector_tile/pasted/pasted20.xml b/test/data/vector_tile/pasted/pasted20.xml index f8812b6119..b4d7ddb75b 100644 --- a/test/data/vector_tile/pasted/pasted20.xml +++ b/test/data/vector_tile/pasted/pasted20.xml @@ -1,5 +1,5 @@ - + - + style pasted20.shp diff --git a/test/data/vector_tile/pasted/pasted21.xml b/test/data/vector_tile/pasted/pasted21.xml index 0b9a2c56a2..d4db0ee2a4 100644 --- a/test/data/vector_tile/pasted/pasted21.xml +++ b/test/data/vector_tile/pasted/pasted21.xml @@ -1,5 +1,5 @@ - + - + style pasted21.shp diff --git a/test/data/vector_tile/pasted/pasted22.xml b/test/data/vector_tile/pasted/pasted22.xml index 035a3ada48..cb695cdc89 100644 --- a/test/data/vector_tile/pasted/pasted22.xml +++ b/test/data/vector_tile/pasted/pasted22.xml @@ -1,5 +1,5 @@ - + - + style pasted22.shp diff --git a/test/data/vector_tile/pasted/pasted23.xml b/test/data/vector_tile/pasted/pasted23.xml index 9033418083..5d7fd773c5 100644 --- a/test/data/vector_tile/pasted/pasted23.xml +++ b/test/data/vector_tile/pasted/pasted23.xml @@ -1,5 +1,5 @@ - + - + style pasted23.shp diff --git a/test/data/vector_tile/pasted/pasted3.xml b/test/data/vector_tile/pasted/pasted3.xml index 59ac72c363..65c0df827c 100644 --- a/test/data/vector_tile/pasted/pasted3.xml +++ b/test/data/vector_tile/pasted/pasted3.xml @@ -1,5 +1,5 @@ - + - + style pasted3.shp diff --git a/test/data/vector_tile/pasted/pasted4.xml b/test/data/vector_tile/pasted/pasted4.xml index 85cba7eef6..73e3a47c10 100644 --- a/test/data/vector_tile/pasted/pasted4.xml +++ b/test/data/vector_tile/pasted/pasted4.xml @@ -1,5 +1,5 @@ - + - + style pasted4.shp diff --git a/test/data/vector_tile/pasted/pasted5.xml b/test/data/vector_tile/pasted/pasted5.xml index f7cfae4328..a1fdf04ea2 100644 --- a/test/data/vector_tile/pasted/pasted5.xml +++ b/test/data/vector_tile/pasted/pasted5.xml @@ -1,5 +1,5 @@ - + - + style pasted5.shp diff --git a/test/data/vector_tile/pasted/pasted6.xml b/test/data/vector_tile/pasted/pasted6.xml index f5c2a36451..befabe2ea4 100644 --- a/test/data/vector_tile/pasted/pasted6.xml +++ b/test/data/vector_tile/pasted/pasted6.xml @@ -1,5 +1,5 @@ - + - + style pasted6.shp diff --git a/test/data/vector_tile/pasted/pasted7.xml b/test/data/vector_tile/pasted/pasted7.xml index d2d7e140dd..1527e6ad7d 100644 --- a/test/data/vector_tile/pasted/pasted7.xml +++ b/test/data/vector_tile/pasted/pasted7.xml @@ -1,5 +1,5 @@ - + - + style pasted7.shp diff --git a/test/data/vector_tile/pasted/pasted8.xml b/test/data/vector_tile/pasted/pasted8.xml index dd0789b654..651dadbea5 100644 --- a/test/data/vector_tile/pasted/pasted8.xml +++ b/test/data/vector_tile/pasted/pasted8.xml @@ -1,5 +1,5 @@ - + - + style pasted8.shp diff --git a/test/data/vector_tile/raster_layer.xml b/test/data/vector_tile/raster_layer.xml index 4d86b742d0..a1eb94c921 100644 --- a/test/data/vector_tile/raster_layer.xml +++ b/test/data/vector_tile/raster_layer.xml @@ -1,10 +1,10 @@ - + - + style ./natural_earth.tif @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/test/data/vector_tile/raster_style.xml b/test/data/vector_tile/raster_style.xml index b8168e99c9..e9b4c43e7e 100644 --- a/test/data/vector_tile/raster_style.xml +++ b/test/data/vector_tile/raster_style.xml @@ -1,4 +1,4 @@ - + - + style style2 - \ No newline at end of file + diff --git "a/test/data/\303\274nicode_symbols.xml" "b/test/data/\303\274nicode_symbols.xml" index f10d2f12aa..0f512d25f2 100644 --- "a/test/data/\303\274nicode_symbols.xml" +++ "b/test/data/\303\274nicode_symbols.xml" @@ -1,5 +1,5 @@ - + - + style csv @@ -30,7 +30,7 @@ x,y - + frame csv diff --git a/test/datasource.test.js b/test/datasource.test.js index 50f4c948f1..6e373bea65 100644 --- a/test/datasource.test.js +++ b/test/datasource.test.js @@ -233,7 +233,7 @@ test('should validate with raster', (assert) => { assert.deepEqual(expected,describe); // Test that if added to layer, can get datasource back - var layer = new mapnik.Layer('foo', '+init=epsg:4326'); + var layer = new mapnik.Layer('foo', 'epsg:4326'); layer.datasource = ds; var ds2 = layer.datasource; assert.ok(ds2); diff --git a/test/feature.test.js b/test/feature.test.js index 656d809d0e..a5a142c5ad 100644 --- a/test/feature.test.js +++ b/test/feature.test.js @@ -184,8 +184,8 @@ test('should be able to create feature from geojson and turn back into geojson', assert.deepEqual(geom.extent(),[ 1, 1, 2, 2 ]); var expected_geom = JSON.stringify(expected.geometry); assert.equal(expected_geom,geom.toJSON()); - var source_proj = new mapnik.Projection('+init=epsg:4326'); - var dest_proj = new mapnik.Projection('+init=epsg:3857'); + var source_proj = new mapnik.Projection('epsg:4326'); + var dest_proj = new mapnik.Projection('epsg:3857'); var trans = new mapnik.ProjTransform(source_proj,dest_proj); var transformed = geom.toJSON({transform:trans}); assert.notEqual(expected_geom,transformed); @@ -264,8 +264,8 @@ test('should be able to reproject geojson feature', (assert) => { assert.ok(Math.abs(ext[0] - expected_ext[0]) < 0.001); var input_geom = JSON.stringify(input.geometry); assert.equal(input_geom,geom.toJSON()); - var dest_proj = new mapnik.Projection('+init=epsg:4326'); - var source_proj = new mapnik.Projection('+init=epsg:3857'); + var dest_proj = new mapnik.Projection('epsg:4326'); + var source_proj = new mapnik.Projection('epsg:3857'); var trans = new mapnik.ProjTransform(source_proj,dest_proj); var expected_transformed = { "type": "MultiPolygon", diff --git a/test/layers.test.js b/test/layers.test.js index dd8bcbaf8d..95890c04ce 100644 --- a/test/layers.test.js +++ b/test/layers.test.js @@ -18,7 +18,7 @@ test('should throw with invalid usage', (assert) => { test('should initialize properly', (assert) => { mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'shape.input')); - var layer = new mapnik.Layer('foo', '+init=epsg:4326'); + var layer = new mapnik.Layer('foo', 'epsg:4326'); assert.equal(layer.name, 'foo'); layer.active = true; assert.equal(layer.active, true); @@ -40,7 +40,7 @@ test('should initialize properly', (assert) => { assert.throws(function() { layer.maximum_scale_denominator = null; }); assert.throws(function() { layer.queryable = null; }); assert.throws(function() { layer.clear_label_cache = null; }); - assert.equal(layer.srs, '+init=epsg:4326'); + assert.equal(layer.srs, 'epsg:4326'); assert.deepEqual(layer.styles, []); // will be empty/undefined assert.ok(!layer.datasource); @@ -61,7 +61,7 @@ test('should initialize properly', (assert) => { assert.equal(meta.queryable, false); assert.equal(meta.clear_label_cache, false); assert.equal(meta.name, 'foo'); - assert.equal(meta.srs, '+init=epsg:4326'); + assert.equal(meta.srs, 'epsg:4326'); assert.deepEqual(meta.styles, []); assert.deepEqual(meta.datasource, options); assert.end(); diff --git a/test/map.test.js b/test/map.test.js index 57873dc463..dd5ca5c3cf 100644 --- a/test/map.test.js +++ b/test/map.test.js @@ -33,9 +33,9 @@ test('should be initialized properly', (assert) => { test('should be initialized properly with projection', (assert) => { // TODO - more tests - var map = new mapnik.Map(25,25,'+init=epsg:3857'); + var map = new mapnik.Map(25,25,'epsg:3857'); assert.ok(map instanceof mapnik.Map); - assert.equal(map.srs, '+init=epsg:3857'); + assert.equal(map.srs, 'epsg:3857'); assert.end(); }); @@ -100,10 +100,10 @@ test('should have settable properties', (assert) => { assert.deepEqual(map.extent,world); } - assert.equal(map.srs, "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); + assert.equal(map.srs, "epsg:4326"); assert.throws(function() { map.srs = 100; }); - map.srs = '+init=epsg:3857'; - assert.equal(map.srs, '+init=epsg:3857'); + map.srs = 'epsg:3857'; + assert.equal(map.srs, 'epsg:3857'); // Test Parameters assert.throws(function() { map.parameters = null; }); @@ -128,7 +128,7 @@ test('should fail to load a stylesheet async', (assert) => { var map = new mapnik.Map(600, 400); assert.equal(map.width, 600); assert.equal(map.height, 400); - assert.equal(map.srs, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'); + assert.equal(map.srs, 'epsg:4326'); assert.equal(map.bufferSize, 0); assert.equal(map.maximumExtent, undefined); map.load('./test/stylesheet.xml', {base: '/DOESNOTEXIST' }, function(err, result_map) { @@ -143,7 +143,7 @@ test('should load a stylesheet async', (assert) => { assert.equal(map.width, 600); assert.equal(map.height, 400); - assert.equal(map.srs, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'); + assert.equal(map.srs, 'epsg:4326'); assert.equal(map.bufferSize, 0); assert.equal(map.maximumExtent, undefined); @@ -167,7 +167,7 @@ test('should load a stylesheet async', (assert) => { var layers = result_map.layers(); assert.equal(layers.length, 1); assert.equal(layers[0].name, 'world'); - assert.equal(layers[0].srs, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'); + assert.equal(layers[0].srs, 'epsg:3857'); assert.deepEqual(layers[0].styles, ['style']); assert.equal(layers[0].datasource.type, 'vector'); assert.equal(layers[0].datasource.parameters().type, 'shape'); @@ -187,7 +187,7 @@ test('should load a stylesheet sync', (assert) => { assert.equal(map.width, 600); assert.equal(map.height, 400); - assert.equal(map.srs, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'); + assert.equal(map.srs, 'epsg:4326'); assert.equal(map.bufferSize, 0); assert.equal(map.maximumExtent, undefined); @@ -212,7 +212,7 @@ test('should load a stylesheet sync', (assert) => { var layers = map.layers(); assert.equal(layers.length, 1); assert.equal(layers[0].name, 'world'); - assert.equal(layers[0].srs, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'); + assert.equal(layers[0].srs, 'epsg:3857'); assert.deepEqual(layers[0].styles, ['style']); assert.equal(layers[0].datasource.type, 'vector'); assert.equal(layers[0].datasource.parameters().type, 'shape'); @@ -358,7 +358,7 @@ test('should allow access to layers', (assert) => { var layers = map.layers(); assert.equal(layers.length, 1); assert.equal(layers[0].name, 'world'); - assert.equal(layers[0].srs, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'); + assert.equal(layers[0].srs, 'epsg:3857'); assert.deepEqual(layers[0].styles, ['style']); assert.equal(layers[0].datasource.type, 'vector'); assert.equal(layers[0].datasource.parameters().type, 'shape'); @@ -388,7 +388,7 @@ test('should allow access to layers', (assert) => { // make a change to layer, ensure it sticks layer.name = 'a'; layer.styles = ['a']; - layer.srs = '+init=epsg:4326'; + layer.srs = 'epsg:4326'; layer.datasource = new mapnik.Datasource(options); // Assert that add layer throws for bad layers diff --git a/test/parameters.test.js b/test/parameters.test.js index c3a5afedf1..4cff79b1a5 100644 --- a/test/parameters.test.js +++ b/test/parameters.test.js @@ -29,14 +29,14 @@ test('should be accessible from map', (assert) => { test('should be settable on map', (assert) => { var map = new mapnik.Map(1, 1); var actual = cleanXml(map.toXML()); - var expected = cleanXml('\n\n'); + var expected = cleanXml('\n\n'); assert.equal(actual, expected); map.parameters = {'a': 'b','bool':false, 'num': 12.2, 'num2': 1}; actual = cleanXml(map.toXML()); if (mapnik.versions.mapnik_number >= 300000) { - expected = cleanXml('\n\n \n b\n false\n 12.2\n 1\n\n\n'); + expected = cleanXml('\n\n \n b\n false\n 12.2\n 1\n\n\n'); } else { - expected = cleanXml('\n\n \n b\n \n\n'); + expected = cleanXml('\n\n \n b\n \n\n'); } assert.equal(actual, expected); assert.end(); diff --git a/test/proj_transform.test.js b/test/proj_transform.test.js index 492b3fe5e2..a19487b936 100644 --- a/test/proj_transform.test.js +++ b/test/proj_transform.test.js @@ -4,13 +4,13 @@ var test = require('tape'); var mapnik = require('../'); test('should throw with invalid usage', (assert) => { - assert.throws(function() { new mapnik.ProjTransform('+init=epsg:foo'); }); + assert.throws(function() { new mapnik.ProjTransform('epsg:foo'); }); assert.throws(function() { new mapnik.ProjTransform('+proj +foo'); }); assert.throws(function() { new mapnik.ProjTransform(1,1); }); assert.throws(function() { new mapnik.ProjTransform({},{}); }); assert.end(); }); - +/* test('should not initialize properly', (assert) => { var wgs84 = new mapnik.Projection('+proj=totalmadeup', {lazy:true}); var wgs84_2 = new mapnik.Projection('+proj=abcdefg', {lazy:true}); @@ -19,10 +19,10 @@ test('should not initialize properly', (assert) => { assert.throws(function() { new mapnik.ProjTransform(wgs84,wgs84_2); }); assert.end(); }); - +*/ test('should initialize properly', (assert) => { - var wgs84 = new mapnik.Projection('+init=epsg:4326'); - var wgs84_2 = new mapnik.Projection('+init=epsg:4326'); + var wgs84 = new mapnik.Projection('epsg:4326'); + var wgs84_2 = new mapnik.Projection('epsg:4326'); var trans = new mapnik.ProjTransform(wgs84,wgs84_2); assert.ok(trans); assert.equal(trans instanceof mapnik.ProjTransform, true); @@ -30,8 +30,8 @@ test('should initialize properly', (assert) => { }); test('should forward coords properly (no-op)', (assert) => { - var wgs84 = new mapnik.Projection('+init=epsg:4326'); - var wgs84_2 = new mapnik.Projection('+init=epsg:4326'); + var wgs84 = new mapnik.Projection('epsg:4326'); + var wgs84_2 = new mapnik.Projection('epsg:4326'); var trans = new mapnik.ProjTransform(wgs84,wgs84_2); var long_lat_coords = [-122.33517, 47.63752]; assert.deepEqual(long_lat_coords,trans.forward(long_lat_coords)); @@ -39,8 +39,8 @@ test('should forward coords properly (no-op)', (assert) => { }); test('should forward coords properly (no-op)', (assert) => { - var wgs84 = new mapnik.Projection('+init=epsg:4326'); - var wgs84_2 = new mapnik.Projection('+init=epsg:4326'); + var wgs84 = new mapnik.Projection('epsg:4326'); + var wgs84_2 = new mapnik.Projection('epsg:4326'); var trans = new mapnik.ProjTransform(wgs84,wgs84_2); var long_lat_box = [-122.33517, 47.63752,-122.33517, 47.63752]; assert.deepEqual(long_lat_box,trans.forward(long_lat_box)); @@ -48,8 +48,8 @@ test('should forward coords properly (no-op)', (assert) => { }); test('should forward coords properly (4326 -> 3857)', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326'); - var to = new mapnik.Projection('+init=epsg:3857'); + var from = new mapnik.Projection('epsg:4326'); + var to = new mapnik.Projection('epsg:3857'); var trans = new mapnik.ProjTransform(from,to); var long_lat_coords = [-122.33517, 47.63752]; var merc = [-13618288.8305, 6046761.54747]; @@ -58,8 +58,8 @@ test('should forward coords properly (4326 -> 3857)', (assert) => { }); test('should forward coords properly (4326 -> 3857) - no init proj4', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326', {lazy:true}); - var to = new mapnik.Projection('+init=epsg:3857', {lazy:true}); + var from = new mapnik.Projection('epsg:4326', {lazy:true}); + var to = new mapnik.Projection('epsg:3857', {lazy:true}); var trans = new mapnik.ProjTransform(from,to); var long_lat_coords = [-122.33517, 47.63752]; var merc = [-13618288.8305, 6046761.54747]; @@ -68,8 +68,8 @@ test('should forward coords properly (4326 -> 3857) - no init proj4', (assert) = }); test('should backward coords properly (3857 -> 4326)', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326'); - var to = new mapnik.Projection('+init=epsg:3857'); + var from = new mapnik.Projection('epsg:4326'); + var to = new mapnik.Projection('epsg:3857'); var trans = new mapnik.ProjTransform(from,to); var long_lat_coords = [-122.33517, 47.63752]; var merc = [-13618288.8305, 6046761.54747]; @@ -78,8 +78,8 @@ test('should backward coords properly (3857 -> 4326)', (assert) => { }); test('should throw with invalid coords (4326 -> 3873)', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326'); - var to = new mapnik.Projection('+init=epsg:3873'); + var from = new mapnik.Projection('epsg:4326'); + var to = new mapnik.Projection('epsg:3873'); var trans = new mapnik.ProjTransform(from,to); var long_lat_coords = [-190, 95]; assert.throws(function() { trans.forward(); }); @@ -90,8 +90,8 @@ test('should throw with invalid coords (4326 -> 3873)', (assert) => { }); test('should throw with invalid coords (3873 -> 4326) backward', (assert) => { - var from = new mapnik.Projection('+init=epsg:3873'); - var to = new mapnik.Projection('+init=epsg:4326'); + var from = new mapnik.Projection('epsg:3873'); + var to = new mapnik.Projection('epsg:4326'); var trans = new mapnik.ProjTransform(from,to); var long_lat_coords = [-190, 95]; assert.throws(function() { trans.backward(); }); @@ -102,8 +102,8 @@ test('should throw with invalid coords (3873 -> 4326) backward', (assert) => { }); test('should forward bbox properly (4326 -> 3857)', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326'); - var to = new mapnik.Projection('+init=epsg:3857'); + var from = new mapnik.Projection('epsg:4326'); + var to = new mapnik.Projection('epsg:3857'); var trans = new mapnik.ProjTransform(from,to); var long_lat_box = [-131.3086, 16.8045, -61.6992, 54.6738]; var merc = [-14617205.7910, 1898084.2861, -6868325.6126, 7298818.9559]; @@ -112,8 +112,8 @@ test('should forward bbox properly (4326 -> 3857)', (assert) => { }); test('should backward bbox properly (3857 -> 4326)', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326'); - var to = new mapnik.Projection('+init=epsg:3857'); + var from = new mapnik.Projection('epsg:4326'); + var to = new mapnik.Projection('epsg:3857'); var trans = new mapnik.ProjTransform(from,to); var long_lat_box = [-131.3086, 16.8045, -61.6992, 54.6738]; var merc = [-14617205.7910, 1898084.2861, -6868325.6126, 7298818.9559]; @@ -122,8 +122,8 @@ test('should backward bbox properly (3857 -> 4326)', (assert) => { }); test('should throw with invalid bbox (4326 -> 3873)', (assert) => { - var from = new mapnik.Projection('+init=epsg:4326'); - var to = new mapnik.Projection('+init=epsg:3873'); + var from = new mapnik.Projection('epsg:4326'); + var to = new mapnik.Projection('epsg:3873'); var trans = new mapnik.ProjTransform(from,to); var long_lat_box = [-180,90,180,90]; assert.throws(function() { trans.forward(long_lat_box); }); @@ -131,8 +131,8 @@ test('should throw with invalid bbox (4326 -> 3873)', (assert) => { }); test('should throw with invalid bbox (3873 -> 4326) backward', (assert) => { - var from = new mapnik.Projection('+init=epsg:3873'); - var to = new mapnik.Projection('+init=epsg:4326'); + var from = new mapnik.Projection('epsg:3873'); + var to = new mapnik.Projection('epsg:4326'); var trans = new mapnik.ProjTransform(from,to); var long_lat_box = [-180,90,180,90]; assert.throws(function() { trans.backward(long_lat_box); }); diff --git a/test/projection.test.js b/test/projection.test.js index f6750acc1e..6ed02f3f00 100644 --- a/test/projection.test.js +++ b/test/projection.test.js @@ -5,28 +5,28 @@ var mapnik = require('../'); test('should throw with invalid usage', (assert) => { - assert.throws(function() { mapnik.Projection('+init=epsg:foo'); } ); - assert.throws(function() { new mapnik.Projection('+init=epsg:foo'); } ); + assert.throws(function() { mapnik.Projection('epsg:foo'); } ); + assert.throws(function() { new mapnik.Projection('epsg:foo'); } ); assert.throws(function() { new mapnik.Projection('+proj +foo'); } ); assert.throws(function() { new mapnik.Projection(1); }); assert.throws(function() { new mapnik.Projection({}); }); - assert.throws(function() { new mapnik.Projection('+init=epsg:3857', null); } ); - assert.throws(function() { new mapnik.Projection('+init=epsg:3857', {lazy:null}); } ); + assert.throws(function() { new mapnik.Projection('epsg:3857', null); } ); + assert.throws(function() { new mapnik.Projection('epsg:3857', {lazy:null}); } ); assert.end(); }); test('should initialize properly', (assert) => { - var wgs84 = new mapnik.Projection('+init=epsg:4326'); + var wgs84 = new mapnik.Projection('epsg:4326'); assert.equal(wgs84 instanceof mapnik.Projection, true); var merc; try { // perhaps we've got a savvy user? - merc = new mapnik.Projection('+init=epsg:900913'); + merc = new mapnik.Projection('epsg:900913'); } catch (err) { // newer versions of proj4 have this code which is == 900913 - merc = new mapnik.Projection('+init=epsg:3857'); + merc = new mapnik.Projection('epsg:3857'); } assert.equal(merc instanceof mapnik.Projection, true, @@ -59,7 +59,7 @@ test('should initialize properly', (assert) => { }); test('should fail some methods with an uninitialized projection', (assert) => { - var wgs84 = new mapnik.Projection('+init=epsg:4326', {lazy : true}); + var wgs84 = new mapnik.Projection('epsg:4326', {lazy : true}); assert.equal(wgs84 instanceof mapnik.Projection, true); var long_lat_coords = [-122.33517, 47.63752]; assert.throws(function() { wgs84.forward(long_lat_coords); }); diff --git a/test/raster.xml b/test/raster.xml index 9bcd7795e4..1b3fe0b069 100644 --- a/test/raster.xml +++ b/test/raster.xml @@ -1,5 +1,5 @@ - + - + style data/images/sat_image.png diff --git a/test/stylesheet.xml b/test/stylesheet.xml index 34a790ad9a..d47a6ad41c 100644 --- a/test/stylesheet.xml +++ b/test/stylesheet.xml @@ -1,5 +1,5 @@ - + - + style data/world_merc.shp diff --git a/test/support/composites.xml b/test/support/composites.xml index 803162024b..2916cc11b1 100644 --- a/test/support/composites.xml +++ b/test/support/composites.xml @@ -1,4 +1,4 @@ - +