- improved again the logging facilities
- aligned the plugins to using the new methods with severity - implemented per object severity, with fallback to global (with global functions to set them programmatically) - initial check in of logger python bindings (todo)
This commit is contained in:
parent
65c3e9021c
commit
8c58a9aa73
51 changed files with 530 additions and 430 deletions
|
@ -90,7 +90,6 @@ boost::python::dict describe(boost::shared_ptr<mapnik::datasource> const& ds)
|
||||||
description["name"] = ld.get_name();
|
description["name"] = ld.get_name();
|
||||||
description["geometry_type"] = ds->get_geometry_type();
|
description["geometry_type"] = ds->get_geometry_type();
|
||||||
description["encoding"] = ld.get_encoding();
|
description["encoding"] = ld.get_encoding();
|
||||||
description["log"] = ds->log_enabled();
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
65
bindings/python/mapnik_logger.cpp
Normal file
65
bindings/python/mapnik_logger.cpp
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <boost/python.hpp>
|
||||||
|
#include <mapnik/debug.hpp>
|
||||||
|
|
||||||
|
void export_logger()
|
||||||
|
{
|
||||||
|
// TODO - expose the logger global class
|
||||||
|
|
||||||
|
/*
|
||||||
|
using namespace boost::python;
|
||||||
|
|
||||||
|
enum_<mapnik::logger::severity::type>("severity")
|
||||||
|
.value("Info", mapnik::logger::severity::info)
|
||||||
|
.value("Debug", mapnik::logger::severity::debug)
|
||||||
|
.value("Warn", mapnik::logger::severity::warn)
|
||||||
|
.value("Error", mapnik::logger::severity::error)
|
||||||
|
.value("Fatal", mapnik::logger::severity::fatal)
|
||||||
|
.value("None", mapnik::logger::severity::none)
|
||||||
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
using mapnik::freetype_engine;
|
||||||
|
using mapnik::singleton;
|
||||||
|
using mapnik::CreateStatic;
|
||||||
|
using namespace boost::python;
|
||||||
|
class_<singleton<freetype_engine,CreateStatic>,boost::noncopyable>("Singleton",no_init)
|
||||||
|
.def("instance",&singleton<freetype_engine,CreateStatic>::instance,
|
||||||
|
return_value_policy<reference_existing_object>())
|
||||||
|
.staticmethod("instance")
|
||||||
|
;
|
||||||
|
|
||||||
|
class_<freetype_engine,bases<singleton<freetype_engine,CreateStatic> >,
|
||||||
|
boost::noncopyable>("FontEngine",no_init)
|
||||||
|
.def("register_font",&freetype_engine::register_font)
|
||||||
|
.def("register_fonts",&freetype_engine::register_fonts)
|
||||||
|
.def("face_names",&freetype_engine::face_names)
|
||||||
|
.staticmethod("register_font")
|
||||||
|
.staticmethod("register_fonts")
|
||||||
|
.staticmethod("face_names")
|
||||||
|
;
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
|
@ -67,6 +67,7 @@ void export_view_transform();
|
||||||
void export_raster_colorizer();
|
void export_raster_colorizer();
|
||||||
void export_inmem_metawriter();
|
void export_inmem_metawriter();
|
||||||
void export_label_collision_detector();
|
void export_label_collision_detector();
|
||||||
|
void export_logger();
|
||||||
|
|
||||||
#include <mapnik/version.hpp>
|
#include <mapnik/version.hpp>
|
||||||
#include <mapnik/value_error.hpp>
|
#include <mapnik/value_error.hpp>
|
||||||
|
@ -386,6 +387,7 @@ BOOST_PYTHON_MODULE(_mapnik)
|
||||||
export_raster_colorizer();
|
export_raster_colorizer();
|
||||||
export_inmem_metawriter();
|
export_inmem_metawriter();
|
||||||
export_label_collision_detector();
|
export_label_collision_detector();
|
||||||
|
export_logger();
|
||||||
|
|
||||||
def("render_grid",&render_grid,
|
def("render_grid",&render_grid,
|
||||||
( arg("map"),
|
( arg("map"),
|
||||||
|
|
|
@ -88,7 +88,6 @@ public:
|
||||||
|
|
||||||
datasource (parameters const& params)
|
datasource (parameters const& params)
|
||||||
: params_(params),
|
: params_(params),
|
||||||
log_enabled_(false),
|
|
||||||
is_bound_(false)
|
is_bound_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -105,15 +104,6 @@ public:
|
||||||
return params_;
|
return params_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Get the status of detasource logging
|
|
||||||
* @return Return true if log is enabled, false otherwise
|
|
||||||
*/
|
|
||||||
bool log_enabled() const
|
|
||||||
{
|
|
||||||
return log_enabled_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Get the type of the datasource
|
* @brief Get the type of the datasource
|
||||||
* @return The type of the datasource (Vector or Raster)
|
* @return The type of the datasource (Vector or Raster)
|
||||||
|
@ -133,7 +123,6 @@ public:
|
||||||
virtual ~datasource() {}
|
virtual ~datasource() {}
|
||||||
protected:
|
protected:
|
||||||
parameters params_;
|
parameters params_;
|
||||||
bool log_enabled_;
|
|
||||||
mutable bool is_bound_;
|
mutable bool is_bound_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,16 @@
|
||||||
#define MAPNIK_DEBUG_AS_BOOL false
|
#define MAPNIK_DEBUG_AS_BOOL false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAPNIK_LOG_FORMAT
|
||||||
|
#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:"
|
||||||
|
#endif
|
||||||
|
|
||||||
// mapnik (should not depend on anything else)
|
// mapnik (should not depend on anything else)
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
|
#include <boost/utility.hpp>
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
#ifdef MAPNIK_THREADSAFE
|
#ifdef MAPNIK_THREADSAFE
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,15 +50,10 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
|
|
||||||
#ifndef MAPNIK_LOG_FORMAT
|
|
||||||
#error Must run configure again to regenerate the correct log format string. See LOG_FORMAT_STRING scons option.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
namespace logger {
|
namespace logger {
|
||||||
|
|
||||||
class severity
|
class severity
|
||||||
|
@ -68,22 +69,66 @@ namespace mapnik {
|
||||||
none
|
none
|
||||||
};
|
};
|
||||||
|
|
||||||
static type get() {
|
typedef boost::unordered_map<std::string, type> severity_map;
|
||||||
|
|
||||||
|
// globally get security level
|
||||||
|
static type get()
|
||||||
|
{
|
||||||
return severity_level_;
|
return severity_level_;
|
||||||
}
|
}
|
||||||
static void set(const type& severity_level) {
|
|
||||||
|
// globally set security level
|
||||||
|
static void set(const type& severity_level)
|
||||||
|
{
|
||||||
|
#ifdef MAPNIK_THREADSAFE
|
||||||
|
boost::mutex::scoped_lock lock(mutex_);
|
||||||
|
#endif
|
||||||
|
|
||||||
severity_level_ = severity_level;
|
severity_level_ = severity_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// per object get security level
|
||||||
|
static type get_object(const std::string& object_name)
|
||||||
|
{
|
||||||
|
severity_map::iterator it = object_severity_level_.find(object_name);
|
||||||
|
if (object_name.empty() || it == object_severity_level_.end())
|
||||||
|
{
|
||||||
|
return severity_level_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// per object set security level
|
||||||
|
static void set_object(const std::string& object_name,
|
||||||
|
const type& security_level)
|
||||||
|
{
|
||||||
|
#ifdef MAPNIK_THREADSAFE
|
||||||
|
boost::mutex::scoped_lock lock(mutex_);
|
||||||
|
#endif
|
||||||
|
if (! object_name.empty())
|
||||||
|
{
|
||||||
|
object_severity_level_[object_name] = security_level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static type severity_level_;
|
static type severity_level_;
|
||||||
|
static severity_map object_severity_level_;
|
||||||
|
|
||||||
|
#ifdef MAPNIK_THREADSAFE
|
||||||
|
static boost::mutex mutex_;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define __xstr__(s) __str__(s)
|
#define __xstr__(s) __str__(s)
|
||||||
#define __str__(s) #s
|
#define __str__(s) #s
|
||||||
|
|
||||||
static inline std::string format_logger() {
|
static inline std::string format_logger()
|
||||||
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
const time_t tm = time(0);
|
const time_t tm = time(0);
|
||||||
strftime(buf, sizeof(buf), __xstr__(MAPNIK_LOG_FORMAT), localtime(&tm));
|
strftime(buf, sizeof(buf), __xstr__(MAPNIK_LOG_FORMAT), localtime(&tm));
|
||||||
|
@ -94,29 +139,37 @@ namespace mapnik {
|
||||||
#undef __str__
|
#undef __str__
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
template<class Ch, class Tr, class A>
|
template<class Ch, class Tr, class A>
|
||||||
class no_output {
|
class no_output
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
struct null_buffer {
|
struct null_buffer
|
||||||
|
{
|
||||||
template<class T>
|
template<class T>
|
||||||
null_buffer &operator<<(const T &) {
|
null_buffer &operator<<(const T &)
|
||||||
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public:
|
|
||||||
typedef null_buffer stream_buffer;
|
typedef null_buffer stream_buffer;
|
||||||
public:
|
|
||||||
void operator()(const stream_buffer &) {
|
void operator()(const stream_buffer &)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
template<class Ch, class Tr, class A>
|
template<class Ch, class Tr, class A>
|
||||||
class output_to_clog {
|
class output_to_clog
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
|
typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
|
||||||
public:
|
|
||||||
void operator()(const stream_buffer &s) {
|
void operator()(const stream_buffer &s)
|
||||||
|
{
|
||||||
#ifdef MAPNIK_THREADSAFE
|
#ifdef MAPNIK_THREADSAFE
|
||||||
static boost::mutex mutex;
|
static boost::mutex mutex;
|
||||||
boost::mutex::scoped_lock lock(mutex);
|
boost::mutex::scoped_lock lock(mutex);
|
||||||
|
@ -131,45 +184,103 @@ namespace mapnik {
|
||||||
class Ch = char,
|
class Ch = char,
|
||||||
class Tr = std::char_traits<Ch>,
|
class Tr = std::char_traits<Ch>,
|
||||||
class A = std::allocator<Ch> >
|
class A = std::allocator<Ch> >
|
||||||
class base_log {
|
class base_log : public boost::noncopyable
|
||||||
|
{
|
||||||
|
public:
|
||||||
typedef OutputPolicy<Ch, Tr, A> output_policy;
|
typedef OutputPolicy<Ch, Tr, A> output_policy;
|
||||||
public:
|
|
||||||
~base_log() {
|
base_log() {}
|
||||||
if (Severity >= severity::get())
|
|
||||||
output_policy()(streambuf_);
|
base_log(const char* object_name)
|
||||||
|
{
|
||||||
|
if (object_name != NULL)
|
||||||
|
{
|
||||||
|
object_name_ = object_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
|
~base_log()
|
||||||
|
{
|
||||||
|
if (check_severity())
|
||||||
|
{
|
||||||
|
output_policy()(streambuf_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
base_log &operator<<(const T &x) {
|
base_log &operator<<(const T &x)
|
||||||
|
{
|
||||||
streambuf_ << x;
|
streambuf_ << x;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
inline bool check_severity()
|
||||||
|
{
|
||||||
|
return Severity >= severity::get_object(object_name_);
|
||||||
|
}
|
||||||
|
|
||||||
typename output_policy::stream_buffer streambuf_;
|
typename output_policy::stream_buffer streambuf_;
|
||||||
|
std::string object_name_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MAPNIK_DECL log : public logger::base_log<logger::output_to_clog,
|
class MAPNIK_DECL log : public logger::base_log<logger::output_to_clog,
|
||||||
logger::severity::debug> {};
|
logger::severity::debug> {
|
||||||
|
public:
|
||||||
|
typedef logger::base_log<logger::output_to_clog, logger::severity::debug> base_class;
|
||||||
|
log(const char* object_name) : base_class(object_name) {}
|
||||||
|
log() : base_class() {}
|
||||||
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL info : public logger::base_log<logger::output_to_clog,
|
class MAPNIK_DECL info : public logger::base_log<logger::output_to_clog,
|
||||||
logger::severity::info> {};
|
logger::severity::info> {
|
||||||
|
public:
|
||||||
|
typedef logger::base_log<logger::output_to_clog, logger::severity::info> base_class;
|
||||||
|
info(const char* object_name) : base_class(object_name) {}
|
||||||
|
info() : base_class() {}
|
||||||
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL debug : public logger::base_log<logger::output_to_clog,
|
class MAPNIK_DECL debug : public logger::base_log<logger::output_to_clog,
|
||||||
logger::severity::debug> {};
|
logger::severity::debug> {
|
||||||
|
public:
|
||||||
|
typedef logger::base_log<logger::output_to_clog, logger::severity::debug> base_class;
|
||||||
|
debug(const char* object_name) : base_class(object_name) {}
|
||||||
|
debug() : base_class() {}
|
||||||
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL warn : public logger::base_log<logger::output_to_clog,
|
class MAPNIK_DECL warn : public logger::base_log<logger::output_to_clog,
|
||||||
logger::severity::warn> {};
|
logger::severity::warn> {
|
||||||
|
public:
|
||||||
|
typedef logger::base_log<logger::output_to_clog, logger::severity::warn> base_class;
|
||||||
|
warn(const char* object_name) : base_class(object_name) {}
|
||||||
|
warn() : base_class() {}
|
||||||
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL error : public logger::base_log<logger::output_to_clog,
|
class MAPNIK_DECL error : public logger::base_log<logger::output_to_clog,
|
||||||
logger::severity::error> {};
|
logger::severity::error> {
|
||||||
|
public:
|
||||||
|
typedef logger::base_log<logger::output_to_clog, logger::severity::error> base_class;
|
||||||
|
error(const char* object_name) : base_class(object_name) {}
|
||||||
|
error() : base_class() {}
|
||||||
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL fatal : public logger::base_log<logger::output_to_clog,
|
class MAPNIK_DECL fatal : public logger::base_log<logger::output_to_clog,
|
||||||
logger::severity::fatal> {};
|
logger::severity::fatal> {
|
||||||
|
public:
|
||||||
|
typedef logger::base_log<logger::output_to_clog, logger::severity::fatal> base_class;
|
||||||
|
fatal(const char* object_name) : base_class(object_name) {}
|
||||||
|
fatal() : base_class() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define MAPNIK_LOG_INFO(s) mapnik::info(#s)
|
||||||
|
#define MAPNIK_LOG_DEBUG(s) mapnik::debug(#s)
|
||||||
|
#define MAPNIK_LOG_WARN(s) mapnik::warn(#s)
|
||||||
|
#define MAPNIK_LOG_ERROR(s) mapnik::error(#s)
|
||||||
|
#define MAPNIK_LOG_FATAL(s) mapnik::fatal(#s)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MAPNIK_LOG
|
|
||||||
|
|
||||||
#endif // MAPNIK_DEBUG_HPP
|
#endif // MAPNIK_DEBUG_HPP
|
||||||
|
|
|
@ -72,8 +72,6 @@ csv_datasource::csv_datasource(parameters const& params, bool bind)
|
||||||
filesize_max_(*params_.get<float>("filesize_max", 20.0)), // MB
|
filesize_max_(*params_.get<float>("filesize_max", 20.0)), // MB
|
||||||
ctx_(boost::make_shared<mapnik::context_type>())
|
ctx_(boost::make_shared<mapnik::context_type>())
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
general:
|
general:
|
||||||
- refactor parser into generic class
|
- refactor parser into generic class
|
||||||
|
@ -224,7 +222,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
sep = "\t";
|
sep = "\t";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "csv_datasource: auto detected tab separator";
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected tab separator";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +234,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
sep = "|";
|
sep = "|";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "csv_datasource: auto detected '|' separator";
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected '|' separator";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else // semicolons
|
else // semicolons
|
||||||
|
@ -247,7 +245,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
sep = ";";
|
sep = ";";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "csv_datasource: auto detected ';' separator";
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected ';' separator";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +264,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
if (quo.empty()) quo = "\"";
|
if (quo.empty()) quo = "\"";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "csv_datasource: csv grammer: sep: '" << sep << "' quo: '" << quo << "' esc: '" << esc;
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: csv grammer: sep: '" << sep << "' quo: '" << quo << "' esc: '" << esc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::escaped_list_separator<char> grammer;
|
boost::escaped_list_separator<char> grammer;
|
||||||
|
@ -433,7 +431,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
if ((row_limit_ > 0) && (line_number > row_limit_))
|
if ((row_limit_ > 0) && (line_number > row_limit_))
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "csv_datasource: row limit hit, exiting at feature: " << feature_count;
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: row limit hit, exiting at feature: " << feature_count;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +448,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
++line_number;
|
++line_number;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "csv_datasource: empty row encountered at line: " << line_number;
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: empty row encountered at line: " << line_number;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -555,8 +553,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,8 +577,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,8 +614,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -652,8 +647,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,8 +740,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,8 +773,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -832,8 +824,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,8 +839,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << ex.what();
|
||||||
if (!quiet_) std::cerr << ex.what() << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const std::exception & ex)
|
catch(const std::exception & ex)
|
||||||
|
@ -864,15 +854,13 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << s.str();
|
||||||
if (!quiet_) std::cerr << s.str() << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!feature_count > 0)
|
if (!feature_count > 0)
|
||||||
{
|
{
|
||||||
// TODO - handle this with mapnik::log
|
MAPNIK_LOG_ERROR(csv) << "CSV Plugin: could not parse any lines of data";
|
||||||
if (!quiet_) std::cerr << "CSV Plugin: could not parse any lines of data\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ using mapnik::datasource_exception;
|
||||||
inline GDALDataset* gdal_datasource::open_dataset() const
|
inline GDALDataset* gdal_datasource::open_dataset() const
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "gdal_datasource: Opening " << dataset_name_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Opening " << dataset_name_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GDALDataset *dataset;
|
GDALDataset *dataset;
|
||||||
|
@ -81,10 +81,8 @@ gdal_datasource::gdal_datasource(parameters const& params, bool bind)
|
||||||
filter_factor_(*params_.get<double>("filter_factor", 0.0)),
|
filter_factor_(*params_.get<double>("filter_factor", 0.0)),
|
||||||
nodata_value_(params_.get<double>("nodata"))
|
nodata_value_(params_.get<double>("nodata"))
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "gdal_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing...";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GDALAllRegister();
|
GDALAllRegister();
|
||||||
|
@ -131,7 +129,7 @@ void gdal_datasource::bind() const
|
||||||
if (bbox_s)
|
if (bbox_s)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "gdal_datasource: BBox Parameter=" << *bbox_s;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bbox_override = extent_.from_string(*bbox_s);
|
bbox_override = extent_.from_string(*bbox_s);
|
||||||
|
@ -156,12 +154,10 @@ void gdal_datasource::bind() const
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource Geotransform="
|
||||||
{
|
<< tr[0] << "," << tr[1] << ","
|
||||||
mapnik::log() << "gdal_datasource Geotransform=" << tr[0] << "," << tr[1] << ","
|
<< tr[2] << "," << tr[3] << ","
|
||||||
<< tr[2] << "," << tr[3] << ","
|
<< tr[4] << "," << tr[5];
|
||||||
<< tr[4] << "," << tr[5];
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO - We should throw for true non-north up images, but the check
|
// TODO - We should throw for true non-north up images, but the check
|
||||||
|
@ -198,11 +194,8 @@ void gdal_datasource::bind() const
|
||||||
GDALClose(dataset);
|
GDALClose(dataset);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Size=" << width_ << "," << height_;
|
||||||
{
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Extent=" << extent_;
|
||||||
mapnik::log() << "gdal_datasource: Raster Size=" << width_ << "," << height_;
|
|
||||||
mapnik::log() << "gdal_datasource: Raster Extent=" << extent_;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
is_bound_ = true;
|
is_bound_ = true;
|
||||||
|
|
|
@ -77,7 +77,7 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset,
|
||||||
gdal_featureset::~gdal_featureset()
|
gdal_featureset::~gdal_featureset()
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Closing Dataset=" << &dataset_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Closing Dataset=" << &dataset_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GDALClose(&dataset_);
|
GDALClose(&dataset_);
|
||||||
|
@ -90,7 +90,7 @@ feature_ptr gdal_featureset::next()
|
||||||
first_ = false;
|
first_ = false;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Next feature in Dataset=" << &dataset_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Next feature in Dataset=" << &dataset_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
query *q = boost::get<query>(&gquery_);
|
query *q = boost::get<query>(&gquery_);
|
||||||
|
@ -122,13 +122,13 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
GDALRasterBand * grey = 0;
|
GDALRasterBand * grey = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
#ifdef MAPNIK_DEBUG
|
||||||
double tr[6];
|
double tr[6];
|
||||||
dataset_.GetGeoTransform(tr);
|
dataset_.GetGeoTransform(tr);
|
||||||
|
|
||||||
double dx = tr[1];
|
const double dx = tr[1];
|
||||||
double dy = tr[5];
|
const double dy = tr[5];
|
||||||
#ifdef MAPNIK_DEBUG
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: dx_=" << dx_ << " dx=" << dx << " dy_=" << dy_ << "dy=" << dy;
|
||||||
mapnik::log() << "gdal_featureset: dx_=" << dx_ << " dx=" << dx << " dy_=" << dy_ << "dy=" << dy;
|
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -189,10 +189,10 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
intersect = t.backward(feature_raster_extent);
|
intersect = t.backward(feature_raster_extent);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Raster extent=" << raster_extent_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Raster extent=" << raster_extent_;
|
||||||
mapnik::log() << "gdal_featureset: View extent=" << intersect;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: View extent=" << intersect;
|
||||||
mapnik::log() << "gdal_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
||||||
mapnik::log() << boost::format("gdal_featureset: StartX=%d StartY=%d Width=%d Height=%d") % x_off % y_off % width % height;
|
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: StartX=%d StartY=%d Width=%d Height=%d") % x_off % y_off % width % height;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (width > 0 && height > 0)
|
||||||
|
@ -209,7 +209,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
im_height *= filter_factor_;
|
im_height *= filter_factor_;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Applying layer filter_factor=" << filter_factor_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// otherwise respect symbolizer level factor applied to query, default of 1.0
|
// otherwise respect symbolizer level factor applied to query, default of 1.0
|
||||||
|
@ -234,8 +234,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
image.set(0xffffffff);
|
image.set(0xffffffff);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Image Size=(" << im_width << "," << im_height << ")";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Image Size=(" << im_width << "," << im_height << ")";
|
||||||
mapnik::log() << "gdal_featureset: Reading band=" << band_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Reading band=" << band_;
|
||||||
#endif
|
#endif
|
||||||
typedef std::vector<int,int> pallete;
|
typedef std::vector<int,int> pallete;
|
||||||
|
|
||||||
|
@ -285,38 +285,38 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
case GCI_RedBand:
|
case GCI_RedBand:
|
||||||
red = band;
|
red = band;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found red band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found red band";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case GCI_GreenBand:
|
case GCI_GreenBand:
|
||||||
green = band;
|
green = band;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found green band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found green band";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case GCI_BlueBand:
|
case GCI_BlueBand:
|
||||||
blue = band;
|
blue = band;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found blue band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found blue band";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case GCI_AlphaBand:
|
case GCI_AlphaBand:
|
||||||
alpha = band;
|
alpha = band;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found alpha band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found alpha band";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case GCI_GrayIndex:
|
case GCI_GrayIndex:
|
||||||
grey = band;
|
grey = band;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found gray band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case GCI_PaletteIndex:
|
case GCI_PaletteIndex:
|
||||||
{
|
{
|
||||||
grey = band;
|
grey = band;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found gray band, and colortable...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band, and colortable...";
|
||||||
#endif
|
#endif
|
||||||
GDALColorTable *color_table = band->GetColorTable();
|
GDALColorTable *color_table = band->GetColorTable();
|
||||||
|
|
||||||
|
@ -324,14 +324,14 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
{
|
{
|
||||||
int count = color_table->GetColorEntryCount();
|
int count = color_table->GetColorEntryCount();
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Color Table count=" << count;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color Table count=" << count;
|
||||||
#endif
|
#endif
|
||||||
for (int j = 0; j < count; j++)
|
for (int j = 0; j < count; j++)
|
||||||
{
|
{
|
||||||
const GDALColorEntry *ce = color_table->GetColorEntry (j);
|
const GDALColorEntry *ce = color_table->GetColorEntry (j);
|
||||||
if (! ce) continue;
|
if (! ce) continue;
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Color entry RGB=" << ce->c1 << "," <<ce->c2 << "," << ce->c3;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color entry RGB=" << ce->c1 << "," <<ce->c2 << "," << ce->c3;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,13 +339,13 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
}
|
}
|
||||||
case GCI_Undefined:
|
case GCI_Undefined:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Found undefined band (assumming gray band)";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found undefined band (assumming gray band)";
|
||||||
#endif
|
#endif
|
||||||
grey = band;
|
grey = band;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Band type unknown!";
|
MAPNIK_LOG_WARN(gdal) << "gdal_featureset: Band type unknown!";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
if (red && green && blue)
|
if (red && green && blue)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Processing rgb bands...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing rgb bands...";
|
||||||
#endif
|
#endif
|
||||||
int hasNoData(0);
|
int hasNoData(0);
|
||||||
double nodata(0);
|
double nodata(0);
|
||||||
|
@ -407,7 +407,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
else if (grey)
|
else if (grey)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Processing gray band...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing gray band...";
|
||||||
#endif
|
#endif
|
||||||
int hasNoData(0);
|
int hasNoData(0);
|
||||||
double nodata(0);
|
double nodata(0);
|
||||||
|
@ -425,7 +425,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
if (hasNoData && ! color_table)
|
if (hasNoData && ! color_table)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: No data value for layer=" << nodata;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: No data value for layer=" << nodata;
|
||||||
#endif
|
#endif
|
||||||
feature->put("NODATA",nodata);
|
feature->put("NODATA",nodata);
|
||||||
// first read the data in and create an alpha channel from the nodata values
|
// first read the data in and create an alpha channel from the nodata values
|
||||||
|
@ -459,7 +459,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
if (color_table)
|
if (color_table)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: Loading colour table...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Loading colour table...";
|
||||||
#endif
|
#endif
|
||||||
unsigned nodata_value = static_cast<unsigned>(nodata);
|
unsigned nodata_value = static_cast<unsigned>(nodata);
|
||||||
if (hasNoData)
|
if (hasNoData)
|
||||||
|
@ -499,7 +499,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "gdal_featureset: processing alpha band...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: processing alpha band...";
|
||||||
#endif
|
#endif
|
||||||
alpha->RasterIO(GF_Read, x_off, y_off, width, height, image.getBytes() + 3,
|
alpha->RasterIO(GF_Read, x_off, y_off, width, height, image.getBytes() + 3,
|
||||||
image.width(), image.height(), GDT_Byte, 4, 4 * image.width());
|
image.width(), image.height(), GDT_Byte, 4, 4 * image.width());
|
||||||
|
@ -536,8 +536,8 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
|
||||||
if (x < raster_xsize && y < raster_ysize)
|
if (x < raster_xsize && y < raster_ysize)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << boost::format("gdal_featureset: pt.x=%f pt.y=%f") % pt.x % pt.y;
|
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: pt.x=%f pt.y=%f") % pt.x % pt.y;
|
||||||
mapnik::log() << boost::format("gdal_featureset: x=%f y=%f") % x % y;
|
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: x=%f y=%f") % x % y;
|
||||||
#endif
|
#endif
|
||||||
GDALRasterBand* band = dataset_.GetRasterBand(band_);
|
GDALRasterBand* band = dataset_.GetRasterBand(band_);
|
||||||
int hasNoData;
|
int hasNoData;
|
||||||
|
@ -566,18 +566,18 @@ void gdal_featureset::get_overview_meta(GDALRasterBand* band)
|
||||||
int band_overviews = band->GetOverviewCount();
|
int band_overviews = band->GetOverviewCount();
|
||||||
if (band_overviews > 0)
|
if (band_overviews > 0)
|
||||||
{
|
{
|
||||||
mapnik::log() << "gdal_featureset: " << band_overviews << " overviews found!";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: " << band_overviews << " overviews found!";
|
||||||
|
|
||||||
for (int b = 0; b < band_overviews; b++)
|
for (int b = 0; b < band_overviews; b++)
|
||||||
{
|
{
|
||||||
GDALRasterBand * overview = band->GetOverview(b);
|
GDALRasterBand * overview = band->GetOverview(b);
|
||||||
mapnik::log() << boost::format("gdal_featureset: Overview=%d Width=%d Height=%d")
|
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: Overview=%d Width=%d Height=%d")
|
||||||
% b % overview->GetXSize() % overview->GetYSize();
|
% b % overview->GetXSize() % overview->GetYSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapnik::log() << "gdal_featureset: No overviews found!";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: No overviews found!";
|
||||||
}
|
}
|
||||||
|
|
||||||
int bsx,bsy;
|
int bsx,bsy;
|
||||||
|
@ -585,7 +585,7 @@ void gdal_featureset::get_overview_meta(GDALRasterBand* band)
|
||||||
band->GetBlockSize(&bsx, &bsy);
|
band->GetBlockSize(&bsx, &bsy);
|
||||||
scale = band->GetScale();
|
scale = band->GetScale();
|
||||||
|
|
||||||
mapnik::log() << boost::format("gdal_featureset: Block=%dx%d Scale=%f Type=%s Color=%s") % bsx % bsy % scale
|
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: Block=%dx%d Scale=%f Type=%s Color=%s") % bsx % bsy % scale
|
||||||
% GDALGetDataTypeName(band->GetRasterDataType())
|
% GDALGetDataTypeName(band->GetRasterDataType())
|
||||||
% GDALGetColorInterpretationName(band->GetColorInterpretation());
|
% GDALGetColorInterpretationName(band->GetColorInterpretation());
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,15 @@ public:
|
||||||
boost::optional<double> const& nodata);
|
boost::optional<double> const& nodata);
|
||||||
virtual ~gdal_featureset();
|
virtual ~gdal_featureset();
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mapnik::feature_ptr get_feature(mapnik::query const& q);
|
mapnik::feature_ptr get_feature(mapnik::query const& q);
|
||||||
mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p);
|
mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
void get_overview_meta(GDALRasterBand * band);
|
void get_overview_meta(GDALRasterBand * band);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GDALDataset & dataset_;
|
GDALDataset & dataset_;
|
||||||
mapnik::context_ptr ctx_;
|
mapnik::context_ptr ctx_;
|
||||||
int band_;
|
int band_;
|
||||||
|
|
|
@ -100,8 +100,6 @@ geos_datasource::geos_datasource(parameters const& params, bool bind)
|
||||||
geometry_data_name_("name"),
|
geometry_data_name_("name"),
|
||||||
geometry_id_(1)
|
geometry_id_(1)
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
boost::optional<std::string> geometry = params.get<std::string>("wkt");
|
boost::optional<std::string> geometry = params.get<std::string>("wkt");
|
||||||
if (! geometry) throw datasource_exception("missing <wkt> parameter");
|
if (! geometry) throw datasource_exception("missing <wkt> parameter");
|
||||||
geometry_string_ = *geometry;
|
geometry_string_ = *geometry;
|
||||||
|
@ -162,7 +160,7 @@ void geos_datasource::bind() const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "geos_datasource: Initializing extent from geometry";
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Initializing extent from geometry";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (GEOSGeomTypeId(*geometry_) == GEOS_POINT)
|
if (GEOSGeomTypeId(*geometry_) == GEOS_POINT)
|
||||||
|
@ -185,12 +183,9 @@ void geos_datasource::bind() const
|
||||||
if (*envelope != NULL && GEOSisValid(*envelope))
|
if (*envelope != NULL && GEOSisValid(*envelope))
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
char* wkt = GEOSGeomToWKT(*envelope);
|
||||||
{
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Getting coord sequence from=" << wkt;
|
||||||
char* wkt = GEOSGeomToWKT(*envelope);
|
GEOSFree(wkt);
|
||||||
mapnik::log() << "geos_datasource: Getting coord sequence from=" << wkt;
|
|
||||||
GEOSFree(wkt);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const GEOSGeometry* exterior = GEOSGetExteriorRing(*envelope);
|
const GEOSGeometry* exterior = GEOSGetExteriorRing(*envelope);
|
||||||
|
@ -200,7 +195,7 @@ void geos_datasource::bind() const
|
||||||
if (cs != NULL)
|
if (cs != NULL)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "geos_datasource: Iterating boundary points";
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Iterating boundary points";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double x, y;
|
double x, y;
|
||||||
|
@ -319,7 +314,7 @@ featureset_ptr geos_datasource::features(query const& q) const
|
||||||
<< "))";
|
<< "))";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "geos_datasource: Using extent=" << s.str();
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using extent=" << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::make_shared<geos_featureset>(*geometry_,
|
return boost::make_shared<geos_featureset>(*geometry_,
|
||||||
|
@ -342,7 +337,7 @@ featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const
|
||||||
s << "POINT(" << pt.x << " " << pt.y << ")";
|
s << "POINT(" << pt.x << " " << pt.y << ")";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "geos_datasource: Using point=" << s.str();
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using point=" << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::make_shared<geos_featureset>(*geometry_,
|
return boost::make_shared<geos_featureset>(*geometry_,
|
||||||
|
|
|
@ -106,7 +106,7 @@ feature_ptr geos_featureset::next()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "geos_featureset: Unknown extent geometry_type=" << type;
|
MAPNIK_LOG_DEBUG(geos) << "geos_featureset: Unknown extent geometry_type=" << type;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,6 @@ kismet_datasource::kismet_datasource(parameters const& params, bool bind)
|
||||||
srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"),
|
srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"),
|
||||||
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
|
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
boost::optional<std::string> host = params_.get<std::string>("host");
|
boost::optional<std::string> host = params_.get<std::string>("host");
|
||||||
if (host)
|
if (host)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +157,7 @@ featureset_ptr kismet_datasource::features(query const& q) const
|
||||||
if (! is_bound_) bind();
|
if (! is_bound_) bind();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
// mapnik::log() << "kismet_datasource::features()";
|
// MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features()";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: use box2d to filter bbox before adding to featureset_ptr
|
// TODO: use box2d to filter bbox before adding to featureset_ptr
|
||||||
|
@ -179,7 +177,7 @@ featureset_ptr kismet_datasource::features_at_point(coord2d const& pt) const
|
||||||
if (! is_bound_) bind();
|
if (! is_bound_) bind();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
// mapnik::log() << "kismet_datasource::features_at_point()";
|
// MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features_at_point()";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return featureset_ptr();
|
return featureset_ptr();
|
||||||
|
@ -188,7 +186,7 @@ featureset_ptr kismet_datasource::features_at_point(coord2d const& pt) const
|
||||||
void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "kismet_datasource: Enter run";
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Enter run";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int sockfd, n;
|
int sockfd, n;
|
||||||
|
@ -209,7 +207,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
|
|
||||||
if (host == NULL)
|
if (host == NULL)
|
||||||
{
|
{
|
||||||
std::cerr << "Kismet Plugin: error while searching host" << std::endl;
|
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while searching host";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,13 +217,13 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
|
|
||||||
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Kismet Plugin: error while creating socket" << std::endl;
|
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while creating socket";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect(sockfd, (struct sockaddr*) &sock_addr, sizeof(sock_addr)))
|
if (connect(sockfd, (struct sockaddr*) &sock_addr, sizeof(sock_addr)))
|
||||||
{
|
{
|
||||||
std::cerr << "Kismet Plugin: Error while connecting" << std::endl;
|
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: Error while connecting";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +231,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
|
|
||||||
if (write(sockfd, command.c_str(), command.length()) != (signed)command.length())
|
if (write(sockfd, command.c_str(), command.length()) != (signed)command.length())
|
||||||
{
|
{
|
||||||
std::cerr << "Kismet Plugin: Error sending command to " << ip_host << std::endl;
|
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: Error sending command to " << ip_host;
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
return;
|
return;
|
||||||
|
@ -255,7 +253,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
std::string bufferObj(buffer); // TCP data send from kismet_server as STL string
|
std::string bufferObj(buffer); // TCP data send from kismet_server as STL string
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "kismet_datasource: buffer_obj=" << bufferObj;
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: buffer_obj=" << bufferObj;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string::size_type found = 0;
|
std::string::size_type found = 0;
|
||||||
|
@ -269,7 +267,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
kismet_line.assign(bufferObj, search_start, found - search_start);
|
kismet_line.assign(bufferObj, search_start, found - search_start);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "kismet_datasource: line=" << kismet_line;
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: line=" << kismet_line;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int param_number = 5; // the number of parameters to parse
|
int param_number = 5; // the number of parameters to parse
|
||||||
|
@ -284,11 +282,11 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
&bestlon) == param_number)
|
&bestlon) == param_number)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: ssid=" << ssid
|
||||||
{
|
<< ", bssid=" << bssid
|
||||||
mapnik::log() << "kismet_datasource: ssid=" << ssid << ", bssid=" << bssid
|
<< ", crypt=" << crypt
|
||||||
<< ", crypt=" << crypt << ", bestlat=" << bestlat << ", bestlon=" << bestlon;
|
<< ", bestlat=" << bestlat
|
||||||
}
|
<< ", bestlon=" << bestlon;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt);
|
kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt);
|
||||||
|
@ -316,13 +314,13 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Kismet Plugin: error while reading from socket" << std::endl;
|
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while reading from socket";
|
||||||
}
|
}
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "kismet_datasource: Exit run";
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Exit run";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#ifndef KISMET_DATASOURCE_HPP
|
#ifndef KISMET_DATASOURCE_HPP
|
||||||
#define KISMET_DATASOURCE_HPP
|
#define KISMET_DATASOURCE_HPP
|
||||||
|
|
||||||
// STL
|
// stl
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
|
|
@ -82,8 +82,6 @@ occi_datasource::occi_datasource(parameters const& params, bool bind)
|
||||||
pool_(0),
|
pool_(0),
|
||||||
conn_(0)
|
conn_(0)
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
if (! params_.get<std::string>("user")) throw datasource_exception("OCCI Plugin: no <user> specified");
|
if (! params_.get<std::string>("user")) throw datasource_exception("OCCI Plugin: no <user> specified");
|
||||||
if (! params_.get<std::string>("password")) throw datasource_exception("OCCI Plugin: no <password> specified");
|
if (! params_.get<std::string>("password")) throw datasource_exception("OCCI Plugin: no <password> specified");
|
||||||
if (! params_.get<std::string>("host")) throw datasource_exception("OCCI Plugin: no <host> string specified");
|
if (! params_.get<std::string>("host")) throw datasource_exception("OCCI Plugin: no <host> string specified");
|
||||||
|
@ -206,7 +204,7 @@ void occi_datasource::bind() const
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -246,7 +244,7 @@ void occi_datasource::bind() const
|
||||||
s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE rownum < 1";
|
s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE rownum < 1";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -338,21 +336,15 @@ void occi_datasource::bind() const
|
||||||
case oracle::occi::OCCI_SQLT_BLOB:
|
case oracle::occi::OCCI_SQLT_BLOB:
|
||||||
case oracle::occi::OCCI_SQLT_RSET:
|
case oracle::occi::OCCI_SQLT_RSET:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Unsupported datatype "
|
||||||
{
|
<< occi_enums::resolve_datatype(type_oid)
|
||||||
mapnik::log() << "occi_datasource: Unsupported datatype "
|
<< " (type_oid=" << type_oid << ")";
|
||||||
<< occi_enums::resolve_datatype(type_oid)
|
|
||||||
<< " (type_oid=" << type_oid << ")";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Unknown datatype "
|
||||||
{
|
<< "(type_oid=" << type_oid << ")";
|
||||||
mapnik::log() << "occi_datasource: Unknown datatype "
|
|
||||||
<< "(type_oid=" << type_oid << ")";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -400,7 +392,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c";
|
s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -423,7 +415,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (bad_lexical_cast& ex)
|
catch (bad_lexical_cast& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "OCCI Plugin: " << ex.what() << std::endl;
|
MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,7 +440,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name_ << "') AND dim.sdo_dimname = 'Y'";
|
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name_ << "') AND dim.sdo_dimname = 'Y'";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -469,7 +461,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (bad_lexical_cast& ex)
|
catch (bad_lexical_cast& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "OCCI Plugin: " << ex.what() << std::endl;
|
MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +474,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (bad_lexical_cast& ex)
|
catch (bad_lexical_cast& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "OCCI Plugin: " << ex.what() << std::endl;
|
MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,9 +566,7 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: cannot determine where to add the spatial filter declaration";
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: cannot determine where to add the spatial filter declaration";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,16 +584,14 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Cannot determine where to add the row limit declaration";
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: Cannot determine where to add the row limit declaration";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s << query;
|
s << query;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::make_shared<occi_featureset>(pool_,
|
return boost::make_shared<occi_featureset>(pool_,
|
||||||
|
@ -668,9 +656,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Cannot determine where to add the spatial filter declaration";
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: Cannot determine where to add the spatial filter declaration";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,16 +674,14 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Cannot determine where to add the row limit declaration";
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: Cannot determine where to add the row limit declaration";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s << query;
|
s << query;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::make_shared<occi_featureset>(pool_,
|
return boost::make_shared<occi_featureset>(pool_,
|
||||||
|
|
|
@ -84,7 +84,7 @@ occi_featureset::occi_featureset(StatelessConnectionPool* pool,
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
std::cerr << "OCCI Plugin: error processing " << sqlstring << " : " << ex.getMessage() << std::endl;
|
MAPNIK_LOG_ERROR(occi) << "OCCI Plugin: error processing " << sqlstring << " : " << ex.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,17 +206,17 @@ feature_ptr occi_featureset::next()
|
||||||
case oracle::occi::OCCI_SQLT_RSET:
|
case oracle::occi::OCCI_SQLT_RSET:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "occi_featureset: Unsupported datatype "
|
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unsupported datatype "
|
||||||
<< occi_enums::resolve_datatype(type_oid)
|
<< occi_enums::resolve_datatype(type_oid)
|
||||||
<< " (type_oid=" << type_oid << ")";
|
<< " (type_oid=" << type_oid << ")";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: // shouldn't get here
|
default: // shouldn't get here
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "occi_featureset: Unknown datatype "
|
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown datatype "
|
||||||
<< "(type_oid=" << type_oid << ")";
|
<< "(type_oid=" << type_oid << ")";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -360,9 +360,9 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "occi_featureset: Unknown oracle enum "
|
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown oracle enum "
|
||||||
<< occi_enums::resolve_gtype(geomtype)
|
<< occi_enums::resolve_gtype(geomtype)
|
||||||
<< "(gtype=" << gtype << ")";
|
<< "(gtype=" << gtype << ")";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
if (env_ == 0)
|
if (env_ == 0)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "occi_environment: constructor";
|
MAPNIK_LOG_DEBUG(occi) << "occi_environment: constructor";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int mode = oracle::occi::Environment::OBJECT
|
const int mode = oracle::occi::Environment::OBJECT
|
||||||
|
@ -113,7 +113,7 @@ private:
|
||||||
if (env_)
|
if (env_)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "occi_environment: destructor";
|
MAPNIK_LOG_DEBUG(occi) << "occi_environment: destructor";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oracle::occi::Environment::terminateEnvironment(env_);
|
oracle::occi::Environment::terminateEnvironment(env_);
|
||||||
|
@ -164,6 +164,10 @@ public:
|
||||||
{
|
{
|
||||||
close_query(false);
|
close_query(false);
|
||||||
|
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
|
MAPNIK_LOG_DEBUG(occi) << "occi_connection_ptr: " << s;
|
||||||
|
#endif
|
||||||
|
|
||||||
stmt_ = conn_->createStatement(s);
|
stmt_ = conn_->createStatement(s);
|
||||||
|
|
||||||
if (prefetch > 0)
|
if (prefetch > 0)
|
||||||
|
|
|
@ -71,8 +71,8 @@ void ogr_converter::convert_geometry(OGRGeometry* geom, feature_ptr feature)
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_converter: unknown <ogr> geometry_type="
|
MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown <ogr> geometry_type="
|
||||||
<< wkbFlatten(geom->getGeometryType());
|
<< wkbFlatten(geom->getGeometryType());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -65,8 +65,6 @@ ogr_datasource::ogr_datasource(parameters const& params, bool bind)
|
||||||
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
|
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
|
||||||
indexed_(false)
|
indexed_(false)
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
boost::optional<std::string> string = params.get<std::string>("string");
|
boost::optional<std::string> string = params.get<std::string>("string");
|
||||||
if (! file && ! string)
|
if (! file && ! string)
|
||||||
|
@ -276,11 +274,8 @@ void ogr_datasource::bind() const
|
||||||
// TODO - enable this warning once the ogrindex tool is a bit more stable/mature
|
// TODO - enable this warning once the ogrindex tool is a bit more stable/mature
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_datasource: no ogrindex file found for " << dataset_name_
|
||||||
{
|
<< ", use the 'ogrindex' program to build an index for faster rendering";
|
||||||
mapnik::log() << "ogr_datasource: no ogrindex file found for " << dataset_name_
|
|
||||||
<< ", use the 'ogrindex' program to build an index for faster rendering";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // MAPNIK_LOG
|
#endif // MAPNIK_LOG
|
||||||
|
@ -325,7 +320,7 @@ void ogr_datasource::bind() const
|
||||||
case OFTStringList:
|
case OFTStringList:
|
||||||
case OFTWideStringList: // deprecated !
|
case OFTWideStringList: // deprecated !
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -333,7 +328,7 @@ void ogr_datasource::bind() const
|
||||||
case OFTTime:
|
case OFTTime:
|
||||||
case OFTDateTime: // unhandled !
|
case OFTDateTime: // unhandled !
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Object));
|
desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Object));
|
||||||
break;
|
break;
|
||||||
|
@ -514,8 +509,7 @@ featureset_ptr ogr_datasource::features(query const& q) const
|
||||||
*layer,
|
*layer,
|
||||||
filter,
|
filter,
|
||||||
index_name_,
|
index_name_,
|
||||||
desc_.get_encoding()
|
desc_.get_encoding()));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -523,8 +517,7 @@ featureset_ptr ogr_datasource::features(query const& q) const
|
||||||
*dataset_,
|
*dataset_,
|
||||||
*layer,
|
*layer,
|
||||||
q.get_bbox(),
|
q.get_bbox(),
|
||||||
desc_.get_encoding()
|
desc_.get_encoding()));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ feature_ptr ogr_featureset::next()
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapnik::log() << "ogr_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
++count_;
|
++count_;
|
||||||
|
@ -146,7 +146,7 @@ feature_ptr ogr_featureset::next()
|
||||||
case OFTWideStringList: // deprecated !
|
case OFTWideStringList: // deprecated !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ feature_ptr ogr_featureset::next()
|
||||||
case OFTBinary:
|
case OFTBinary:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
||||||
break;
|
break;
|
||||||
|
@ -165,7 +165,7 @@ feature_ptr ogr_featureset::next()
|
||||||
case OFTDateTime: // unhandled !
|
case OFTDateTime: // unhandled !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ feature_ptr ogr_featureset::next()
|
||||||
default: // unknown
|
default: // unknown
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_featureset: Unknown type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unknown type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ feature_ptr ogr_featureset::next()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_featureset: " << count_ << " features";
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: " << count_ << " features";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
|
|
|
@ -23,9 +23,10 @@
|
||||||
#ifndef OGR_INDEX_HH
|
#ifndef OGR_INDEX_HH
|
||||||
#define OGR_INDEX_HH
|
#define OGR_INDEX_HH
|
||||||
|
|
||||||
// st
|
// stl
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/box2d.hpp>
|
#include <mapnik/box2d.hpp>
|
||||||
#include <mapnik/query.hpp>
|
#include <mapnik/query.hpp>
|
||||||
|
|
|
@ -77,7 +77,7 @@ ogr_index_featureset<filterT>::ogr_index_featureset(mapnik::context_ptr const &
|
||||||
std::sort(ids_.begin(),ids_.end());
|
std::sort(ids_.begin(),ids_.end());
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_index_featureset: Query size=" << ids_.size();
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Query size=" << ids_.size();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
itr_ = ids_.begin();
|
itr_ = ids_.begin();
|
||||||
|
@ -113,7 +113,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapnik::log() << "ogr_index_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
case OFTWideStringList: // deprecated !
|
case OFTWideStringList: // deprecated !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
case OFTBinary:
|
case OFTBinary:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
||||||
break;
|
break;
|
||||||
|
@ -171,7 +171,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
case OFTDateTime: // unhandled !
|
case OFTDateTime: // unhandled !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ private:
|
||||||
std::vector<int>::iterator itr_;
|
std::vector<int>::iterator itr_;
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
const char* fidcolumn_;
|
const char* fidcolumn_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OGR_INDEX_FEATURESET_HPP
|
#endif // OGR_INDEX_FEATURESET_HPP
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
is_valid_ = true;
|
is_valid_ = true;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_layer_ptr: layer_from_name layer=" << layer_name_;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_name layer=" << layer_name_;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
is_valid_ = true;
|
is_valid_ = true;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_layer_ptr: layer_from_index layer=" << layer_name_;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_index layer=" << layer_name_;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
is_valid_ = true;
|
is_valid_ = true;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "ogr_layer_ptr: layer_from_sql layer=" << layer_name_;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_sql layer=" << layer_name_;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,11 +177,11 @@ private:
|
||||||
const std::string err = CPLGetLastErrorMsg();
|
const std::string err = CPLGetLastErrorMsg();
|
||||||
if (err.size() == 0)
|
if (err.size() == 0)
|
||||||
{
|
{
|
||||||
mapnik::log() << "ogr_layer_ptr: Error getting layer";
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: Error getting layer";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapnik::log() << "ogr_layer_ptr: " << err;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: " << err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ osm_dataset* dataset_deliverer::load_from_url(const string& url, const string& b
|
||||||
else if (bbox != last_bbox)
|
else if (bbox != last_bbox)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset_deliverer: BBoxes are different=" << last_bbox << "," << bbox;
|
MAPNIK_LOG_WARN(osm) << "osm_dataset_deliverer: BBoxes are different=" << last_bbox << "," << bbox;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Reload the dataset
|
// Reload the dataset
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool osm_dataset::load_from_url(const std::string& url,
|
||||||
if (parser == "libxml2")
|
if (parser == "libxml2")
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: load_from_url url=" << url << ",bbox=" << bbox;
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: load_from_url url=" << url << ",bbox=" << bbox;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
|
@ -60,7 +60,7 @@ bool osm_dataset::load_from_url(const std::string& url,
|
||||||
str << url << "?bbox=" << bbox;
|
str << url << "?bbox=" << bbox;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: Full url=" << str.str();
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Full url=" << str.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CURL_LOAD_DATA* resp = grab_http_response(str.str().c_str());
|
CURL_LOAD_DATA* resp = grab_http_response(str.str().c_str());
|
||||||
|
@ -72,7 +72,7 @@ bool osm_dataset::load_from_url(const std::string& url,
|
||||||
blx[resp->nbytes] = '\0';
|
blx[resp->nbytes] = '\0';
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: CURL Response=" << blx;
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: CURL Response=" << blx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete[] blx;
|
delete[] blx;
|
||||||
|
@ -91,11 +91,11 @@ osm_dataset::~osm_dataset()
|
||||||
void osm_dataset::clear()
|
void osm_dataset::clear()
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: Clear";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: -- Deleting ways";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting ways";
|
||||||
#endif
|
#endif
|
||||||
for (unsigned int count = 0; count < ways.size(); ++count)
|
for (unsigned int count = 0; count < ways.size(); ++count)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ void osm_dataset::clear()
|
||||||
ways.clear();
|
ways.clear();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: -- Deleting nodes";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting nodes";
|
||||||
#endif
|
#endif
|
||||||
for (unsigned int count = 0; count < nodes.size(); ++count)
|
for (unsigned int count = 0; count < nodes.size(); ++count)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ void osm_dataset::clear()
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "osm_dataset: Clear done";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear done";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,14 +84,6 @@ struct osm_way : public osm_item
|
||||||
|
|
||||||
class osm_dataset
|
class osm_dataset
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
int next_item_mode;
|
|
||||||
enum { Node, Way };
|
|
||||||
std::vector<osm_node*>::iterator node_i;
|
|
||||||
std::vector<osm_way*>::iterator way_i;
|
|
||||||
std::vector<osm_node*> nodes;
|
|
||||||
std::vector<osm_way*> ways;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
osm_dataset()
|
osm_dataset()
|
||||||
{
|
{
|
||||||
|
@ -128,6 +120,14 @@ public:
|
||||||
osm_item * next_item();
|
osm_item * next_item();
|
||||||
bool current_item_is_node() { return next_item_mode == Node; }
|
bool current_item_is_node() { return next_item_mode == Node; }
|
||||||
bool current_item_is_way() { return next_item_mode == Way; }
|
bool current_item_is_way() { return next_item_mode == Way; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int next_item_mode;
|
||||||
|
enum { Node, Way };
|
||||||
|
std::vector<osm_node*>::iterator node_i;
|
||||||
|
std::vector<osm_way*>::iterator way_i;
|
||||||
|
std::vector<osm_node*> nodes;
|
||||||
|
std::vector<osm_way*> ways;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OSM_H
|
#endif // OSM_H
|
||||||
|
|
|
@ -58,8 +58,6 @@ osm_datasource::osm_datasource(const parameters& params, bool bind)
|
||||||
type_(datasource::Vector),
|
type_(datasource::Vector),
|
||||||
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8"))
|
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8"))
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
if (bind)
|
if (bind)
|
||||||
{
|
{
|
||||||
this->bind();
|
this->bind();
|
||||||
|
@ -82,7 +80,7 @@ void osm_datasource::bind() const
|
||||||
{
|
{
|
||||||
// if we supplied a url and a bounding box, load from the url
|
// if we supplied a url and a bounding box, load from the url
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "osm_datasource: loading_from_url url=" << url << ",bbox=" << bbox;
|
MAPNIK_LOG_DEBUG(osm) << "osm_datasource: loading_from_url url=" << url << ",bbox=" << bbox;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((osm_data_ = dataset_deliverer::load_from_url(url, bbox, parser)) == NULL)
|
if ((osm_data_ = dataset_deliverer::load_from_url(url, bbox, parser)) == NULL)
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
std::string const& encoding);
|
std::string const& encoding);
|
||||||
virtual ~osm_featureset();
|
virtual ~osm_featureset();
|
||||||
feature_ptr next();
|
feature_ptr next();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
filterT filter_;
|
filterT filter_;
|
||||||
box2d<double> query_ext_;
|
box2d<double> query_ext_;
|
||||||
|
@ -64,7 +65,7 @@ private:
|
||||||
osm_dataset *dataset_;
|
osm_dataset *dataset_;
|
||||||
std::set<std::string> attribute_names_;
|
std::set<std::string> attribute_names_;
|
||||||
mapnik::context_ptr ctx_;
|
mapnik::context_ptr ctx_;
|
||||||
// no copying
|
|
||||||
osm_featureset(const osm_featureset&);
|
osm_featureset(const osm_featureset&);
|
||||||
const osm_featureset& operator=(const osm_featureset&);
|
const osm_featureset& operator=(const osm_featureset&);
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
using std::cerr;
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
|
||||||
osm_item* osmparser::cur_item=NULL;
|
osm_item* osmparser::cur_item=NULL;
|
||||||
long osmparser::curID=0;
|
long osmparser::curID=0;
|
||||||
bool osmparser::in_node=false, osmparser::in_way=false;
|
bool osmparser::in_node=false, osmparser::in_way=false;
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
PQfinish(conn_);
|
PQfinish(conn_);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "postgis_connection: postgresql connection closed - " << conn_;
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: postgresql connection closed - " << conn_;
|
||||||
#endif
|
#endif
|
||||||
closed_ = true;
|
closed_ = true;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public:
|
||||||
PQfinish(conn_);
|
PQfinish(conn_);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "postgis_connection: datasource closed, also closing connection - " << conn_;
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: datasource closed, also closing connection - " << conn_;
|
||||||
#endif
|
#endif
|
||||||
closed_ = true;
|
closed_ = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
s << "CLOSE " << cursorName_;
|
s << "CLOSE " << cursorName_;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "postgis_cursor_resultset: " << s.str();
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
conn_->execute(s.str());
|
conn_->execute(s.str());
|
||||||
is_closed_ = true;
|
is_closed_ = true;
|
||||||
|
@ -160,13 +160,13 @@ private:
|
||||||
s << "FETCH FORWARD " << fetch_size_ << " FROM " << cursorName_;
|
s << "FETCH FORWARD " << fetch_size_ << " FROM " << cursorName_;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "postgis_cursor_resultset: " << s.str();
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
rs_ = conn_->executeQuery(s.str());
|
rs_ = conn_->executeQuery(s.str());
|
||||||
is_closed_ = false;
|
is_closed_ = false;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "postgis_cursor_resultset: FETCH result (" << cursorName_ << "): " << rs_->size() << " rows";
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: FETCH result (" << cursorName_ << "): " << rs_->size() << " rows";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,6 @@ postgis_datasource::postgis_datasource(parameters const& params, bool bind)
|
||||||
intersect_min_scale_(*params_.get<int>("intersect_min_scale", 0)),
|
intersect_min_scale_(*params_.get<int>("intersect_min_scale", 0)),
|
||||||
intersect_max_scale_(*params_.get<int>("intersect_max_scale", 0))
|
intersect_max_scale_(*params_.get<int>("intersect_max_scale", 0))
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
if (table_.empty())
|
if (table_.empty())
|
||||||
{
|
{
|
||||||
throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
|
throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
|
||||||
|
@ -267,12 +265,9 @@ void postgis_datasource::bind() const
|
||||||
if (key_field_string)
|
if (key_field_string)
|
||||||
{
|
{
|
||||||
key_field_ = std::string(key_field_string);
|
key_field_ = std::string(key_field_string);
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: auto-detected key field of '"
|
||||||
{
|
<< key_field_ << "' on table '" << geometry_table_ << "'";
|
||||||
mapnik::log() << "postgis_datasource: auto-detected key field of '"
|
|
||||||
<< key_field_ << "' on table '" << geometry_table_ << "'";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,18 +309,15 @@ void postgis_datasource::bind() const
|
||||||
srid_ = -1;
|
srid_ = -1;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "postgis_datasource: Table " << table_ << " is using SRID=-1";
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Table " << table_ << " is using SRID=-1";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point the geometry_field may still not be known
|
// At this point the geometry_field may still not be known
|
||||||
// but we'll catch that where more useful...
|
// but we'll catch that where more useful...
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using SRID=" << srid_;
|
||||||
{
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using geometry_column=" << geometryColumn_;
|
||||||
mapnik::log() << "postgis_datasource: Using SRID=" << srid_;
|
|
||||||
mapnik::log() << "postgis_datasource: Using geometry_column=" << geometryColumn_;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// collect attribute desc
|
// collect attribute desc
|
||||||
|
@ -402,23 +394,20 @@ void postgis_datasource::bind() const
|
||||||
break;
|
break;
|
||||||
default: // should not get here
|
default: // should not get here
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
s.str("");
|
||||||
{
|
s << "SELECT oid, typname FROM pg_type WHERE oid = " << type_oid;
|
||||||
s.str("");
|
|
||||||
s << "SELECT oid, typname FROM pg_type WHERE oid = " << type_oid;
|
|
||||||
|
|
||||||
shared_ptr<ResultSet> rs_oid = conn->executeQuery(s.str());
|
shared_ptr<ResultSet> rs_oid = conn->executeQuery(s.str());
|
||||||
if (rs_oid->next())
|
if (rs_oid->next())
|
||||||
{
|
{
|
||||||
mapnik::log() << "postgis_datasource: Unknown type=" << rs_oid->getValue("typname")
|
MAPNIK_LOG_WARN(postgis) << "postgis_datasource: Unknown type=" << rs_oid->getValue("typname")
|
||||||
<< " (oid:" << rs_oid->getValue("oid") << ")";
|
<< " (oid:" << rs_oid->getValue("oid") << ")";
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mapnik::log() << "postgis_datasource: Unknown type_oid=" << type_oid;
|
|
||||||
}
|
|
||||||
rs_oid->close();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MAPNIK_LOG_WARN(postgis) << "postgis_datasource: Unknown type_oid=" << type_oid;
|
||||||
|
}
|
||||||
|
rs_oid->close();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -573,7 +562,6 @@ boost::shared_ptr<IResultSet> postgis_datasource::get_resultset(boost::shared_pt
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no cursor
|
// no cursor
|
||||||
|
|
||||||
return conn->executeQuery(sql, 1);
|
return conn->executeQuery(sql, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -859,7 +847,7 @@ box2d<double> postgis_datasource::envelope() const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << boost::format("Mapnik LOG> postgis_datasource: Could not determine extent from query: %s") % s.str();
|
MAPNIK_LOG_DEBUG(postgis) << boost::format("postgis_datasource: Could not determine extent from query: %s") % s.str();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@ private:
|
||||||
// params below are for testing purposes only (will likely be removed at any time)
|
// params below are for testing purposes only (will likely be removed at any time)
|
||||||
int intersect_min_scale_;
|
int intersect_min_scale_;
|
||||||
int intersect_max_scale_;
|
int intersect_max_scale_;
|
||||||
//bool show_queries_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // POSTGIS_DATASOURCE_HPP
|
#endif // POSTGIS_DATASOURCE_HPP
|
||||||
|
|
|
@ -199,7 +199,7 @@ feature_ptr postgis_featureset::next()
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "postgis_featureset: Uknown type_oid=" << oid;
|
MAPNIK_LOG_WARN(postgis) << "postgis_featureset: Uknown type_oid=" << oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,8 @@ raster_datasource::raster_datasource(const parameters& params, bool bind)
|
||||||
desc_(*params.get<std::string>("type"), "utf-8"),
|
desc_(*params.get<std::string>("type"), "utf-8"),
|
||||||
extent_initialized_(false)
|
extent_initialized_(false)
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing...";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
|
@ -153,7 +151,7 @@ void raster_datasource::bind() const
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: Raster size=" << width_ << "," << height_;
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Raster size=" << width_ << "," << height_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
is_bound_ = true;
|
is_bound_ = true;
|
||||||
|
@ -200,13 +198,13 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5);
|
const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: Box size=" << width << "," << height;
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Box size=" << width << "," << height;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (multi_tiles_)
|
if (multi_tiles_)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: Multi-Tiled policy";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Multi-Tiled policy";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_);
|
tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_);
|
||||||
|
@ -216,7 +214,7 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
else if (width * height > 512*512)
|
else if (width * height > 512*512)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: Tiled policy";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Tiled policy";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_);
|
tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_);
|
||||||
|
@ -226,7 +224,7 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: Single file";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Single file";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
raster_info info(filename_, format_, extent_, width_, height_);
|
raster_info info(filename_, format_, extent_, width_, height_);
|
||||||
|
@ -239,7 +237,7 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
featureset_ptr raster_datasource::features_at_point(coord2d const&) const
|
featureset_ptr raster_datasource::features_at_point(coord2d const&) const
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "raster_datasource: feature_at_point not supported";
|
MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return featureset_ptr();
|
return featureset_ptr();
|
||||||
|
|
|
@ -71,8 +71,8 @@ feature_ptr raster_featureset<LookupPolicy>::next()
|
||||||
std::auto_ptr<image_reader> reader(mapnik::get_image_reader(curIter_->file(),curIter_->format()));
|
std::auto_ptr<image_reader> reader(mapnik::get_image_reader(curIter_->file(),curIter_->format()));
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "raster_featureset: Reader=" << curIter_->format() << "," << curIter_->file()
|
MAPNIK_LOG_DEBUG(raster) << "raster_featureset: Reader=" << curIter_->format() << "," << curIter_->file()
|
||||||
<< ",size(" << curIter_->width() << "," << curIter_->height() << ")";
|
<< ",size(" << curIter_->width() << "," << curIter_->height() << ")";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (reader.get())
|
if (reader.get())
|
||||||
|
@ -122,15 +122,15 @@ feature_ptr raster_featureset<LookupPolicy>::next()
|
||||||
}
|
}
|
||||||
catch (mapnik::image_reader_exception const& ex)
|
catch (mapnik::image_reader_exception const& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "Raster Plugin: image reader exception caught: " << ex.what() << std::endl;
|
MAPNIK_LOG_ERROR(raster) << "Raster Plugin: image reader exception caught: " << ex.what();
|
||||||
}
|
}
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "Raster Plugin: " << ex.what() << std::endl;
|
MAPNIK_LOG_ERROR(raster) << "Raster Plugin: " << ex.what();
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << "Raster Plugin: exception caught" << std::endl;
|
MAPNIK_LOG_ERROR(raster) << "Raster Plugin: exception caught";
|
||||||
}
|
}
|
||||||
|
|
||||||
++curIter_;
|
++curIter_;
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
double pixel_y = extent.height() / double(height);
|
double pixel_y = extent.height() / double(height);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "tiled_file_policy: Raster Plugin PIXEL SIZE("<< pixel_x << "," << pixel_y << ")";
|
MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin PIXEL SIZE("<< pixel_x << "," << pixel_y << ")";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
box2d<double> e = bbox.intersect(extent);
|
box2d<double> e = bbox.intersect(extent);
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "tiled_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file;
|
MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public:
|
||||||
double pixel_y = extent.height() / double(height);
|
double pixel_y = extent.height() / double(height);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "tiled_multi_file_policy: Raster Plugin PIXEL SIZE(" << pixel_x << "," << pixel_y << ")";
|
MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin PIXEL SIZE(" << pixel_x << "," << pixel_y << ")";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// intersection of query with extent => new query
|
// intersection of query with extent => new query
|
||||||
|
@ -262,7 +262,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "tiled_multi_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file_pattern;
|
MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file_pattern;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,6 +313,15 @@ template <typename LookupPolicy>
|
||||||
class raster_featureset : public mapnik::Featureset
|
class raster_featureset : public mapnik::Featureset
|
||||||
{
|
{
|
||||||
typedef typename LookupPolicy::const_iterator iterator_type;
|
typedef typename LookupPolicy::const_iterator iterator_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
raster_featureset(LookupPolicy const& policy,
|
||||||
|
box2d<double> const& exttent,
|
||||||
|
mapnik::query const& q);
|
||||||
|
virtual ~raster_featureset();
|
||||||
|
mapnik::feature_ptr next();
|
||||||
|
|
||||||
|
private:
|
||||||
LookupPolicy policy_;
|
LookupPolicy policy_;
|
||||||
int feature_id_;
|
int feature_id_;
|
||||||
mapnik::context_ptr ctx_;
|
mapnik::context_ptr ctx_;
|
||||||
|
@ -320,10 +329,6 @@ class raster_featureset : public mapnik::Featureset
|
||||||
mapnik::box2d<double> bbox_;
|
mapnik::box2d<double> bbox_;
|
||||||
iterator_type curIter_;
|
iterator_type curIter_;
|
||||||
iterator_type endIter_;
|
iterator_type endIter_;
|
||||||
public:
|
|
||||||
raster_featureset(LookupPolicy const& policy,box2d<double> const& exttent, mapnik::query const& q);
|
|
||||||
virtual ~raster_featureset();
|
|
||||||
mapnik::feature_ptr next();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RASTER_FEATURESET_HPP
|
#endif // RASTER_FEATURESET_HPP
|
||||||
|
|
|
@ -49,11 +49,14 @@ using mapnik::datasource_exception;
|
||||||
* Opens a GDALDataset and returns a pointer to it.
|
* Opens a GDALDataset and returns a pointer to it.
|
||||||
* Caller is responsible for calling GDALClose on it
|
* Caller is responsible for calling GDALClose on it
|
||||||
*/
|
*/
|
||||||
inline void *rasterlite_datasource::open_dataset() const
|
inline void* rasterlite_datasource::open_dataset() const
|
||||||
{
|
{
|
||||||
void *dataset = rasterliteOpen (dataset_name_.c_str(), table_name_.c_str());
|
void* dataset = rasterliteOpen (dataset_name_.c_str(), table_name_.c_str());
|
||||||
|
|
||||||
if (! dataset) throw datasource_exception("Rasterlite Plugin: Error opening dataset");
|
if (! dataset)
|
||||||
|
{
|
||||||
|
throw datasource_exception("Rasterlite Plugin: Error opening dataset");
|
||||||
|
}
|
||||||
|
|
||||||
if (rasterliteIsError (dataset))
|
if (rasterliteIsError (dataset))
|
||||||
{
|
{
|
||||||
|
@ -68,15 +71,12 @@ inline void *rasterlite_datasource::open_dataset() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind)
|
rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind)
|
||||||
: datasource(params),
|
: datasource(params),
|
||||||
desc_(*params.get<std::string>("type"),"utf-8")
|
desc_(*params.get<std::string>("type"),"utf-8")
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "rasterlite_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Initializing...";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
|
@ -120,42 +120,41 @@ void rasterlite_datasource::bind() const
|
||||||
extent_.init(x0,y0,x1,y1);
|
extent_.init(x0,y0,x1,y1);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
int srid, auth_srid;
|
||||||
|
const char *auth_name;
|
||||||
|
const char *ref_sys_name;
|
||||||
|
const char *proj4text;
|
||||||
|
|
||||||
|
int tile_count;
|
||||||
|
double pixel_x_size, pixel_y_size;
|
||||||
|
int levels = rasterliteGetLevels (dataset);
|
||||||
|
|
||||||
|
if (rasterliteGetSrid(dataset, &srid, &auth_name, &auth_srid, &ref_sys_name, &proj4text) != RASTERLITE_OK)
|
||||||
{
|
{
|
||||||
int srid, auth_srid;
|
std::string error (rasterliteGetLastError(dataset));
|
||||||
const char *auth_name;
|
|
||||||
const char *ref_sys_name;
|
|
||||||
const char *proj4text;
|
|
||||||
|
|
||||||
int tile_count;
|
rasterliteClose (dataset);
|
||||||
double pixel_x_size, pixel_y_size;
|
|
||||||
int levels = rasterliteGetLevels (dataset);
|
|
||||||
|
|
||||||
if (rasterliteGetSrid(dataset, &srid, &auth_name, &auth_srid, &ref_sys_name, &proj4text) != RASTERLITE_OK)
|
throw datasource_exception(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Data Source=" << rasterliteGetTablePrefix(dataset);
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: SRID=" << srid;
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Authority=" << auth_name;
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: AuthSRID=" << auth_srid;
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: RefSys Name=" << ref_sys_name;
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Proj4Text=" << proj4text;
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Extent=" << x0 << "," << y0 << " " << x1 << "," << y1 << ")";
|
||||||
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Levels=" << levels;
|
||||||
|
|
||||||
|
for (int i = 0; i < levels; i++)
|
||||||
|
{
|
||||||
|
if (rasterliteGetResolution(dataset, i, &pixel_x_size, &pixel_y_size, &tile_count) == RASTERLITE_OK)
|
||||||
{
|
{
|
||||||
std::string error (rasterliteGetLastError(dataset));
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Level=" << i
|
||||||
|
<< " x=" << pixel_x_size
|
||||||
rasterliteClose (dataset);
|
<< " y=" << pixel_y_size
|
||||||
|
<< " tiles=" << tile_count;
|
||||||
throw datasource_exception(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
mapnik::log() << "rasterlite_datasource: Data Source=" << rasterliteGetTablePrefix(dataset);
|
|
||||||
mapnik::log() << "rasterlite_datasource: SRID=" << srid;
|
|
||||||
mapnik::log() << "rasterlite_datasource: Authority=" << auth_name;
|
|
||||||
mapnik::log() << "rasterlite_datasource: AuthSRID=" << auth_srid;
|
|
||||||
mapnik::log() << "rasterlite_datasource: RefSys Name=" << ref_sys_name;
|
|
||||||
mapnik::log() << "rasterlite_datasource: Proj4Text=" << proj4text;
|
|
||||||
mapnik::log() << "rasterlite_datasource: Extent=" << x0 << "," << y0 << " " << x1 << "," << y1 << ")";
|
|
||||||
mapnik::log() << "rasterlite_datasource: Levels=" << levels;
|
|
||||||
|
|
||||||
for (int i = 0; i < levels; i++)
|
|
||||||
{
|
|
||||||
if (rasterliteGetResolution(dataset, i, &pixel_x_size, &pixel_y_size, &tile_count) == RASTERLITE_OK)
|
|
||||||
{
|
|
||||||
mapnik::log() << "rasterlite_datasource: Level=" << i
|
|
||||||
<< " x=" << pixel_x_size << " y=" << pixel_y_size << " tiles=" << tile_count;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,7 +42,8 @@ using mapnik::query;
|
||||||
using mapnik::feature_factory;
|
using mapnik::feature_factory;
|
||||||
|
|
||||||
|
|
||||||
rasterlite_featureset::rasterlite_featureset(void* dataset, rasterlite_query q)
|
rasterlite_featureset::rasterlite_featureset(void* dataset,
|
||||||
|
rasterlite_query q)
|
||||||
: dataset_(dataset),
|
: dataset_(dataset),
|
||||||
gquery_(q),
|
gquery_(q),
|
||||||
first_(true),
|
first_(true),
|
||||||
|
@ -55,7 +56,7 @@ rasterlite_featureset::rasterlite_featureset(void* dataset, rasterlite_query q)
|
||||||
rasterlite_featureset::~rasterlite_featureset()
|
rasterlite_featureset::~rasterlite_featureset()
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "rasterlite_featureset: Closing";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Closing";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rasterliteClose(dataset_);
|
rasterliteClose(dataset_);
|
||||||
|
@ -88,7 +89,7 @@ feature_ptr rasterlite_featureset::next()
|
||||||
feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "rasterlite_featureset: Running get_feature";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Running get_feature";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
feature_ptr feature(feature_factory::create(ctx_,1));
|
feature_ptr feature(feature_factory::create(ctx_,1));
|
||||||
|
@ -106,12 +107,12 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
(intersect.width() / (double) width) : (intersect.height() / (double) height);
|
(intersect.width() / (double) width) : (intersect.height() / (double) height);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "rasterlite_featureset: Raster extent=" << raster_extent;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Raster extent=" << raster_extent;
|
||||||
mapnik::log() << "rasterlite_featureset: View extent=" << q.get_bbox();
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: View extent=" << q.get_bbox();
|
||||||
mapnik::log() << "rasterlite_featureset: Intersect extent=" << intersect;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Intersect extent=" << intersect;
|
||||||
mapnik::log() << "rasterlite_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
||||||
mapnik::log() << "rasterlite_featureset: Size=" << width << " " << height;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Size=" << width << " " << height;
|
||||||
mapnik::log() << "rasterlite_featureset: Pixel Size=" << pixel_size;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Pixel Size=" << pixel_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (width > 0 && height > 0)
|
||||||
|
@ -146,12 +147,12 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
free (raster);
|
free (raster);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "rasterlite_featureset: Done";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Done";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Rasterlite Plugin: Error " << rasterliteGetLastError (dataset_) << std::endl;
|
MAPNIK_LOG_ERROR(rasterlite) << "Rasterlite Plugin: Error " << rasterliteGetLastError (dataset_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ typedef boost::variant<mapnik::query,mapnik::coord2d> rasterlite_query;
|
||||||
class rasterlite_featureset : public mapnik::Featureset
|
class rasterlite_featureset : public mapnik::Featureset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
rasterlite_featureset(void* dataset, rasterlite_query q);
|
rasterlite_featureset(void* dataset,
|
||||||
|
rasterlite_query q);
|
||||||
virtual ~rasterlite_featureset();
|
virtual ~rasterlite_featureset();
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,6 @@ shape_datasource::shape_datasource(const parameters ¶ms, bool bind)
|
||||||
row_limit_(*params_.get<int>("row_limit",0)),
|
row_limit_(*params_.get<int>("row_limit",0)),
|
||||||
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
|
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
if (!file) throw datasource_exception("Shape Plugin: missing <file> parameter");
|
if (!file) throw datasource_exception("Shape Plugin: missing <file> parameter");
|
||||||
|
|
||||||
|
@ -146,7 +144,7 @@ void shape_datasource::bind() const
|
||||||
// I - long
|
// I - long
|
||||||
// G - ole
|
// G - ole
|
||||||
// + - autoincrement
|
// + - autoincrement
|
||||||
if (log_enabled_) mapnik::log() << "shape_datasource: Unknown type=" << fd.type_;
|
MAPNIK_LOG_WARN(shape) << "shape_datasource: Unknown type=" << fd.type_;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -159,17 +157,17 @@ void shape_datasource::bind() const
|
||||||
}
|
}
|
||||||
catch (const datasource_exception& ex)
|
catch (const datasource_exception& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "Shape Plugin: error processing field attributes, " << ex.what() << std::endl;
|
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
||||||
{
|
{
|
||||||
std::cerr << "Shape Plugin: error processing field attributes, " << ex.what() << std::endl;
|
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (...) // exception: pipe_select_interrupter: Too many open files
|
catch (...) // exception: pipe_select_interrupter: Too many open files
|
||||||
{
|
{
|
||||||
std::cerr << "Shape Plugin: error processing field attributes" << std::endl;
|
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes";
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,16 +207,13 @@ void shape_datasource::init(shape_io& shape) const
|
||||||
shape.shp().read_envelope(extent_);
|
shape.shp().read_envelope(extent_);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
const double zmin = shape.shp().read_double();
|
||||||
{
|
const double zmax = shape.shp().read_double();
|
||||||
double zmin = shape.shp().read_double();
|
const double mmin = shape.shp().read_double();
|
||||||
double zmax = shape.shp().read_double();
|
const double mmax = shape.shp().read_double();
|
||||||
double mmin = shape.shp().read_double();
|
|
||||||
double mmax = shape.shp().read_double();
|
|
||||||
|
|
||||||
mapnik::log() << "shape_datasource: Z min/max=" << zmin << "," << zmax;
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Z min/max=" << zmin << "," << zmax;
|
||||||
mapnik::log() << "shape_datasource: M min/max=" << mmin << "," << mmax;
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: M min/max=" << mmin << "," << mmax;
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
shape.shp().skip(4*8);
|
shape.shp().skip(4*8);
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,18 +232,15 @@ void shape_datasource::init(shape_io& shape) const
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// #ifdef MAPNIK_LOG
|
// #ifdef MAPNIK_LOG
|
||||||
// mapnik::log() << "shape_datasource: No .index file found for "
|
// MAPNIK_LOG_DEBUG(shape) << "shape_datasource: No .index file found for "
|
||||||
// << shape_name_ << ".shp, use the 'shapeindex' program to build an index for faster rendering";
|
// << shape_name_ << ".shp, use the 'shapeindex' program to build an index for faster rendering";
|
||||||
// #endif
|
// #endif
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Extent=" << extent_;
|
||||||
{
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: File length=" << file_length_;
|
||||||
mapnik::log() << "shape_datasource: Extent=" << extent_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Shape type=" << shape_type_;
|
||||||
mapnik::log() << "shape_datasource: File length=" << file_length_;
|
|
||||||
mapnik::log() << "shape_datasource: Shape type=" << shape_type_;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -390,4 +382,3 @@ boost::optional<mapnik::datasource::geometry_t> shape_datasource::get_geometry_t
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,8 +128,9 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
if (shape_.type() == shape_io::shape_null)
|
if (shape_.type() == shape_io::shape_null)
|
||||||
{
|
{
|
||||||
pos += std::streampos(12);
|
pos += std::streampos(12);
|
||||||
|
|
||||||
// TODO handle the shapes
|
// TODO handle the shapes
|
||||||
std::cerr << "NULL SHAPE len=" << shape_.reclength_ << std::endl;
|
MAPNIK_LOG_WARN(shape) << "shape_featureset: NULL SHAPE len=" << shape_.reclength_;
|
||||||
}
|
}
|
||||||
else if (filter_.pass(shape_.current_extent()))
|
else if (filter_.pass(shape_.current_extent()))
|
||||||
{
|
{
|
||||||
|
@ -147,7 +148,7 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "shape_featureset: Total shapes read=" << count_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_;
|
||||||
#endif
|
#endif
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
|
@ -248,7 +249,7 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << "Shape Plugin: error processing attributes " << std::endl;
|
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +258,7 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "shape_featureset: Total shapes read=" << count_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_;
|
||||||
#endif
|
#endif
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,16 +42,6 @@ using mapnik::context_ptr;
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
class shape_featureset : public Featureset
|
class shape_featureset : public Featureset
|
||||||
{
|
{
|
||||||
filterT filter_;
|
|
||||||
shape_io shape_;
|
|
||||||
box2d<double> query_ext_;
|
|
||||||
boost::scoped_ptr<transcoder> tr_;
|
|
||||||
long file_length_;
|
|
||||||
std::vector<int> attr_ids_;
|
|
||||||
const int row_limit_;
|
|
||||||
mutable int count_;
|
|
||||||
context_ptr ctx_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
shape_featureset(filterT const& filter,
|
shape_featureset(filterT const& filter,
|
||||||
std::string const& shape_file,
|
std::string const& shape_file,
|
||||||
|
@ -61,6 +51,17 @@ public:
|
||||||
int row_limit);
|
int row_limit);
|
||||||
virtual ~shape_featureset();
|
virtual ~shape_featureset();
|
||||||
feature_ptr next();
|
feature_ptr next();
|
||||||
|
|
||||||
|
private:
|
||||||
|
filterT filter_;
|
||||||
|
shape_io shape_;
|
||||||
|
box2d<double> query_ext_;
|
||||||
|
boost::scoped_ptr<transcoder> tr_;
|
||||||
|
long file_length_;
|
||||||
|
std::vector<int> attr_ids_;
|
||||||
|
const int row_limit_;
|
||||||
|
mutable int count_;
|
||||||
|
context_ptr ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //SHAPE_FEATURESET_HPP
|
#endif //SHAPE_FEATURESET_HPP
|
||||||
|
|
|
@ -68,7 +68,7 @@ shape_index_featureset<filterT>::shape_index_featureset(filterT const& filter,
|
||||||
std::sort(ids_.begin(), ids_.end());
|
std::sort(ids_.begin(), ids_.end());
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "shape_index_featureset: Query size=" << ids_.size();
|
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << ids_.size();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
itr_ = ids_.begin();
|
itr_ = ids_.begin();
|
||||||
|
@ -195,7 +195,7 @@ feature_ptr shape_index_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << "Shape Plugin: error processing attributes" << std::endl;
|
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return feature;
|
return feature;
|
||||||
|
@ -204,7 +204,7 @@ feature_ptr shape_index_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "shape_index_featureset: " << count_ << " features";
|
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: " << count_ << " features";
|
||||||
#endif
|
#endif
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,7 @@ public:
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
std::string const& shape_name,
|
std::string const& shape_name,
|
||||||
int row_limit);
|
int row_limit);
|
||||||
|
|
||||||
virtual ~shape_index_featureset();
|
virtual ~shape_index_featureset();
|
||||||
|
|
||||||
feature_ptr next();
|
feature_ptr next();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -59,7 +59,7 @@ shape_io::shape_io(const std::string& shape_name, bool open_index)
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "shape_io: Could not open index=" << shape_name << INDEX;
|
MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,5 +233,3 @@ void shape_io::read_polygon(mapnik::geometry_container & geom)
|
||||||
// double m=record.read_double();
|
// double m=record.read_double();
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,6 @@ sqlite_datasource::sqlite_datasource(parameters const& params, bool bind)
|
||||||
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
|
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
|
||||||
format_(mapnik::wkbAuto)
|
format_(mapnik::wkbAuto)
|
||||||
{
|
{
|
||||||
log_enabled_ = *params_.get<mapnik::boolean>("log", MAPNIK_DEBUG_AS_BOOL);
|
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
- throw if no primary key but spatial index is present?
|
- throw if no primary key but spatial index is present?
|
||||||
- remove auto-indexing
|
- remove auto-indexing
|
||||||
|
@ -218,7 +216,7 @@ void sqlite_datasource::bind() const
|
||||||
iter != init_statements_.end(); ++iter)
|
iter != init_statements_.end(); ++iter)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "sqlite_datasource: Execute init sql=" << *iter;
|
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: Execute init sql=" << *iter;
|
||||||
#endif
|
#endif
|
||||||
dataset_->execute(*iter);
|
dataset_->execute(*iter);
|
||||||
}
|
}
|
||||||
|
@ -616,11 +614,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_)
|
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str();
|
||||||
{
|
|
||||||
mapnik::log() << "sqlite_datasource: Table=" << table_;
|
|
||||||
mapnik::log() << "sqlite_datasource: Query=" << s.str();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
||||||
|
@ -704,7 +698,7 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
if (log_enabled_) mapnik::log() << "sqlite_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
||||||
|
|
|
@ -126,7 +126,7 @@ feature_ptr sqlite_featureset::next()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
mapnik::log() << "sqlite_featureset: Field=" << fld_name_str << " unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(sqlite) << "sqlite_featureset: Field=" << fld_name_str << " unhandled type_oid=" << type_oid;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,17 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// mapnik
|
||||||
#include <mapnik/debug.hpp>
|
#include <mapnik/debug.hpp>
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
namespace mapnik { namespace logger {
|
||||||
namespace mapnik {
|
|
||||||
namespace logger {
|
|
||||||
severity::type severity::severity_level_ =
|
severity::type severity::severity_level_ =
|
||||||
MAPNIK_DEBUG_AS_BOOL ? severity::debug : severity::error;
|
MAPNIK_DEBUG_AS_BOOL ? severity::debug : severity::error;
|
||||||
}
|
|
||||||
|
severity::severity_map severity::object_severity_level_ = severity::severity_map();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ SOURCES += \
|
||||||
$$PWD/../bindings/python/mapnik_image_view.cpp \
|
$$PWD/../bindings/python/mapnik_image_view.cpp \
|
||||||
$$PWD/../bindings/python/mapnik_inmem_metawriter.cpp \
|
$$PWD/../bindings/python/mapnik_inmem_metawriter.cpp \
|
||||||
$$PWD/../bindings/python/mapnik_layer.cpp \
|
$$PWD/../bindings/python/mapnik_layer.cpp \
|
||||||
|
$$PWD/../bindings/python/mapnik_logger.cpp \
|
||||||
$$PWD/../bindings/python/mapnik_line_pattern_symbolizer.cpp \
|
$$PWD/../bindings/python/mapnik_line_pattern_symbolizer.cpp \
|
||||||
$$PWD/../bindings/python/mapnik_line_symbolizer.cpp \
|
$$PWD/../bindings/python/mapnik_line_symbolizer.cpp \
|
||||||
$$PWD/../bindings/python/mapnik_map.cpp \
|
$$PWD/../bindings/python/mapnik_map.cpp \
|
||||||
|
|
|
@ -323,5 +323,5 @@ include(plugins.pri)
|
||||||
include(bindings.pri)
|
include(bindings.pri)
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
DEFINES += LINUX=1
|
DEFINES += LINUX=1 MAPNIK_LOG=1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue