Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bump to 0.7.18 with fix for reporting null feature properties as null…

… js objects
  • Loading branch information...
commit 1a6a400457f1037976a251049fcc35aa6f10dadd 1 parent e0fd94e
@springmeyer springmeyer authored
View
4 CHANGELOG.md
@@ -1,5 +1,9 @@
# Changlog
+## 0.7.18
+
+ - Report null values in mapnik features as javascript null rather than undefined
+
## 0.7.17
- Added sync/async `clear()` method to enable re-use of mapnik.Image and mapnik.Grid
View
2  package.json
@@ -4,7 +4,7 @@
"url" : "http://github.com/mapnik/node-mapnik",
"homepage" : "http://mapnik.org",
"author" : "Dane Springmeyer <dane@dbsgeo.com> (mapnik.org)",
- "version" : "0.7.17",
+ "version" : "0.7.18",
"main" : "./lib/mapnik.js",
"bugs" : {
"email" : "dane@dbsgeo.com",
View
6 src/mapnik_feature.cpp
@@ -245,6 +245,12 @@ Handle<Value> Feature::addAttributes(const Arguments& args)
boost::put(*fp->get(),TOSTR(name),dub_val);
#endif
}
+ } else if (value->IsNull()) {
+#if MAPNIK_VERSION >= 200100
+ fp->get()->put_new(TOSTR(name),mapnik::value_null());
+#else
+ boost::put(*fp->get(),TOSTR(name),mapnik::value_null());
+#endif
} else {
std::clog << "unhandled type for property: " << TOSTR(name) << "\n";
}
View
6 src/mapnik_memory_datasource.cpp
@@ -276,6 +276,12 @@ Handle<Value> MemoryDatasource::add(const Arguments& args)
boost::put(*feature,TOSTR(name),dub_val);
#endif
}
+ } else if (value->IsNull()) {
+#if MAPNIK_VERSION >= 200100
+ feature->put_new(TOSTR(name),mapnik::value_null());
+#else
+ boost::put(*feature,TOSTR(name),mapnik::value_null());
+#endif
} else {
std::clog << "unhandled type for property: " << TOSTR(name) << "\n";
}
View
2  src/utils.hpp
@@ -78,7 +78,7 @@ struct params_to_object : public boost::static_visitor<>
void operator () ( mapnik::value_null const& val )
{
- ds_->Set(String::NewSymbol(key_.c_str()), Undefined() );
+ ds_->Set(String::NewSymbol(key_.c_str()), Null() );
}
private:
View
12 test/feature.test.js
@@ -44,4 +44,16 @@ describe('mapnik.Feature ', function() {
}
assert.equal(count, 245);
});
+
+ it('should report null values as js null',function() {
+ var extent = '-180,-60,180,60';
+ var ds = new mapnik.MemoryDatasource({'extent': extent});
+ var feat = {x:0,y:0,properties: {feat_id:1,null_val:null,name:"name"}};
+ ds.add(feat);
+ var actual_feat = ds.features()[0];
+ assert.ok(actual_feat.null_val === null);
+ assert.equal(actual_feat.feat_id,1);
+ assert.equal(actual_feat.__id__,1);
+ assert.equal(actual_feat.name,'name');
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.