diff --git a/web/client/components/map/leaflet/Feature.jsx b/web/client/components/map/leaflet/Feature.jsx
index 17f2d21e23..678cd9efc1 100644
--- a/web/client/components/map/leaflet/Feature.jsx
+++ b/web/client/components/map/leaflet/Feature.jsx
@@ -107,7 +107,7 @@ var geometryToLayer = function(geojson, options) {
return new L.FeatureGroup(layers);
case 'GeometryCollection':
for (i = 0, len = geometry.geometries.length; i < len; i++) {
- layer = this.geometryToLayer({
+ layer = geometryToLayer({
geometry: geometry.geometries[i],
type: 'Feature',
properties: geojson.properties
diff --git a/web/client/components/map/leaflet/__tests__/Layer-test.jsx b/web/client/components/map/leaflet/__tests__/Layer-test.jsx
index 620ba1d2d2..25e75909f2 100644
--- a/web/client/components/map/leaflet/__tests__/Layer-test.jsx
+++ b/web/client/components/map/leaflet/__tests__/Layer-test.jsx
@@ -9,6 +9,7 @@ var React = require('react/addons');
var ReactDOM = require('react-dom');
var L = require('leaflet');
var LeafLetLayer = require('../Layer.jsx');
+var Feature = require('../Feature.jsx');
var expect = require('expect');
require('../../../../utils/leaflet/Layers');
@@ -18,6 +19,7 @@ require('../plugins/WMSLayer');
require('../plugins/GoogleLayer');
require('../plugins/BingLayer');
require('../plugins/MapQuest');
+require('../plugins/VectorLayer');
describe('Leaflet layer', () => {
let map;
@@ -177,6 +179,119 @@ describe('Leaflet layer', () => {
expect(urls.length).toBe(1);
});
+ it('creates a vector layer for leaflet map', () => {
+ var options = {
+ "type": "wms",
+ "visibility": true,
+ "name": "vector_sample",
+ "group": "sample",
+ "features": [
+ { "type": "Feature",
+ "geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
+ "properties": {"prop0": "value0"}
+ },
+ { "type": "Feature",
+ "geometry": {
+ "type": "LineString",
+ "coordinates": [
+ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
+ ]
+ },
+ "properties": {
+ "prop0": "value0",
+ "prop1": 0.0
+ }
+ },
+ { "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
+ [100.0, 1.0], [100.0, 0.0] ]
+ ]
+ },
+ "properties": {
+ "prop0": "value0",
+ "prop1": {"this": "that"}
+ }
+ },
+ { "type": "Feature",
+ "geometry": { "type": "MultiPoint",
+ "coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
+ },
+ "properties": {
+ "prop0": "value0",
+ "prop1": {"this": "that"}
+ }
+ },
+ { "type": "Feature",
+ "geometry": { "type": "MultiLineString",
+ "coordinates": [
+ [ [100.0, 0.0], [101.0, 1.0] ],
+ [ [102.0, 2.0], [103.0, 3.0] ]
+ ]
+ },
+ "properties": {
+ "prop0": "value0",
+ "prop1": {"this": "that"}
+ }
+ },
+ { "type": "Feature",
+ "geometry": { "type": "MultiPolygon",
+ "coordinates": [
+ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
+ [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
+ [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
+ ]
+ },
+ "properties": {
+ "prop0": "value0",
+ "prop1": {"this": "that"}
+ }
+ },
+ { "type": "Feature",
+ "geometry": { "type": "GeometryCollection",
+ "geometries": [
+ { "type": "Point",
+ "coordinates": [100.0, 0.0]
+ },
+ { "type": "LineString",
+ "coordinates": [ [101.0, 0.0], [102.0, 1.0] ]
+ }
+ ]
+ },
+ "properties": {
+ "prop0": "value0",
+ "prop1": {"this": "that"}
+ }
+ }
+ ]
+ };
+ // create layers
+ var layer = ReactDOM.render(
+ (
+ {options.features.map((feature) => ())}), document.getElementById("container"));
+ expect(layer).toExist();
+ let l2 = ReactDOM.render(
+ (
+ {options.features.map((feature) => ())}), document.getElementById("container"));
+ expect(l2).toExist();
+ });
+
it('creates a wms layer for leaflet map with custom tileSize', () => {
var options = {
"type": "wms",