Merge branch 'master' of github.com:mapnik/mapnik into kurdish-text-visual-test
5
Makefile
|
@ -84,8 +84,9 @@ demo:
|
|||
pep8:
|
||||
# https://gist.github.com/1903033
|
||||
# gsed on osx
|
||||
@pep8 -r --select=W293 -q --filename=*.py `pwd`/tests/ | xargs gsed -i 's/^[ \r\t]*$//'
|
||||
@pep8 -r --select=W391 -q --filename=*.py `pwd`/tests/ | xargs gsed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}'
|
||||
@pep8 -r --select=W293 -q --filename=*.py `pwd`/tests/ | xargs gsed -i 's/^[ \r\t]*$$//'
|
||||
@pep8 -r --select=W391 -q --filename=*.py `pwd`/tests/ | xargs gsed -i -e :a -e '/^\n*$$/{$$d;N;ba' -e '}'
|
||||
@pep8 -r --select=W391 -q --filename=*.py `pwd`/tests/ | xargs ged -i '/./,/^$$/!d'
|
||||
|
||||
grind:
|
||||
@for FILE in tests/cpp_tests/*-bin; do \
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#
|
||||
#
|
||||
|
||||
import os, re, sys, glob
|
||||
import glob
|
||||
import os
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ Several things happen when you do:
|
|||
|
||||
import itertools
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
try:
|
||||
import json
|
||||
|
|
|
@ -17,7 +17,7 @@ see the documentation of mapnik.printing.PDFPrinter() for options
|
|||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import render, Map, Box2d, Layer, Feature, Projection, ProjTransform, Coord, Style, Rule, Geometry2d
|
||||
from . import render, Map, Box2d, Layer, Feature, Projection, Coord, Style, Geometry2d
|
||||
import math
|
||||
import os
|
||||
import tempfile
|
||||
|
|
|
@ -41,7 +41,7 @@ function install_mason_deps() {
|
|||
ip harfbuzz 2cd5323 $MASON_PLATFORM_ID
|
||||
ip jpeg_turbo 1.4.0 $MASON_PLATFORM_ID
|
||||
ip libxml2 2.9.2 $MASON_PLATFORM_ID
|
||||
ip libpng 1.6.13 $MASON_PLATFORM_ID
|
||||
ip libpng 1.6.16 $MASON_PLATFORM_ID
|
||||
ip webp 0.4.2 $MASON_PLATFORM_ID
|
||||
ip icu 54.1 $MASON_PLATFORM_ID
|
||||
ip proj 4.8.0 $MASON_PLATFORM_ID
|
||||
|
@ -54,7 +54,7 @@ function install_mason_deps() {
|
|||
ip boost_libregex 1.57.0 $MASON_PLATFORM_ID
|
||||
ip boost_libpython 1.57.0 $MASON_PLATFORM_ID
|
||||
ip libpq 9.4.0 $MASON_PLATFORM_ID
|
||||
ip sqlite 3.8.6 $MASON_PLATFORM_ID
|
||||
ip sqlite 3.8.8.1 $MASON_PLATFORM_ID
|
||||
ip gdal 1.11.1 $MASON_PLATFORM_ID
|
||||
ip expat 2.1.0 $MASON_PLATFORM_ID
|
||||
ip pixman 0.32.6 $MASON_PLATFORM_ID
|
||||
|
@ -84,7 +84,6 @@ CUSTOM_CXXFLAGS = '-fvisibility=hidden -fvisibility-inlines-hidden -DU_CHARSET_I
|
|||
CUSTOM_LDFLAGS = '-L${MASON_LINKED_REL}/lib'
|
||||
RUNTIME_LINK = 'static'
|
||||
INPUT_PLUGINS = 'all'
|
||||
PREFIX = '/opt/mapnik-3.x'
|
||||
PATH = '${MASON_LINKED_REL}/bin'
|
||||
PATH_REMOVE = '/usr:/usr/local'
|
||||
PATH_REPLACE = '/Users/travis/build/mapbox/mason/mason_packages:./mason_packages'
|
||||
|
@ -114,6 +113,7 @@ CAIRO_LIBS = '${MASON_LINKED_REL}/lib'
|
|||
SQLITE_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
SQLITE_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
FRAMEWORK_PYTHON = False
|
||||
BENCHMARK = True
|
||||
CPP_TESTS = True
|
||||
PGSQL2SQLITE = True
|
||||
BINDINGS = 'python'
|
||||
|
|
|
@ -46,8 +46,6 @@ using position = std::tuple<double,double>;
|
|||
using boxes = std::vector<std::pair<box2d<double>, std::pair<std::size_t, std::size_t>>>;
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
struct calculate_bounding_box_impl
|
||||
{
|
||||
|
|
|
@ -48,7 +48,6 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
|
|||
qi::_2_type _2;
|
||||
qi::_3_type _3;
|
||||
qi::_4_type _4;
|
||||
qi::no_skip_type no_skip;
|
||||
qi::omit_type omit;
|
||||
qi::_r1_type _r1;
|
||||
qi::_r2_type _r2;
|
||||
|
@ -56,7 +55,7 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
|
|||
qi::_b_type _b;
|
||||
qi::eps_type eps;
|
||||
qi::raw_type raw;
|
||||
standard_wide::char_type char_;
|
||||
boost::spirit::standard_wide::char_type char_;
|
||||
boost::spirit::repository::qi::iter_pos_type iter_pos;
|
||||
using qi::fail;
|
||||
using qi::on_error;
|
||||
|
@ -109,19 +108,6 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
|
|||
| lit("false")
|
||||
| lit("null")
|
||||
;
|
||||
json.unesc_char.add
|
||||
("\\\"", '\"') // quotation mark
|
||||
("\\\\", '\\') // reverse solidus
|
||||
("\\/", '/') // solidus
|
||||
("\\b", '\b') // backspace
|
||||
("\\f", '\f') // formfeed
|
||||
("\\n", '\n') // newline
|
||||
("\\r", '\r') // carrige return
|
||||
("\\t", '\t') // tab
|
||||
;
|
||||
json.string_ %= lit('"') >> no_skip[*(json.unesc_char | "\\u" >> json.hex4 | (char_ - lit('"')))] >> lit('"')
|
||||
;
|
||||
|
||||
coords.name("Coordinates");
|
||||
pos.name("Position");
|
||||
ring.name("Ring");
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace mapnik { namespace json {
|
|||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace phoenix = boost::phoenix;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
struct default_feature_callback
|
||||
{
|
||||
|
@ -77,7 +75,7 @@ struct feature_collection_grammar :
|
|||
qi::rule<Iterator, qi::locals<feature_ptr,int>, void(context_ptr const& ctx, std::size_t, FeatureCallback&), space_type> feature;
|
||||
qi::rule<Iterator, qi::locals<feature_ptr,int>, void(context_ptr const& ctx, std::size_t, FeatureCallback&), space_type> feature_from_geometry;
|
||||
// phoenix functions
|
||||
phoenix::function<extract_geometry> extract_geometry;
|
||||
phoenix::function<json::extract_geometry> extract_geometry;
|
||||
phoenix::function<apply_feature_callback> on_feature;
|
||||
};
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ namespace mapnik { namespace json {
|
|||
namespace qi = boost::spirit::qi;
|
||||
namespace phoenix = boost::phoenix;
|
||||
namespace fusion = boost::fusion;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
class attribute_value_visitor
|
||||
|
||||
|
@ -99,7 +97,6 @@ struct feature_grammar :
|
|||
// start
|
||||
// generic JSON
|
||||
generic_json<Iterator> json_;
|
||||
|
||||
// geoJSON
|
||||
qi::rule<Iterator,void(FeatureType&),space_type> feature; // START
|
||||
qi::rule<Iterator,space_type> feature_type;
|
||||
|
|
|
@ -35,8 +35,6 @@ feature_grammar<Iterator,FeatureType,ErrorHandler>::feature_grammar(mapnik::tran
|
|||
qi::lit_type lit;
|
||||
qi::long_long_type long_long;
|
||||
qi::double_type double_;
|
||||
qi::no_skip_type no_skip;
|
||||
standard_wide::char_type char_;
|
||||
qi::_val_type _val;
|
||||
qi::_1_type _1;
|
||||
qi::_2_type _2;
|
||||
|
@ -77,20 +75,6 @@ feature_grammar<Iterator,FeatureType,ErrorHandler>::feature_grammar(mapnik::tran
|
|||
| lit("null")[_val = construct<value_null>()]
|
||||
;
|
||||
|
||||
json_.unesc_char.add
|
||||
("\\\"", '\"') // quotation mark
|
||||
("\\\\", '\\') // reverse solidus
|
||||
("\\/", '/') // solidus
|
||||
("\\b", '\b') // backspace
|
||||
("\\f", '\f') // formfeed
|
||||
("\\n", '\n') // newline
|
||||
("\\r", '\r') // carrige return
|
||||
("\\t", '\t') // tab
|
||||
;
|
||||
|
||||
json_.string_ %= lit('"') >> no_skip[*(json_.unesc_char | "\\u" >> json_.hex4 | (char_ - lit('"')))] >> lit('"')
|
||||
;
|
||||
|
||||
// geojson types
|
||||
feature_type = lit("\"type\"")
|
||||
>> lit(':')
|
||||
|
|
|
@ -39,7 +39,7 @@ inline bool from_geojson(std::string const& json, mapnik::feature_impl & feature
|
|||
using iterator_type = std::string::const_iterator;
|
||||
static const mapnik::json::feature_grammar<iterator_type,mapnik::feature_impl> g(tr);
|
||||
using namespace boost::spirit;
|
||||
standard_wide::space_type space;
|
||||
ascii::space_type space;
|
||||
return qi::phrase_parse(json.begin(), json.end(), (g)(boost::phoenix::ref(feature)), space);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,19 +37,116 @@
|
|||
namespace mapnik { namespace json {
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
namespace ascii = boost::spirit::ascii;
|
||||
namespace phoenix = boost::phoenix;
|
||||
using space_type = ascii::space_type;
|
||||
using json_value = mapnik::util::variant<value_null,value_bool, value_integer, value_double, std::string>;
|
||||
using uchar = std::uint32_t; // a unicode code point
|
||||
|
||||
// unicode string grammar via boost/libs/spirit/example/qi/json/json/parser/grammar.hpp
|
||||
|
||||
template <typename Iterator>
|
||||
struct unicode_string : qi::grammar<Iterator, std::string()>
|
||||
{
|
||||
unicode_string();
|
||||
qi::rule<Iterator, void(std::string&)> escape;
|
||||
qi::rule<Iterator, void(std::string&)> char_esc;
|
||||
qi::rule<Iterator, std::string()> double_quoted;
|
||||
};
|
||||
|
||||
|
||||
struct push_utf8
|
||||
{
|
||||
template <typename S, typename C>
|
||||
struct result { typedef void type; };
|
||||
|
||||
void operator()(std::string& utf8, uchar code_point) const
|
||||
{
|
||||
typedef std::back_insert_iterator<std::string> insert_iter;
|
||||
insert_iter out_iter(utf8);
|
||||
boost::utf8_output_iterator<insert_iter> utf8_iter(out_iter);
|
||||
*utf8_iter++ = code_point;
|
||||
}
|
||||
};
|
||||
|
||||
struct push_esc
|
||||
{
|
||||
template <typename S, typename C>
|
||||
struct result { typedef void type; };
|
||||
|
||||
void operator()(std::string& utf8, uchar c) const
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case ' ': utf8 += ' '; break;
|
||||
case '\t': utf8 += '\t'; break;
|
||||
case '0': utf8 += char(0); break;
|
||||
case 'a': utf8 += 0x7; break;
|
||||
case 'b': utf8 += 0x8; break;
|
||||
case 't': utf8 += 0x9; break;
|
||||
case 'n': utf8 += 0xA; break;
|
||||
case 'v': utf8 += 0xB; break;
|
||||
case 'f': utf8 += 0xC; break;
|
||||
case 'r': utf8 += 0xD; break;
|
||||
case 'e': utf8 += 0x1B; break;
|
||||
case '"': utf8 += '"'; break;
|
||||
case '/': utf8 += '/'; break;
|
||||
case '\\': utf8 += '\\'; break;
|
||||
case '_': push_utf8()(utf8, 0xA0); break;
|
||||
case 'N': push_utf8()(utf8, 0x85); break;
|
||||
case 'L': push_utf8()(utf8, 0x2028); break;
|
||||
case 'P': push_utf8()(utf8, 0x2029); break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template< typename Iterator >
|
||||
unicode_string<Iterator>::unicode_string()
|
||||
: unicode_string::base_type(double_quoted)
|
||||
{
|
||||
qi::char_type char_;
|
||||
qi::_val_type _val;
|
||||
qi::_r1_type _r1;
|
||||
qi::_1_type _1;
|
||||
qi::lit_type lit;
|
||||
qi::eol_type eol;
|
||||
qi::repeat_type repeat;
|
||||
qi::hex_type hex;
|
||||
|
||||
using boost::spirit::qi::uint_parser;
|
||||
using boost::phoenix::function;
|
||||
using boost::phoenix::ref;
|
||||
|
||||
uint_parser<uchar, 16, 4, 4> hex4;
|
||||
uint_parser<uchar, 16, 8, 8> hex8;
|
||||
function<push_utf8> push_utf8;
|
||||
function<push_esc> push_esc;
|
||||
|
||||
escape =
|
||||
('x' > hex) [push_utf8(_r1, _1)]
|
||||
| ('u' > hex4) [push_utf8(_r1, _1)]
|
||||
| ('U' > hex8) [push_utf8(_r1, _1)]
|
||||
| char_("0abtnvfre\"/\\N_LP \t") [push_esc(_r1, _1)]
|
||||
| eol // continue to next line
|
||||
;
|
||||
|
||||
char_esc =
|
||||
'\\' > escape(_r1)
|
||||
;
|
||||
|
||||
double_quoted =
|
||||
'"'
|
||||
> *(char_esc(_val) | (~char_('"')) [_val += _1])
|
||||
> '"'
|
||||
;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
struct generic_json
|
||||
{
|
||||
qi::rule<Iterator,space_type> value;
|
||||
qi::symbols<char const, char const> unesc_char;
|
||||
qi::uint_parser< unsigned, 16, 4, 4 > hex4 ;
|
||||
qi::int_parser<mapnik::value_integer,10,1,-1> int__;
|
||||
qi::rule<Iterator,std::string(), space_type> string_;
|
||||
unicode_string<Iterator> string_;
|
||||
qi::rule<Iterator,space_type> key_value;
|
||||
qi::rule<Iterator,json_value(),space_type> number;
|
||||
qi::rule<Iterator,space_type> object;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <mapnik/geometry.hpp> // for geometry_type
|
||||
#include <mapnik/vertex.hpp> // for CommandType
|
||||
#include <mapnik/make_unique.hpp>
|
||||
#include <mapnik/json/generic_json.hpp>
|
||||
#include <mapnik/json/positions_grammar.hpp>
|
||||
#include <mapnik/json/geometry_util.hpp>
|
||||
#include <mapnik/geometry_container.hpp>
|
||||
|
@ -38,8 +39,6 @@
|
|||
namespace mapnik { namespace json {
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
template <typename Iterator, typename ErrorHandler = error_handler<Iterator> >
|
||||
struct geometry_grammar :
|
||||
|
|
|
@ -38,7 +38,7 @@ inline bool from_geojson(std::string const& json, geometry_container & paths)
|
|||
{
|
||||
using namespace boost::spirit;
|
||||
static const geometry_grammar<std::string::const_iterator> g;
|
||||
standard_wide::space_type space;
|
||||
ascii::space_type space;
|
||||
std::string::const_iterator start = json.begin();
|
||||
std::string::const_iterator end = json.end();
|
||||
return qi::phrase_parse(start, end, (g)(boost::phoenix::ref(paths)), space);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/util/variant.hpp>
|
||||
#include <mapnik/json/generic_json.hpp>
|
||||
#include <mapnik/json/error_handler.hpp>
|
||||
|
||||
// boost
|
||||
|
@ -46,8 +47,6 @@ using positions = std::vector<position>;
|
|||
using coordinates = util::variant<empty, position, positions, std::vector<positions>, std::vector<std::vector<positions> > > ;
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
struct set_position_impl
|
||||
{
|
||||
|
|
|
@ -44,8 +44,7 @@ namespace mapnik { namespace topojson {
|
|||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace fusion = boost::fusion;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
using space_type = boost::spirit::ascii::space_type;
|
||||
|
||||
template <typename Iterator, typename ErrorHandler = json::error_handler<Iterator> >
|
||||
struct topojson_grammar : qi::grammar<Iterator, space_type, topology()>
|
||||
|
|
|
@ -27,8 +27,6 @@ namespace mapnik { namespace topojson {
|
|||
namespace qi = boost::spirit::qi;
|
||||
namespace phoenix = boost::phoenix;
|
||||
namespace fusion = boost::fusion;
|
||||
namespace standard_wide = boost::spirit::standard_wide;
|
||||
using standard_wide::space_type;
|
||||
|
||||
template <typename Iterator, typename ErrorHandler>
|
||||
topojson_grammar<Iterator, ErrorHandler>::topojson_grammar()
|
||||
|
@ -37,7 +35,6 @@ topojson_grammar<Iterator, ErrorHandler>::topojson_grammar()
|
|||
qi::lit_type lit;
|
||||
qi::double_type double_;
|
||||
qi::int_type int_;
|
||||
qi::no_skip_type no_skip;
|
||||
qi::omit_type omit;
|
||||
qi::_val_type _val;
|
||||
qi::_1_type _1;
|
||||
|
@ -45,7 +42,6 @@ topojson_grammar<Iterator, ErrorHandler>::topojson_grammar()
|
|||
qi::_3_type _3;
|
||||
qi::_4_type _4;
|
||||
qi::_r1_type _r1;
|
||||
standard_wide::char_type char_;
|
||||
using qi::fail;
|
||||
using qi::on_error;
|
||||
using phoenix::push_back;
|
||||
|
@ -75,20 +71,6 @@ topojson_grammar<Iterator, ErrorHandler>::topojson_grammar()
|
|||
| lit("null")[_val = construct<value_null>()]
|
||||
;
|
||||
|
||||
json_.unesc_char.add
|
||||
("\\\"", '\"') // quotation mark
|
||||
("\\\\", '\\') // reverse solidus
|
||||
("\\/", '/') // solidus
|
||||
("\\b", '\b') // backspace
|
||||
("\\f", '\f') // formfeed
|
||||
("\\n", '\n') // newline
|
||||
("\\r", '\r') // carrige return
|
||||
("\\t", '\t') // tab
|
||||
;
|
||||
|
||||
json_.string_ %= lit('"') >> no_skip[*(json_.unesc_char | "\\u" >> json_.hex4 | (char_ - lit('"')))] >> lit('"')
|
||||
;
|
||||
|
||||
// topo json
|
||||
topology = lit('{') >> lit("\"type\"") >> lit(':') >> lit("\"Topology\"")
|
||||
>> ( (lit(',') >> objects) ^ ( lit(',') >> arcs) ^ (lit(',') >> transform) ^ (lit(',') >> bbox))
|
||||
|
|
|
@ -159,7 +159,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
|
|||
{
|
||||
mapnik::json::boxes boxes;
|
||||
mapnik::json::extract_bounding_box_grammar<Iterator> bbox_grammar;
|
||||
boost::spirit::standard_wide::space_type space;
|
||||
boost::spirit::ascii::space_type space;
|
||||
if (!boost::spirit::qi::phrase_parse(start, end, (bbox_grammar)(boost::phoenix::ref(boxes)) , space))
|
||||
{
|
||||
throw mapnik::datasource_exception("GeoJSON Plugin: could not parse: '" + filename_ + "'");
|
||||
|
@ -194,7 +194,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
|
|||
using namespace boost::spirit;
|
||||
static const mapnik::transcoder tr("utf8");
|
||||
static const mapnik::json::feature_grammar<chr_iterator_type,mapnik::feature_impl> grammar(tr);
|
||||
standard_wide::space_type space;
|
||||
ascii::space_type space;
|
||||
if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space))
|
||||
{
|
||||
throw std::runtime_error("Failed to parse geojson feature");
|
||||
|
@ -216,7 +216,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
|
|||
template <typename T>
|
||||
void geojson_datasource::parse_geojson(T const& buffer)
|
||||
{
|
||||
boost::spirit::standard_wide::space_type space;
|
||||
boost::spirit::ascii::space_type space;
|
||||
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
|
||||
std::size_t start_id = 1;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ mapnik::feature_ptr large_geojson_featureset::next()
|
|||
static const mapnik::transcoder tr("utf8");
|
||||
static const mapnik::json::feature_grammar<chr_iterator_type,mapnik::feature_impl> grammar(tr);
|
||||
using namespace boost::spirit;
|
||||
standard_wide::space_type space;
|
||||
ascii::space_type space;
|
||||
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,1));
|
||||
if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space))
|
||||
{
|
||||
|
|
|
@ -190,7 +190,7 @@ const mapnik::topojson::topojson_grammar<base_iterator_type> g;
|
|||
template <typename T>
|
||||
void topojson_datasource::parse_topojson(T const& buffer)
|
||||
{
|
||||
boost::spirit::standard_wide::space_type space;
|
||||
boost::spirit::ascii::space_type space;
|
||||
bool result = boost::spirit::qi::phrase_parse(buffer.begin(), buffer.end(), g, space, topo_);
|
||||
if (!result)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
import json
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import eq_,assert_true,assert_almost_equal,assert_false
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
|
||||
def test_coord_init():
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import sys
|
||||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import os
|
||||
import shutil
|
||||
import mapnik
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#encoding: utf8
|
||||
|
||||
from nose.tools import *
|
||||
import os,sys
|
||||
from utilities import execution_path, run_all, Todo
|
||||
from nose.tools import eq_
|
||||
import os
|
||||
from utilities import execution_path, run_all
|
||||
from utilities import get_unique_colors, pixel2channels, side_by_side_image
|
||||
import mapnik
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
import sys
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises
|
||||
from utilities import execution_path
|
||||
|
||||
import os, mapnik
|
||||
|
@ -33,25 +32,26 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
|
|||
broken.append("../data/csv/fails/does_not_exist.csv")
|
||||
|
||||
for csv in broken:
|
||||
throws = False
|
||||
if visual:
|
||||
try:
|
||||
ds = mapnik.Datasource(type='csv',file=csv,strict=True)
|
||||
print '\x1b[33mfailed\x1b[0m',csv
|
||||
mapnik.Datasource(type='csv',file=csv,strict=True)
|
||||
print '\x1b[33mfailed: should have thrown\x1b[0m',csv
|
||||
except Exception:
|
||||
print '\x1b[1;32m✓ \x1b[0m', csv
|
||||
|
||||
def test_good_files(visual=False):
|
||||
good_files = glob.glob("../data/csv/*.*")
|
||||
good_files.extend(glob.glob("../data/csv/warns/*.*"))
|
||||
ignorable = os.path.join('..','data','csv','long_lat.vrt')
|
||||
good_files.remove(ignorable)
|
||||
|
||||
for csv in good_files:
|
||||
if visual:
|
||||
try:
|
||||
ds = mapnik.Datasource(type='csv',file=csv)
|
||||
mapnik.Datasource(type='csv',file=csv)
|
||||
print '\x1b[1;32m✓ \x1b[0m', csv
|
||||
except Exception:
|
||||
print '\x1b[33mfailed\x1b[0m',csv
|
||||
except Exception, e:
|
||||
print '\x1b[33mfailed: should not have thrown\x1b[0m',csv,str(e)
|
||||
|
||||
def test_lon_lat_detection(**kwargs):
|
||||
ds = get_csv_ds('lon_lat.csv')
|
||||
|
@ -68,7 +68,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
|
|||
attr = {'lon': 0, 'lat': 0}
|
||||
eq_(feat.attributes,attr)
|
||||
|
||||
def test_lon_lat_detection(**kwargs):
|
||||
def test_lng_lat_detection(**kwargs):
|
||||
ds = get_csv_ds('lng_lat.csv')
|
||||
eq_(len(ds.fields()),2)
|
||||
eq_(ds.fields(),['lng','lat'])
|
||||
|
@ -357,9 +357,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
|
|||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
desc = ds.describe()
|
||||
eq_(desc['geometry_type'],mapnik.DataGeometryType.Point)
|
||||
ds.features(query)
|
||||
|
||||
def test_that_leading_zeros_mean_strings(**kwargs):
|
||||
ds = get_csv_ds('leading_zeros.csv')
|
||||
|
@ -471,7 +469,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
|
|||
@raises(RuntimeError)
|
||||
def test_that_fewer_headers_than_rows_throws(**kwargs):
|
||||
# this has invalid header # so throw
|
||||
ds = get_csv_ds('more_column_values_than_headers.csv')
|
||||
get_csv_ds('more_column_values_than_headers.csv')
|
||||
|
||||
def test_that_feature_id_only_incremented_for_valid_rows(**kwargs):
|
||||
ds = mapnik.Datasource(type='csv',
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
from itertools import groupby
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -119,8 +120,6 @@ def test_ogr_layer_by_sql():
|
|||
eq_(num_feats, 1)
|
||||
|
||||
def test_hit_grid():
|
||||
import os
|
||||
from itertools import groupby
|
||||
|
||||
def rle_encode(l):
|
||||
""" encode a list of strings with run-length compression """
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, sys, glob, mapnik
|
||||
import os, mapnik
|
||||
import itertools
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import itertools,sys
|
||||
import unittest
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
from nose.tools import eq_,raises
|
||||
from utilities import run_all
|
||||
|
||||
import mapnik
|
||||
from binascii import unhexlify
|
||||
|
@ -77,7 +76,7 @@ def test_feature_expression_evaluation_missing_attr():
|
|||
expr = mapnik.Expression("[fielddoesnotexist]='a'")
|
||||
eq_(f.has_key('fielddoesnotexist'),False)
|
||||
try:
|
||||
evaluated = expr.evaluate(f)
|
||||
expr.evaluate(f)
|
||||
except Exception, e:
|
||||
eq_("Key does not exist" in str(e),True)
|
||||
num_attributes = len(f)
|
||||
|
@ -112,7 +111,7 @@ def test_feature_from_geojson():
|
|||
}
|
||||
}
|
||||
"""
|
||||
feat = mapnik.Feature.from_geojson(inline_string,ctx)
|
||||
mapnik.Feature.from_geojson(inline_string,ctx)
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit(run_all(eval(x) for x in dir() if x.startswith("test_")))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
|
||||
|
@ -443,7 +443,7 @@ def test_division_by_zero():
|
|||
|
||||
@raises(RuntimeError)
|
||||
def test_invalid_syntax1():
|
||||
expr = mapnik.Expression('abs()')
|
||||
mapnik.Expression('abs()')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
# Tests that exercise fonts.
|
||||
|
||||
# Trac Ticket #31
|
||||
# Todo: Add logic to use this TextSymbolizer in a rendering
|
||||
#@raises(UserWarning)
|
||||
#def test_invalid_font():
|
||||
# ts = mapnik.TextSymbolizer('Name', 'Invalid Font Name', int(8), mapnik.Color('black'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit(run_all(eval(x) for x in dir() if x.startswith("test_")))
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,assert_almost_equal
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#encoding: utf8
|
||||
|
||||
from nose.tools import *
|
||||
import os,sys
|
||||
from nose.tools import eq_,raises
|
||||
import os
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
from binascii import unhexlify
|
||||
|
@ -136,18 +136,18 @@ def test_wkb_parsing():
|
|||
def test_geojson_parsing():
|
||||
path = mapnik.Path()
|
||||
count = 0
|
||||
for json in geojson:
|
||||
count += json[0]
|
||||
path.add_geojson(json[1])
|
||||
for j in geojson:
|
||||
count += j[0]
|
||||
path.add_geojson(j[1])
|
||||
eq_(count,len(path))
|
||||
|
||||
def test_geojson_parsing_reversed():
|
||||
path = mapnik.Path()
|
||||
path2 = mapnik.Path()
|
||||
count = 0
|
||||
for idx,json in enumerate(geojson_reversed):
|
||||
count += json[0]
|
||||
path.add_geojson(json[1])
|
||||
for idx,j in enumerate(geojson_reversed):
|
||||
count += j[0]
|
||||
path.add_geojson(j[1])
|
||||
path2.add_geojson(geojson[idx][1])
|
||||
eq_(path.to_geojson(),path2.to_geojson())
|
||||
eq_(count,len(path))
|
||||
|
@ -166,7 +166,7 @@ def test_geojson_point_positions():
|
|||
path.add_geojson('{"type":"Point","coordinates":[30,10,50,50,50,50]}')
|
||||
eq_(path.to_geojson(),input_json)
|
||||
|
||||
def test_geojson_point_positions():
|
||||
def test_geojson_point_positions2():
|
||||
input_json = '{"type":"LineString","coordinates":[[30,10],[10,30],[40,40]]}'
|
||||
|
||||
path = mapnik.Path()
|
||||
|
@ -333,9 +333,9 @@ def test_creating_feature_from_geojson():
|
|||
eq_(feat['name'],u'value')
|
||||
|
||||
def test_handling_geojson_null_geoms():
|
||||
for json in geojson_nulls:
|
||||
for j in geojson_nulls:
|
||||
ctx = mapnik.Context()
|
||||
out_json = mapnik.Feature.from_geojson(json,ctx).to_geojson()
|
||||
out_json = mapnik.Feature.from_geojson(j,ctx).to_geojson()
|
||||
expected = '{"type":"Feature","id":1,"geometry":null,"properties":{}}'
|
||||
eq_(out_json,expected)
|
||||
# ensure it round trips
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import mapnik
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import eq_
|
||||
from utilities import run_all
|
||||
|
||||
def test_grayscale_conversion():
|
||||
im = mapnik.Image(2,2)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
@ -42,8 +40,8 @@ combinations = ['png',
|
|||
'png:z=1:s=filtered',
|
||||
'png:z=1:s=huff',
|
||||
'png:z=1:s=rle',
|
||||
'png:m=h:g=2.0',
|
||||
'png:m=h:g=1.0',
|
||||
'png8:m=h:g=2.0',
|
||||
'png8:m=h:g=1.0',
|
||||
'png:e=miniz',
|
||||
'png8:e=miniz'
|
||||
]
|
||||
|
@ -59,7 +57,7 @@ iterations = 10
|
|||
|
||||
def do_encoding():
|
||||
|
||||
image = None
|
||||
global image
|
||||
|
||||
results = {}
|
||||
sortable = {}
|
||||
|
@ -115,7 +113,6 @@ def do_encoding():
|
|||
min_ = str(s[0])[:6]
|
||||
avg = str(s[1])[:6]
|
||||
elapsed = str(s[2])[:6]
|
||||
percent_reduction = s[4]
|
||||
name = s[3]
|
||||
size = s[4]
|
||||
print 'min: %sms | avg: %sms | total: %sms | len: %s <-- %s' % (min_,avg,elapsed,size,name)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
from utilities import side_by_side_image
|
||||
import os, mapnik
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
@ -24,6 +22,9 @@ def test_image_premultiply():
|
|||
def test_negative_image_dimensions():
|
||||
# TODO - this may have regressed in https://github.com/mapnik/mapnik/commit/4f3521ac24b61fc8ae8fd344a16dc3a5fdf15af7
|
||||
im = mapnik.Image(-40,40)
|
||||
# should not get here
|
||||
eq_(im.width(),0)
|
||||
eq_(im.height(),0)
|
||||
|
||||
def test_jpeg_round_trip():
|
||||
filepath = '/tmp/mapnik-jpeg-io.jpeg'
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 738 B |
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import mapnik
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#encoding: utf8
|
||||
|
||||
from nose.tools import *
|
||||
import os,sys
|
||||
from nose.tools import eq_
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from utilities import run_all
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import eq_
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
|
||||
# Map initialization
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import os, sys, glob, mapnik
|
||||
import os, glob, mapnik
|
||||
|
||||
default_logging_severity = mapnik.logger.get_severity()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises,assert_almost_equal
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
import os
|
||||
|
||||
import os, sys, glob, mapnik
|
||||
from nose.tools import eq_
|
||||
from utilities import run_all
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
def test_mapnik_config_no_args():
|
||||
process = Popen('mapnik-config', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import eq_
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
|
||||
def test_logger_init():
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
from glob import glob
|
||||
|
@ -41,7 +40,7 @@ def test_opening_data():
|
|||
kwargs = {'type': 'ogr','file': filepath}
|
||||
kwargs['layer_by_index'] = 0
|
||||
try:
|
||||
ds = mapnik.Datasource(**kwargs)
|
||||
mapnik.Datasource(**kwargs)
|
||||
except Exception, e:
|
||||
print 'could not open, %s: %s' % (kwargs,e)
|
||||
else:
|
||||
|
@ -50,7 +49,7 @@ def test_opening_data():
|
|||
if plugin is 'ogr':
|
||||
kwargs['layer_by_index'] = 0
|
||||
try:
|
||||
ds = mapnik.Datasource(**kwargs)
|
||||
mapnik.Datasource(**kwargs)
|
||||
except Exception, e:
|
||||
print 'could not open, %s: %s' % (kwargs,e)
|
||||
#else:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#encoding: utf8
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
from utilities import run_all
|
||||
from nose.tools import eq_
|
||||
|
||||
def test_add_feature():
|
||||
md = mapnik.MemoryDatasource()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all, contains_word
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import os, sys, glob, mapnik
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,assert_almost_equal,raises
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
@ -52,7 +52,7 @@ if 'ogr' in mapnik.DatasourceCache.plugin_names():
|
|||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
ds.features(query)
|
||||
|
||||
# disabled because OGR prints an annoying error: ERROR 1: Invalid Point object. Missing 'coordinates' member.
|
||||
#def test_handling_of_null_features():
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
@ -32,7 +32,7 @@ if 'osm' in mapnik.DatasourceCache.plugin_names():
|
|||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
ds.features(query)
|
||||
|
||||
def test_that_64bit_int_fields_work():
|
||||
ds = mapnik.Osm(file='../data/osm/64bit.osm')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,assert_almost_equal
|
||||
import atexit
|
||||
import cProfile, pstats, io
|
||||
import time
|
||||
from utilities import execution_path, run_all
|
||||
from subprocess import Popen, PIPE
|
||||
import os, mapnik
|
||||
from Queue import Queue
|
||||
import threading
|
||||
import sys
|
||||
import re
|
||||
from binascii import hexlify, unhexlify
|
||||
from binascii import hexlify
|
||||
|
||||
|
||||
MAPNIK_TEST_DBNAME = 'mapnik-tmp-pgraster-test-db'
|
||||
|
@ -49,7 +46,7 @@ def psql_can_connect():
|
|||
try:
|
||||
call('psql %s -c "select postgis_version()"' % POSTGIS_TEMPLATE_DBNAME)
|
||||
return True
|
||||
except RuntimeError, e:
|
||||
except RuntimeError:
|
||||
print 'Notice: skipping pgraster tests (connection)'
|
||||
return False
|
||||
|
||||
|
@ -67,7 +64,7 @@ def raster2pgsql_on_path():
|
|||
try:
|
||||
call('raster2pgsql')
|
||||
return True
|
||||
except RuntimeError, e:
|
||||
except RuntimeError:
|
||||
print 'Notice: skipping pgraster tests (raster2pgsql)'
|
||||
return False
|
||||
|
||||
|
@ -80,7 +77,7 @@ def createdb_and_dropdb_on_path():
|
|||
call('createdb --help')
|
||||
call('dropdb --help')
|
||||
return True
|
||||
except RuntimeError, e:
|
||||
except RuntimeError:
|
||||
print 'Notice: skipping pgraster tests (createdb/dropdb)'
|
||||
return False
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import tempfile
|
||||
|
||||
import mapnik, pickle
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import os
|
||||
import mapnik
|
||||
from nose.tools import *
|
||||
from nose.tools import assert_raises
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
datadir = '../data/pngsuite'
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises
|
||||
import atexit
|
||||
import time
|
||||
from utilities import execution_path, run_all
|
||||
from subprocess import Popen, PIPE
|
||||
import os, mapnik
|
||||
from Queue import Queue
|
||||
import threading
|
||||
|
||||
|
||||
|
@ -41,7 +39,7 @@ def psql_can_connect():
|
|||
try:
|
||||
call('psql %s -c "select postgis_version()"' % POSTGIS_TEMPLATE_DBNAME)
|
||||
return True
|
||||
except RuntimeError, e:
|
||||
except RuntimeError:
|
||||
print 'Notice: skipping postgis tests (connection)'
|
||||
return False
|
||||
|
||||
|
@ -53,7 +51,7 @@ def shp2pgsql_on_path():
|
|||
try:
|
||||
call('shp2pgsql')
|
||||
return True
|
||||
except RuntimeError, e:
|
||||
except RuntimeError:
|
||||
print 'Notice: skipping postgis tests (shp2pgsql)'
|
||||
return False
|
||||
|
||||
|
@ -66,7 +64,7 @@ def createdb_and_dropdb_on_path():
|
|||
call('createdb --help')
|
||||
call('dropdb --help')
|
||||
return True
|
||||
except RuntimeError, e:
|
||||
except RuntimeError:
|
||||
print 'Notice: skipping postgis tests (createdb/dropdb)'
|
||||
return False
|
||||
|
||||
|
@ -340,7 +338,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
|
|||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
ds.features(query)
|
||||
|
||||
def test_auto_detection_of_unique_feature_id_32_bit():
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test2',
|
||||
|
@ -401,7 +399,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
|
|||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test3',
|
||||
geometry_field='geom',
|
||||
autodetect_key_field=True)
|
||||
fs = ds.featureset()
|
||||
ds.featureset()
|
||||
|
||||
def test_auto_detection_of_unique_feature_id_64_bit():
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test4',
|
||||
|
@ -484,19 +482,19 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
|
|||
|
||||
@raises(RuntimeError)
|
||||
def test_auto_detection_of_invalid_numeric_primary_key():
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select geom, manual_id::numeric from test2) as t''',
|
||||
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select geom, manual_id::numeric from test2) as t''',
|
||||
geometry_field='geom',
|
||||
autodetect_key_field=True)
|
||||
|
||||
@raises(RuntimeError)
|
||||
def test_auto_detection_of_invalid_multiple_keys():
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''test6''',
|
||||
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''test6''',
|
||||
geometry_field='geom',
|
||||
autodetect_key_field=True)
|
||||
|
||||
@raises(RuntimeError)
|
||||
def test_auto_detection_of_invalid_multiple_keys_subquery():
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select first_id,second_id,geom from test6) as t''',
|
||||
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select first_id,second_id,geom from test6) as t''',
|
||||
geometry_field='geom',
|
||||
autodetect_key_field=True)
|
||||
|
||||
|
@ -639,7 +637,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
|
|||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,
|
||||
table='asdfasdfasdfasdfasdf',
|
||||
max_size=20)
|
||||
fs = ds.all_features()
|
||||
ds.all_features()
|
||||
except Exception, e:
|
||||
eq_('in executeQuery' in str(e),True)
|
||||
|
||||
|
@ -800,7 +798,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
|
|||
# https://github.com/mapnik/mapnik/issues/1816
|
||||
def test_exception_message_reporting():
|
||||
try:
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='doesnotexist')
|
||||
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='doesnotexist')
|
||||
except Exception, e:
|
||||
eq_(e.message != 'unidentifiable C++ exception', True)
|
||||
|
||||
|
@ -829,7 +827,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
|
|||
'table':"(select null::bigint as osm_id, GeomFromEWKT('SRID=4326;POINT(0 0)') as geom) as tmp"}
|
||||
ds = mapnik.Datasource(**opts)
|
||||
fs = ds.featureset()
|
||||
feat = fs.next() ## should throw since key_field is null: StopIteration: No more features.
|
||||
fs.next() ## should throw since key_field is null: StopIteration: No more features.
|
||||
|
||||
def test_psql_error_should_not_break_connection_pool():
|
||||
# Bad request, will trigger an error when returning result
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,assert_almost_equal
|
||||
|
||||
import mapnik
|
||||
import random
|
||||
import math
|
||||
from utilities import run_all, assert_box2d_almost_equal
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import os, mapnik
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,assert_almost_equal,raises
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all, contains_word, get_unique_colors
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all, get_unique_colors
|
||||
|
||||
import os, mapnik
|
||||
|
||||
|
@ -139,7 +139,7 @@ def test_raster_with_alpha_blends_correctly_with_background():
|
|||
mim = mapnik.Image(WIDTH, HEIGHT)
|
||||
|
||||
mapnik.render(map, mim)
|
||||
imdata = mim.tostring()
|
||||
mim.tostring()
|
||||
# All white is expected
|
||||
eq_(get_unique_colors(mim),['rgba(254,254,254,255)'])
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all, contains_word, get_unique_colors
|
||||
from nose.tools import eq_,assert_almost_equal
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import os, mapnik
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
@ -348,7 +348,7 @@ if mapnik.has_grid_renderer():
|
|||
# should throw right here since Name will be a property now on the `grid` object
|
||||
# and it is not found on the second layer
|
||||
mapnik.render_layer(m,grid,layer=1,fields=['Value'])
|
||||
utf1 = grid.encode()
|
||||
grid.encode()
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,raises
|
||||
import tempfile
|
||||
import os, mapnik
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
import tempfile
|
||||
|
||||
import os, sys, glob, mapnik
|
||||
import os, glob, mapnik
|
||||
|
||||
default_logging_severity = mapnik.logger.get_severity()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_,assert_almost_equal,raises
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
|
@ -49,7 +49,7 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
|
|||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
ds.features(query)
|
||||
|
||||
def test_dbf_logical_field_is_boolean():
|
||||
ds = mapnik.Shapefile(file='../data/shp/long_lat')
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_
|
||||
from utilities import execution_path, run_all
|
||||
from Queue import Queue
|
||||
import threading
|
||||
import time
|
||||
|
||||
import os, mapnik
|
||||
import sqlite3
|
||||
|
@ -19,7 +17,7 @@ TOTAL = 245
|
|||
|
||||
def create_ds(test_db,table):
|
||||
ds = mapnik.SQLite(file=test_db,table=table)
|
||||
fs = ds.all_features()
|
||||
ds.all_features()
|
||||
del ds
|
||||
|
||||
if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from nose.tools import eq_, raises
|
||||
from utilities import execution_path, run_all
|
||||
import os
|
||||
import mapnik
|
||||
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -304,7 +305,7 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
ds.features(query)
|
||||
|
||||
def test_intersects_token1():
|
||||
ds = mapnik.SQLite(file='../data/sqlite/empty.db',
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import eq_
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
|
||||
def test_style_init():
|
||||
|
|