Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Fixes #170
Browse files Browse the repository at this point in the history
  • Loading branch information
nateirwin committed Mar 12, 2019
1 parent 7df94be commit 61eecae
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@
"scripts": {
"test": "grunt test"
},
"version": "7.1.18"
"version": "7.1.17.2"
}
34 changes: 32 additions & 2 deletions src/preset/outerspatial.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,13 @@ var OuterSpatialLayer = L.GeoJSON.extend({
L.Util.setOptions(this, this._toLeaflet(options));

if (this.options.locationType === 'primary_points_of_interest') {
var campgrounds = fetch(me.options.environment, me.options.organizationId, 'campgrounds');
var campgrounds = fetch(me.options.environment, me.options.organizationId, 'campgrounds').then(function (geojson) {
geojson.features = geojson.features.filter(function (feature) {
return feature.properties.point_type === 'Campground';
});

return geojson;
});
var pointsOfInterest = fetch(me.options.environment, me.options.organizationId, 'points_of_interest').then(function (geojson) {
geojson.features = geojson.features.filter(function (feature) {
var poiType = feature.properties.point_type;
Expand All @@ -500,7 +506,13 @@ var OuterSpatialLayer = L.GeoJSON.extend({

return geojson;
});
var trailheads = fetch(me.options.environment, me.options.organizationId, 'trailheads');
var trailheads = fetch(me.options.environment, me.options.organizationId, 'trailheads').then(function (geojson) {
geojson.features = geojson.features.filter(function (feature) {
return feature.properties.point_type === 'Trailhead';
});

return geojson;
});

Promise.all([
campgrounds,
Expand Down Expand Up @@ -576,6 +588,24 @@ var OuterSpatialLayer = L.GeoJSON.extend({
});
} else {
fetch(me.options.environment, me.options.organizationId, me.options.locationType).then(function (geojson) {
switch (me.options.locationType) {
case 'campgrounds':
geojson.features = geojson.features.filter(function (feature) {
return feature.properties.point_type === 'Campground';
});
break;
case 'points_of_interest':
geojson.features = geojson.features.filter(function (feature) {
return feature.properties.point_type !== 'Campground' && feature.properties.point_type !== 'Trailhead';
});
break;
case 'trailheads':
geojson.features = geojson.features.filter(function (feature) {
return feature.properties.point_type === 'Trailhead';
});
break;
}

L.GeoJSON.prototype.initialize.call(me, geojson, me.options);

if (me.options.locationType === 'points_of_interest') {
Expand Down

0 comments on commit 61eecae

Please sign in to comment.