Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created November 16, 2010 08:25
Show Gist options
  • Save springmeyer/701583 to your computer and use it in GitHub Desktop.
Save springmeyer/701583 to your computer and use it in GitHub Desktop.
Index: plugins/input/ogr/ogr_datasource.cpp
===================================================================
--- plugins/input/ogr/ogr_datasource.cpp (revision 2378)
+++ plugins/input/ogr/ogr_datasource.cpp (working copy)
@@ -59,21 +59,30 @@
: datasource(params),
extent_(),
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")),
indexed_(false)
{
OGRRegisterAll();
- boost::optional<std::string> file = params.get<std::string>("file");
- if (!file) throw datasource_exception("missing <file> parameter");
+ boost::optional<std::string> file = params_.get<std::string>("file");
+ boost::optional<std::string> string = params_.get<std::string>("string");
+
+ if (!file && !string) throw datasource_exception("missing <file> or <string> parameter");
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
- boost::optional<std::string> base = params_.get<std::string>("base");
- if (base)
- dataset_name_ = *base + "/" + *file;
- else
- dataset_name_ = *file;
+ if (string)
+ {
+ dataset_name_ = *string;
+ }
+ else if (file)
+ {
+ boost::optional<std::string> base = params_.get<std::string>("base");
+ if (base)
+ dataset_name_ = *base + "/" + *file;
+ else
+ dataset_name_ = *file;
+ }
if (bind)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment