Skip to content
Browse files

process simple multipolygons the same way as regular ones

… by consolidating two separate code branches. This makes sure
simple mps get the same amount of care as regular ones. fixes #13

also: do not unnecessarily produce MultiPolygons, when a Polygon is
enough to describe the geometry.
  • Loading branch information...
1 parent 2e7f11b commit 4b4ad6250624b4f0eb69cd78fcc0146900e0c208 @tyrasd committed Jan 2, 2014
Showing with 44 additions and 84 deletions.
  1. +30 −63 index.js
  2. +1 −1 osmtogeojson.js
  3. +13 −20 test/osm.test.js
View
93 index.js
@@ -305,11 +305,26 @@ osmtogeojson = function( data, options ) {
var simple_mp = false;
if (outer_count == 1 && !has_interesting_tags(rels[i].tags, {"type":true}))
simple_mp = true;
+ var feature = null;
if (!simple_mp) {
+ feature = construct_multipolygon(rels[i], rels[i]);
+ } else {
+ // simple multipolygon
+ var outer_way = rels[i].members.filter(function(m) {return m.role === "outer";})[0];
+ outer_way = wayids[outer_way.ref];
+ if (outer_way === undefined)
+ continue; // abort if outer way object is not present
+ outer_way.is_multipolygon_outline = true;
+ feature = construct_multipolygon(outer_way, rels[i]);
+ }
+ if (feature === false)
+ continue; // abort if feature could not be constructed
+ geojsonpolygons.features.push(feature);
+ function construct_multipolygon(tag_object, rel) {
var is_tainted = false;
// prepare mp members
var members;
- members = rels[i].members.filter(function(m) {return m.type === "way";});
+ members = rel.members.filter(function(m) {return m.type === "way";});
members = members.map(function(m) {
var way = wayids[m.ref];
if (way === undefined) { // check for missing ways
@@ -444,79 +459,31 @@ osmtogeojson = function( data, options ) {
}));
if (mp_coords.length == 0)
- continue; // ignore multipolygons without coordinates
+ return false; // ignore multipolygons without coordinates
+ var mp_type = "MultiPolygon";
+ if (mp_coords.length === 1) {
+ mp_type = "Polygon";
+ mp_coords = mp_coords[0];
+ }
// mp parsed, now construct the geoJSON
var feature = {
"type" : "Feature",
- "id" : "relation/"+rels[i].id,
+ "id" : tag_object.type+"/"+tag_object.id,
"properties" : {
- "type" : "relation",
- "id" : rels[i].id,
- "tags" : rels[i].tags || {},
- "relations" : relsmap["relation"][rels[i].id] || [],
- "meta": build_meta_information(rels[i])
+ "type" : tag_object.type,
+ "id" : tag_object.id,
+ "tags" : tag_object.tags || {},
+ "relations" : relsmap[tag_object.type][tag_object.id] || [],
+ "meta": build_meta_information(tag_object)
},
"geometry" : {
- "type" : "MultiPolygon",
+ "type" : mp_type,
"coordinates" : mp_coords,
}
}
if (is_tainted)
feature.properties["tainted"] = true;
- geojsonpolygons.features.push(feature);
- } else {
- // simple multipolygon
- rels[i].tainted = false;
- var outer_coords = new Array();
- var inner_coords = new Array();
- var outer_way = undefined;
- for (var j=0;j<rels[i].members.length;j++) {
- if ((rels[i].members[j].type == "way") &&
- _.contains(["outer","inner"], rels[i].members[j].role)) {
- var w = wayids[rels[i].members[j].ref];
- if (typeof w == "undefined") {
- rels[i].tainted = true;
- continue;
- }
- var coords = new Array();
- for (var k=0;k<w.nodes.length;k++) {
- if (typeof w.nodes[k] == "object")
- coords.push([+w.nodes[k].lon, +w.nodes[k].lat]);
- else
- rels[i].tainted = true;
- }
- if (rels[i].members[j].role == "outer") {
- outer_coords.push(coords);
- outer_way = w;
- outer_way.is_multipolygon_outline = true;
- } else if (rels[i].members[j].role == "inner") {
- inner_coords.push(coords);
- }
- }
- }
- if (typeof outer_way == "undefined")
- continue; // abort if outer way object is not present
- if (outer_coords[0].length == 0)
- continue; // abort if coordinates of outer way is not present
- way_type = "Polygon";
- var feature = {
- "type" : "Feature",
- "id" : "way/"+outer_way.id,
- "properties" : {
- "type" : "way",
- "id" : outer_way.id,
- "tags" : outer_way.tags || {},
- "relations" : relsmap["way"][outer_way.id] || [],
- "meta": build_meta_information(outer_way)
- },
- "geometry" : {
- "type" : way_type,
- "coordinates" : ([].concat(outer_coords,inner_coords)),
- }
- }
- if (rels[i].tainted)
- feature.properties["tainted"] = true;
- geojsonpolygons.features.push(feature);
+ return feature;
}
}
}
View
2 osmtogeojson.js
@@ -1 +1 @@
-!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.osmtogeojson=e():"undefined"!=typeof global?global.osmtogeojson=e():"undefined"!=typeof self&&(self.osmtogeojson=e())}(function(){return function e(n,t,r){function o(i,u){if(!t[i]){if(!n[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);throw new Error("Cannot find module '"+i+"'")}var l=t[i]={exports:{}};n[i][0].call(l.exports,function(e){var t=n[i][1][e];return o(t?t:e)},l,l.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,n){var t=e("./lodash.custom.js"),r=e("geojson-rewind"),o=e("./polygon_features.json"),a={};a=function(e,n){function a(e){for(var n=new Array,r=new Array,o=new Array,a=0;a<e.elements.length;a++)switch(e.elements[a].type){case"node":var i=e.elements[a];n.push(i);break;case"way":var s=t.clone(e.elements[a]);s.nodes=t.clone(s.nodes),r.push(s);break;case"relation":var l=t.clone(e.elements[a]);l.members=t.clone(l.members),o.push(l)}return u(n,r,o)}function i(e){function n(e,n,t){e.hasAttribute(t)&&(n[t]=e.getAttribute(t))}var r=new Array,o=new Array,a=new Array;return t.each(e.getElementsByTagName("node"),function(e,o){var a={};t.each(e.getElementsByTagName("tag"),function(e){a[e.getAttribute("k")]=e.getAttribute("v")}),r[o]={type:"node"},n(e,r[o],"id"),n(e,r[o],"lat"),n(e,r[o],"lon"),n(e,r[o],"version"),n(e,r[o],"timestamp"),n(e,r[o],"changeset"),n(e,r[o],"uid"),n(e,r[o],"user"),t.isEmpty(a)||(r[o].tags=a)}),t.each(e.getElementsByTagName("way"),function(e,r){var a={},i=[];t.each(e.getElementsByTagName("tag"),function(e){a[e.getAttribute("k")]=e.getAttribute("v")}),t.each(e.getElementsByTagName("nd"),function(e,n){i[n]=e.getAttribute("ref")}),o[r]={type:"way"},n(e,o[r],"id"),n(e,o[r],"version"),n(e,o[r],"timestamp"),n(e,o[r],"changeset"),n(e,o[r],"uid"),n(e,o[r],"user"),i.length>0&&(o[r].nodes=i),t.isEmpty(a)||(o[r].tags=a)}),t.each(e.getElementsByTagName("relation"),function(e,r){var o={},i=[];t.each(e.getElementsByTagName("tag"),function(e){o[e.getAttribute("k")]=e.getAttribute("v")}),t.each(e.getElementsByTagName("member"),function(e,t){i[t]={},n(e,i[t],"ref"),n(e,i[t],"role"),n(e,i[t],"type")}),a[r]={type:"relation"},n(e,a[r],"id"),n(e,a[r],"version"),n(e,a[r],"timestamp"),n(e,a[r],"changeset"),n(e,a[r],"uid"),n(e,a[r],"user"),i.length>0&&(a[r].members=i),t.isEmpty(o)||(a[r].tags=o)}),u(r,o,a)}function u(e,o,a){function i(e,t){if("object"!=typeof t&&(t={}),"function"==typeof n.uninterestingTags)return!n.uninterestingTags(e,t);for(var r in e)if(n.uninterestingTags[r]!==!0&&t[r]!==!0&&t[r]!==e[r])return!0;return!1}function u(e){var n={timestamp:e.timestamp,version:e.version,changeset:e.changeset,user:e.user,uid:e.uid};for(I in n)void 0===n[I]&&delete n[I];return n}function l(e){for(var n,t,r,o,a,i,u=function(e){return e[0]},s=function(e){return e[e.length-1]},l=[];e.length;)for(n=e.pop().nodes.slice(),l.push(n);e.length&&u(n)!==s(n);){for(t=u(n),r=s(n),o=0;o<e.length;o++){if(i=e[o].nodes,r===u(i)){a=n.push,i=i.slice(1);break}if(r===s(i)){a=n.push,i=i.slice(0,-1).reverse();break}if(t==s(i)){a=n.unshift,i=i.slice(0,-1);break}if(t==u(i)){a=n.unshift,i=i.slice(1).reverse();break}i=a=null}if(!i)break;e.splice(o,1),a.apply(n,i)}return l}function f(e){var n,t,r=function(e,n){for(var t=0;t<n.length;t++)if(a(n[t],e))return!0;return!1},o=function(e){return e.map(function(e){return[+e.lat,+e.lon]})},a=function(e,n){for(var t=e[0],r=e[1],o=!1,a=0,i=n.length-1;a<n.length;i=a++){var u=n[a][0],s=n[a][1],l=n[i][0],f=n[i][1],c=s>r!=f>r&&(l-u)*(r-s)/(f-s)+u>t;c&&(o=!o)}return o};for(e=o(e),n=0;n<B.length;n++)if(t=o(B[n]),r(t,e))return n}for(var c=new Object,p=0;p<e.length;p++)void 0!==e[p].lat&&(c[e[p].id]=e[p]);for(var g=new Object,p=0;p<e.length;p++)"undefined"!=typeof e[p].tags&&i(e[p].tags)&&(g[e[p].id]=!0);for(var p=0;p<a.length;p++)if(t.isArray(a[p].members))for(var d=0;d<a[p].members.length;d++)"node"==a[p].members[d].type&&(g[a[p].members[d].ref]=!0);for(var y=new Object,m=new Object,p=0;p<o.length;p++)if(t.isArray(o[p].nodes)){y[o[p].id]=o[p];for(var d=0;d<o[p].nodes.length;d++)m[o[p].nodes[d]]=!0,o[p].nodes[d]=c[o[p].nodes[d]]}for(var h=new Array,p=0;p<e.length;p++)(!m[e[p].id]||g[e[p].id])&&h.push(e[p]);for(var b=new Array,p=0;p<a.length;p++)t.isArray(a[p].members)&&(b[a[p].id]=a[p]);for(var v={node:{},way:{},relation:{}},p=0;p<a.length;p++)if(t.isArray(a[p].members))for(var d=0;d<a[p].members.length;d++){var w;switch(a[p].members[d].type){case"node":w=c[a[p].members[d].ref];break;case"way":w=y[a[p].members[d].ref];break;case"relation":w=b[a[p].members[d].ref]}if(w){var x=a[p].members[d].type,j=a[p].members[d].ref;"undefined"==typeof v[x][j]&&(v[x][j]=[]),v[x][j].push({role:a[p].members[d].role,rel:a[p].id,reltags:a[p].tags})}}var _,A={type:"FeatureCollection",features:new Array};for(p=0;p<h.length;p++)"undefined"!=typeof h[p].lon&&"undefined"!=typeof h[p].lat&&A.features.push({type:"Feature",id:"node/"+h[p].id,properties:{type:"node",id:h[p].id,tags:h[p].tags||{},relations:v.node[h[p].id]||[],meta:u(h[p])},geometry:{type:"Point",coordinates:[+h[p].lon,+h[p].lat]}});for(var P={type:"FeatureCollection",features:new Array},k={type:"FeatureCollection",features:new Array},p=0;p<a.length;p++)if("undefined"!=typeof a[p].tags&&("multipolygon"==a[p].tags.type||"boundary"==a[p].tags.type)){if(!t.isArray(a[p].members))continue;for(var E=0,d=0;d<a[p].members.length;d++)"outer"==a[p].members[d].role&&E++;if(a[p].members.forEach(function(e){y[e.ref]&&("outer"!==e.role||i(y[e.ref].tags,a[p].tags)||(y[e.ref].is_multipolygon_outline=!0),"inner"!==e.role||i(y[e.ref].tags)||(y[e.ref].is_multipolygon_outline=!0))}),0==E)continue;var O=!1;if(1!=E||i(a[p].tags,{type:!0})||(O=!0),O){a[p].tainted=!1;for(var C=new Array,S=new Array,T=void 0,d=0;d<a[p].members.length;d++)if("way"==a[p].members[d].type&&t.contains(["outer","inner"],a[p].members[d].role)){var L=y[a[p].members[d].ref];if("undefined"==typeof L){a[p].tainted=!0;continue}for(var F=new Array,I=0;I<L.nodes.length;I++)"object"==typeof L.nodes[I]?F.push([+L.nodes[I].lon,+L.nodes[I].lat]):a[p].tainted=!0;"outer"==a[p].members[d].role?(C.push(F),T=L,T.is_multipolygon_outline=!0):"inner"==a[p].members[d].role&&S.push(F)}if("undefined"==typeof T)continue;if(0==C[0].length)continue;$="Polygon";var N={type:"Feature",id:"way/"+T.id,properties:{type:"way",id:T.id,tags:T.tags||{},relations:v.way[T.id]||[],meta:u(T)},geometry:{type:$,coordinates:[].concat(C,S)}};a[p].tainted&&(N.properties.tainted=!0),k.features.push(N)}else{var D,M=!1;D=a[p].members.filter(function(e){return"way"===e.type}),D=D.map(function(e){var n=y[e.ref];return void 0===n?(M=!0,void 0):{id:e.ref,role:e.role||"outer",way:n,nodes:n.nodes.filter(function(e){return void 0!==e?!0:(M=!0,!1)})}}),D=t.compact(D);var B,R;B=l(D.filter(function(e){return"outer"===e.role})),R=l(D.filter(function(e){return"inner"===e.role}));var H;H=B.map(function(e){return[e]});for(var d=0;d<R.length;d++){var q=f(R[d]);void 0!==q&&H[q].push(R[d])}var U=[];if(U=t.compact(H.map(function(e){var n=t.compact(e.map(function(e){return e.length<4?void 0:t.compact(e.map(function(e){return[+e.lon,+e.lat]}))}));if(0!=n.length)return n})),0==U.length)continue;var N={type:"Feature",id:"relation/"+a[p].id,properties:{type:"relation",id:a[p].id,tags:a[p].tags||{},relations:v.relation[a[p].id]||[],meta:u(a[p])},geometry:{type:"MultiPolygon",coordinates:U}};M&&(N.properties.tainted=!0),k.features.push(N)}}for(var p=0;p<o.length;p++)if(t.isArray(o[p].nodes)&&!o[p].is_multipolygon_outline){for(o[p].tainted=!1,o[p].hidden=!1,F=new Array,d=0;d<o[p].nodes.length;d++)"object"==typeof o[p].nodes[d]?F.push([+o[p].nodes[d].lon,+o[p].nodes[d].lat]):o[p].tainted=!0;if(!(F.length<=1)){var $="LineString";"undefined"!=typeof o[p].nodes[0]&&o[p].nodes[0]===o[p].nodes[o[p].nodes.length-1]&&"undefined"!=typeof o[p].tags&&s(o[p].tags)&&($="Polygon",F=[F]);var N={type:"Feature",id:"way/"+o[p].id,properties:{type:"way",id:o[p].id,tags:o[p].tags||{},relations:v.way[o[p].id]||[],meta:u(o[p])},geometry:{type:$,coordinates:F}};o[p].tainted&&(N.properties.tainted=!0),"LineString"==$?P.features.push(N):k.features.push(N)}}return _={type:"FeatureCollection",features:[]},_.features=_.features.concat(k.features),_.features=_.features.concat(P.features),_.features=_.features.concat(A.features),n.flatProperties&&_.features.forEach(function(e){e.properties=t.merge(e.properties.meta,e.properties.tags,{id:e.properties.type+"/"+e.properties.id})}),_=r(_,!0)}function s(e){var t=n.polygonFeatures;if("function"==typeof t)return t(e);if("no"===e.area)return!1;for(var r in e){var o=e[r],a=t[r];if("undefined"!=typeof a&&"no"!==o){if(a===!0)return!0;if(a.included_values&&a.included_values[o]===!0)return!0;if(a.excluded_values&&a.excluded_values[o]!==!0)return!0}}return!1}n=t.merge({flatProperties:!1,uninterestingTags:{source:!0,source_ref:!0,"source:ref":!0,history:!0,attribution:!0,created_by:!0,"tiger:county":!0,"tiger:tlid":!0,"tiger:upload_uuid":!0},polygonFeatures:o},n);var l;return l="undefined"!=typeof XMLDocument&&e instanceof XMLDocument||"undefined"==typeof XMLDocument&&e.childNodes?i(e):a(e)},a.toGeojson=a,n.exports=a},{"./lodash.custom.js":2,"./polygon_features.json":6,"geojson-rewind":3}],2:[function(e,n,t){var r="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(){function e(e,n,t){for(var r=(t||0)-1,o=e?e.length:0;++r<o;)if(e[r]===n)return r;return-1}function o(){return R.pop()||[]}function a(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}function i(e){e.length=0,R.length<q&&R.push(e)}function u(e,n,t){n||(n=0),"undefined"==typeof t&&(t=e?e.length:0);for(var r=-1,o=t-n||0,a=Array(0>o?0:o);++r<o;)a[r]=e[n+r];return a}function s(){}function l(e){function n(){if(r){var e=u(r);xn.apply(e,arguments)}if(this instanceof n){var a=c(t.prototype),i=t.apply(a,e||arguments);return P(i)?i:a}return t.apply(o,e||arguments)}var t=e[0],r=e[2],o=e[4];return Fn(n,e),n}function f(e,n,t,r,s){if(t){var l=t(e);if("undefined"!=typeof l)return l}var c=P(e);if(!c)return e;var p=mn.call(e);if(!tn[p]||!Tn.nodeClass&&a(e))return e;var g=Cn[p];switch(p){case z:case J:return new g(+e);case Y:case nn:return new g(e);case en:return l=g(e.source,U.exec(e)),l.lastIndex=e.lastIndex,l}var d=In(e);if(n){var y=!r;r||(r=o()),s||(s=o());for(var m=r.length;m--;)if(r[m]==e)return s[m];l=d?g(e.length):{}}else l=d?u(e):qn({},e);return d&&(wn.call(e,"index")&&(l.index=e.index),wn.call(e,"input")&&(l.input=e.input)),n?(r.push(e),s.push(l),(d?Hn:$n)(e,function(e,o){l[o]=f(e,n,t,r,s)}),y&&(i(r),i(s)),l):l}function c(e){return P(e)?Pn(e):{}}function p(e,n,t){if("function"!=typeof e)return D;if("undefined"==typeof n||!("prototype"in e))return e;var r=e.__bindData__;if("undefined"==typeof r&&(Tn.funcNames&&(r=!e.name),r=r||!Tn.funcDecomp,!r)){var o=bn.call(e);Tn.funcNames||(r=!$.test(o)),r||(r=X.test(o),Fn(e,r))}if(r===!1||r!==!0&&1&r[1])return e;switch(t){case 1:return function(t){return e.call(n,t)};case 2:return function(t,r){return e.call(n,t,r)};case 3:return function(t,r,o){return e.call(n,t,r,o)};case 4:return function(t,r,o,a){return e.call(n,t,r,o,a)}}return I(e,n)}function g(e){function n(){var e=l?i:this;if(o){var m=u(o);xn.apply(m,arguments)}if((a||p)&&(m||(m=u(arguments)),a&&xn.apply(m,a),p&&m.length<s))return r|=16,g([t,d?r:-4&r,m,null,i,s]);if(m||(m=arguments),f&&(t=e[y]),this instanceof n){e=c(t.prototype);var h=t.apply(e,m);return P(h)?h:e}return t.apply(e,m)}var t=e[0],r=e[1],o=e[2],a=e[3],i=e[4],s=e[5],l=1&r,f=2&r,p=4&r,d=8&r,y=t;return Fn(n,e),n}function d(e,n,t,r,u,s){if(t){var l=t(e,n);if("undefined"!=typeof l)return!!l}if(e===n)return 0!==e||1/e==1/n;var f=typeof e,c=typeof n;if(!(e!==e||e&&an[f]||n&&an[c]))return!1;if(null==e||null==n)return e===n;var p=mn.call(e),g=mn.call(n);if(p==V&&(p=Z),g==V&&(g=Z),p!=g)return!1;switch(p){case z:case J:return+e==+n;case Y:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case en:case nn:return e==String(n)}var y=p==W;if(!y){var m=wn.call(e,"__wrapped__"),h=wn.call(n,"__wrapped__");if(m||h)return d(m?e.__wrapped__:e,h?n.__wrapped__:n,t,r,u,s);if(p!=Z||!Tn.nodeClass&&(a(e)||a(n)))return!1;var b=!Tn.argsObject&&x(e)?Object:e.constructor,v=!Tn.argsObject&&x(n)?Object:n.constructor;if(b!=v&&!(A(b)&&b instanceof b&&A(v)&&v instanceof v)&&"constructor"in e&&"constructor"in n)return!1}var w=!u;u||(u=o()),s||(s=o());for(var j=u.length;j--;)if(u[j]==e)return s[j]==n;var _=0;if(l=!0,u.push(e),s.push(n),y){if(j=e.length,_=n.length,l=_==j,l||r)for(;_--;){var P=j,k=n[_];if(r)for(;P--&&!(l=d(e[P],k,t,r,u,s)););else if(!(l=d(e[_],k,t,r,u,s)))break}}else Un(n,function(n,o,a){return wn.call(a,o)?(_++,l=wn.call(e,o)&&d(e[o],n,t,r,u,s)):void 0}),l&&!r&&Un(e,function(e,n,t){return wn.call(t,n)?l=--_>-1:void 0});return u.pop(),s.pop(),w&&(i(u),i(s)),l}function y(e,n,t,r,o){(In(n)?S:$n)(n,function(n,a){var i,u,s=n,l=e[a];if(n&&((u=In(n))||Xn(n))){for(var f=r.length;f--;)if(i=r[f]==n){l=o[f];break}if(!i){var c;t&&(s=t(l,n),(c="undefined"!=typeof s)&&(l=s)),c||(l=u?In(l)?l:[]:Xn(l)?l:{}),r.push(n),o.push(l),c||y(l,n,t,r,o)}}else t&&(s=t(l,n),"undefined"==typeof s&&(s=n)),"undefined"!=typeof s&&(l=s);e[a]=l})}function m(e,n,t,r,o,a){var i=1&n,s=2&n,f=4&n,c=16&n,p=32&n;if(!s&&!A(e))throw new TypeError;c&&!t.length&&(n&=-17,c=t=!1),p&&!r.length&&(n&=-33,p=r=!1);var d=e&&e.__bindData__;if(d&&d!==!0)return d=u(d),d[2]&&(d[2]=u(d[2])),d[3]&&(d[3]=u(d[3])),!i||1&d[1]||(d[4]=o),!i&&1&d[1]&&(n|=8),!f||4&d[1]||(d[5]=a),c&&xn.apply(d[2]||(d[2]=[]),t),p&&_n.apply(d[3]||(d[3]=[]),r),d[1]|=n,m.apply(null,d);var y=1==n||17===n?l:g;return y([e,n,t,r,o,a])}function h(){on.shadowedProps=G,on.array=on.bottom=on.loop=on.top="",on.init="iterable",on.useHas=!0;for(var e,n=0;e=arguments[n];n++)for(var t in e)on[t]=e[t];var r=on.args;on.firstArg=/^[^,]+/.exec(r)[0];var o=Function("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+r+") {\n"+Ln(on)+"\n}");return o(p,K,gn,wn,H,x,In,E,on.keys,dn,an,Sn,nn,yn,mn)}function b(){var n=(n=s.indexOf)===L?e:n;return n}function v(e){return"function"==typeof e&&hn.test(e)}function w(e){var n,t;return!e||mn.call(e)!=Z||(n=e.constructor,A(n)&&!(n instanceof n))||!Tn.argsClass&&x(e)||!Tn.nodeClass&&a(e)?!1:Tn.ownLast?(Un(e,function(e,n,r){return t=wn.call(r,n),!1}),t!==!1):(Un(e,function(e,n){t=n}),"undefined"==typeof t||wn.call(e,t))}function x(e){return e&&"object"==typeof e&&"number"==typeof e.length&&mn.call(e)==V||!1}function j(e,n,t,r){return"boolean"!=typeof n&&null!=n&&(r=t,t=n,n=!1),f(e,n,"function"==typeof t&&p(t,r,1))}function _(e){var n=!0;if(!e)return n;var t=mn.call(e),r=e.length;return t==W||t==nn||(Tn.argsClass?t==V:x(e))||t==Z&&"number"==typeof r&&A(e.splice)?!r:($n(e,function(){return n=!1}),n)}function A(e){return"function"==typeof e}function P(e){return!(!e||!an[typeof e])}function E(e){return"string"==typeof e||e&&"object"==typeof e&&mn.call(e)==nn||!1}function O(e){var n=arguments,t=2;if(!P(e))return e;if("number"!=typeof n[2]&&(t=n.length),t>3&&"function"==typeof n[t-2])var r=p(n[--t-1],n[t--],2);else t>2&&"function"==typeof n[t-1]&&(r=n[--t]);for(var a=u(arguments,1,t),s=-1,l=o(),f=o();++s<t;)y(e,a[s],r,l,f);return i(l),i(f),e}function C(e,n,t){var r=-1,o=b(),a=e?e.length:0,i=!1;return t=(0>t?On(0,a+t):t)||0,In(e)?i=o(e,n,t)>-1:"number"==typeof a?i=(E(e)?e.indexOf(n,t):o(e,n,t))>-1:Hn(e,function(e){return++r>=t?!(i=e===n):void 0}),i}function S(e,n,t){if(n&&"undefined"==typeof t&&In(e))for(var r=-1,o=e.length;++r<o&&n(e[r],r,e)!==!1;);else Hn(e,n,t);return e}function T(e){for(var n=-1,t=e?e.length:0,r=[];++n<t;){var o=e[n];o&&r.push(o)}return r}function L(n,t,r){if("number"==typeof r){var o=n?n.length:0;r=0>r?On(0,o+r):r||0}else if(r){var a=F(n,t);return n[a]===t?a:-1}return e(n,t,r)}function F(e,n,t,r){var o=0,a=e?e.length:o;for(t=t?s.createCallback(t,r,1):D,n=t(n);a>o;){var i=o+a>>>1;t(e[i])<n?o=i+1:a=i}return o}function I(e,n){return arguments.length>2?m(e,17,u(arguments,2),null,n):m(e,1,null,null,n)}function N(e,n,t){var r=typeof e;if(null==e||"function"==r)return p(e,n,t);if("object"!=r)return B(e);var o=Dn(e),a=o[0],i=e[a];return 1!=o.length||i!==i||P(i)?function(n){for(var t=o.length,r=!1;t--&&(r=d(n[o[t]],e[o[t]],null,!0)););return r}:function(e){var n=e[a];return i===n&&(0!==i||1/i==1/n)}}function D(e){return e}function M(){}function B(e){return function(n){return n[e]}}var R=[],H={},q=40,U=/\w*$/,$=/^\s*function[ \n\r\t]+\w/,X=/\bthis\b/,G=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],V="[object Arguments]",W="[object Array]",z="[object Boolean]",J="[object Date]",K="[object Error]",Q="[object Function]",Y="[object Number]",Z="[object Object]",en="[object RegExp]",nn="[object String]",tn={};tn[Q]=!1,tn[V]=tn[W]=tn[z]=tn[J]=tn[Y]=tn[Z]=tn[en]=tn[nn]=!0;var rn={configurable:!1,enumerable:!1,value:null,writable:!1},on={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},an={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},un=an[typeof window]&&window||this,sn=an[typeof t]&&t&&!t.nodeType&&t,ln=an[typeof n]&&n&&!n.nodeType&&n,fn=ln&&ln.exports===sn&&sn,cn=an[typeof r]&&r;!cn||cn.global!==cn&&cn.window!==cn||(un=cn);var pn=[],gn=Error.prototype,dn=Object.prototype,yn=String.prototype,mn=dn.toString,hn=RegExp("^"+String(mn).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),bn=Function.prototype.toString,vn=v(vn=Object.getPrototypeOf)&&vn,wn=dn.hasOwnProperty,xn=pn.push,jn=dn.propertyIsEnumerable,_n=pn.unshift,An=function(){try{var e={},n=v(n=Object.defineProperty)&&n,t=n(e,e,e)&&n}catch(r){}return t}(),Pn=v(Pn=Object.create)&&Pn,kn=v(kn=Array.isArray)&&kn,En=v(En=Object.keys)&&En,On=Math.max,Cn={};Cn[W]=Array,Cn[z]=Boolean,Cn[J]=Date,Cn[Q]=Function,Cn[Z]=Object,Cn[Y]=Number,Cn[en]=RegExp,Cn[nn]=String;var Sn={};Sn[W]=Sn[J]=Sn[Y]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Sn[z]=Sn[nn]={constructor:!0,toString:!0,valueOf:!0},Sn[K]=Sn[Q]=Sn[en]={constructor:!0,toString:!0},Sn[Z]={constructor:!0},function(){for(var e=G.length;e--;){var n=G[e];for(var t in Sn)wn.call(Sn,t)&&!wn.call(Sn[t],n)&&(Sn[t][n]=!1)}}();var Tn=s.support={};!function(){var e=function(){this.x=1},n={0:1,length:1},t=[];e.prototype={valueOf:1,y:1};for(var r in new e)t.push(r);for(r in arguments);Tn.argsClass=mn.call(arguments)==V,Tn.argsObject=arguments.constructor==Object&&!(arguments instanceof Array),Tn.enumErrorProps=jn.call(gn,"message")||jn.call(gn,"name"),Tn.enumPrototypes=jn.call(e,"prototype"),Tn.funcDecomp=!v(un.WinRTError)&&X.test(function(){return this}),Tn.funcNames="string"==typeof Function.name,Tn.nonEnumArgs=0!=r,Tn.nonEnumShadows=!/valueOf/.test(t),Tn.ownLast="x"!=t[0],Tn.spliceObjects=(pn.splice.call(n,0,1),!n[0]),Tn.unindexedChars="xx"!="x"[0]+Object("x")[0];try{Tn.nodeClass=!(mn.call(document)==Z&&!({toString:0}+""))}catch(o){Tn.nodeClass=!0}}(1);var Ln=function(e){var n="var index, iterable = "+e.firstArg+", result = "+e.init+";\nif (!iterable) return result;\n"+e.top+";";e.array?(n+="\nvar length = iterable.length; index = -1;\nif ("+e.array+") { ",Tn.unindexedChars&&(n+="\n if (isString(iterable)) {\n iterable = iterable.split('')\n } "),n+="\n while (++index < length) {\n "+e.loop+";\n }\n}\nelse { "):Tn.nonEnumArgs&&(n+="\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += '';\n "+e.loop+";\n }\n } else { "),Tn.enumPrototypes&&(n+="\n var skipProto = typeof iterable == 'function';\n "),Tn.enumErrorProps&&(n+="\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ");var t=[];if(Tn.enumPrototypes&&t.push('!(skipProto && index == "prototype")'),Tn.enumErrorProps&&t.push('!(skipErrorProps && (index == "message" || index == "name"))'),e.useHas&&e.keys)n+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n",t.length&&(n+=" if ("+t.join(" && ")+") {\n "),n+=e.loop+"; ",t.length&&(n+="\n }"),n+="\n } ";else if(n+="\n for (index in iterable) {\n",e.useHas&&t.push("hasOwnProperty.call(iterable, index)"),t.length&&(n+=" if ("+t.join(" && ")+") {\n "),n+=e.loop+"; ",t.length&&(n+="\n }"),n+="\n } ",Tn.nonEnumShadows){for(n+="\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ",k=0;7>k;k++)n+="\n index = '"+e.shadowedProps[k]+"';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",e.useHas||(n+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),n+=") {\n "+e.loop+";\n } ";n+="\n } "}return(e.array||Tn.nonEnumArgs)&&(n+="\n}"),n+=e.bottom+";\nreturn result"};Pn||(c=function(){function e(){}return function(n){if(P(n)){e.prototype=n;var t=new e;e.prototype=null}return t||un.Object()}}());var Fn=An?function(e,n){rn.value=n,An(e,"__bindData__",rn)}:M;Tn.argsClass||(x=function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&wn.call(e,"callee")&&!jn.call(e,"callee")||!1});var In=kn||function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&mn.call(e)==W||!1},Nn=h({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),Dn=En?function(e){return P(e)?Tn.enumPrototypes&&"function"==typeof e||Tn.nonEnumArgs&&e.length&&x(e)?Nn(e):En(e):[]}:Nn,Mn={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:Dn,loop:"if (callback(iterable[index], index, collection) === false) return result"},Bn={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",keys:Dn,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},Rn={top:"if (!objectTypes[typeof iterable]) return result;\n"+Mn.top,array:!1},Hn=h(Mn),qn=h(Bn,{top:Bn.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),Un=h(Mn,Rn,{useHas:!1}),$n=h(Mn,Rn);A(/x/)&&(A=function(e){return"function"==typeof e&&mn.call(e)==Q});var Xn=vn?function(e){if(!e||mn.call(e)!=Z||!Tn.argsClass&&x(e))return!1;var n=e.valueOf,t=v(n)&&(t=vn(n))&&vn(t);return t?e==t||vn(e)==t:w(e)}:w;s.assign=qn,s.bind=I,s.compact=T,s.createCallback=N,s.forEach=S,s.forIn=Un,s.forOwn=$n,s.keys=Dn,s.merge=O,s.property=B,s.each=S,s.extend=qn,s.clone=j,s.contains=C,s.identity=D,s.indexOf=L,s.isArguments=x,s.isArray=In,s.isEmpty=_,s.isFunction=A,s.isObject=P,s.isPlainObject=Xn,s.isString=E,s.noop=M,s.sortedIndex=F,s.include=C,s.VERSION="2.4.1",sn&&ln&&fn&&((ln.exports=s)._=s)}).call(this)},{}],3:[function(e,n){function t(e,n){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(r(t,n)),e;case"Feature":return e.geometry=t(e.geometry,n),e;case"Polygon":case"MultiPolygon":return o(e,n);default:return e}}function r(e,n){return function(t){return e(t,n)}}function o(e,n){return"Polygon"===e.type?e.coordinates=a(e.coordinates,n):"MultiPolygon"===e.type&&(e.coordinates=e.coordinates.map(r(a,n))),e}function a(e,n){n=!!n,e[0]=i(e[0],!n);for(var t=1;t<e.length;t++)e[t]=i(e[t],n);return e}function i(e,n){return u(e)===n?e:e.reverse()}function u(e){return s.ring(e)>=0}var s=e("geojson-area");n.exports=t},{"geojson-area":4}],4:[function(e,n){function t(e){if("Polygon"===e.type)return r(e.coordinates);if("MultiPolygon"===e.type){for(var n=0,t=0;t<e.coordinates.length;t++)n+=r(e.coordinates[t]);return n}return null}function r(e){var n=0;if(e&&e.length>0){n+=Math.abs(o(e[0]));for(var t=1;t<e.length;t++)n-=Math.abs(o(e[t]))}return n}function o(e){var n=0;if(e.length>2){for(var t,r,o=0;o<e.length-1;o++)t=e[o],r=e[o+1],n+=a(r[0]-t[0])*(2+Math.sin(a(t[1]))+Math.sin(a(r[1])));n=n*i.RADIUS*i.RADIUS/2}return n}function a(e){return e*Math.PI/180}var i=e("wgs84");n.exports.geometry=t,n.exports.ring=o},{wgs84:5}],5:[function(e,n){n.exports.RADIUS=6378137,n.exports.FLATTENING=1/298.257223563,n.exports.POLAR_RADIUS=6356752.3142},{}],6:[function(e,n){n.exports={building:!0,highway:{included_values:{services:!0,rest_area:!0,escape:!0}},natural:{excluded_values:{coastline:!0,ridge:!0,arete:!0,tree_row:!0}},landuse:!0,waterway:{included_values:{riverbank:!0,dock:!0,boatyard:!0,dam:!0}},amenity:!0,leisure:!0,barrier:{included_values:{city_wall:!0,ditch:!0,hedge:!0,retaining_wall:!0,wall:!0,spikes:!0}},railway:{included_values:{station:!0,turntable:!0,roundhouse:!0,platform:!0}},area:!0,boundary:!0,man_made:{excluded_values:{cutline:!0,embankment:!0,pipeline:!0}},power:{included_values:{generator:!0,station:!0,sub_station:!0,transformer:!0}},place:!0,shop:!0,aeroway:{excluded_values:{taxiway:!0}},tourism:!0,historic:!0,public_transport:!0,office:!0,"building:part":!0,military:!0,ruins:!0,"area:highway":!0,craft:!0}},{}]},{},[1])(1)});
+!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.osmtogeojson=e():"undefined"!=typeof global?global.osmtogeojson=e():"undefined"!=typeof self&&(self.osmtogeojson=e())}(function(){return function e(n,r,t){function o(i,u){if(!r[i]){if(!n[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);throw new Error("Cannot find module '"+i+"'")}var l=r[i]={exports:{}};n[i][0].call(l.exports,function(e){var r=n[i][1][e];return o(r?r:e)},l,l.exports,e,n,r,t)}return r[i].exports}for(var a="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(e,n){var r=e("./lodash.custom.js"),t=e("geojson-rewind"),o=e("./polygon_features.json"),a={};a=function(e,n){function a(e){for(var n=new Array,t=new Array,o=new Array,a=0;a<e.elements.length;a++)switch(e.elements[a].type){case"node":var i=e.elements[a];n.push(i);break;case"way":var s=r.clone(e.elements[a]);s.nodes=r.clone(s.nodes),t.push(s);break;case"relation":var l=r.clone(e.elements[a]);l.members=r.clone(l.members),o.push(l)}return u(n,t,o)}function i(e){function n(e,n,r){e.hasAttribute(r)&&(n[r]=e.getAttribute(r))}var t=new Array,o=new Array,a=new Array;return r.each(e.getElementsByTagName("node"),function(e,o){var a={};r.each(e.getElementsByTagName("tag"),function(e){a[e.getAttribute("k")]=e.getAttribute("v")}),t[o]={type:"node"},n(e,t[o],"id"),n(e,t[o],"lat"),n(e,t[o],"lon"),n(e,t[o],"version"),n(e,t[o],"timestamp"),n(e,t[o],"changeset"),n(e,t[o],"uid"),n(e,t[o],"user"),r.isEmpty(a)||(t[o].tags=a)}),r.each(e.getElementsByTagName("way"),function(e,t){var a={},i=[];r.each(e.getElementsByTagName("tag"),function(e){a[e.getAttribute("k")]=e.getAttribute("v")}),r.each(e.getElementsByTagName("nd"),function(e,n){i[n]=e.getAttribute("ref")}),o[t]={type:"way"},n(e,o[t],"id"),n(e,o[t],"version"),n(e,o[t],"timestamp"),n(e,o[t],"changeset"),n(e,o[t],"uid"),n(e,o[t],"user"),i.length>0&&(o[t].nodes=i),r.isEmpty(a)||(o[t].tags=a)}),r.each(e.getElementsByTagName("relation"),function(e,t){var o={},i=[];r.each(e.getElementsByTagName("tag"),function(e){o[e.getAttribute("k")]=e.getAttribute("v")}),r.each(e.getElementsByTagName("member"),function(e,r){i[r]={},n(e,i[r],"ref"),n(e,i[r],"role"),n(e,i[r],"type")}),a[t]={type:"relation"},n(e,a[t],"id"),n(e,a[t],"version"),n(e,a[t],"timestamp"),n(e,a[t],"changeset"),n(e,a[t],"uid"),n(e,a[t],"user"),i.length>0&&(a[t].members=i),r.isEmpty(o)||(a[t].tags=o)}),u(t,o,a)}function u(e,o,a){function i(e,r){if("object"!=typeof r&&(r={}),"function"==typeof n.uninterestingTags)return!n.uninterestingTags(e,r);for(var t in e)if(n.uninterestingTags[t]!==!0&&r[t]!==!0&&r[t]!==e[t])return!0;return!1}function u(e){var n={timestamp:e.timestamp,version:e.version,changeset:e.changeset,user:e.user,uid:e.uid};for(k in n)void 0===n[k]&&delete n[k];return n}function l(e,n){function t(e){for(var n,r,t,o,a,i,u=function(e){return e[0]},s=function(e){return e[e.length-1]},l=[];e.length;)for(n=e.pop().nodes.slice(),l.push(n);e.length&&u(n)!==s(n);){for(r=u(n),t=s(n),o=0;o<e.length;o++){if(i=e[o].nodes,t===u(i)){a=n.push,i=i.slice(1);break}if(t===s(i)){a=n.push,i=i.slice(0,-1).reverse();break}if(r==s(i)){a=n.unshift,i=i.slice(0,-1);break}if(r==u(i)){a=n.unshift,i=i.slice(1).reverse();break}i=a=null}if(!i)break;e.splice(o,1),a.apply(n,i)}return l}function o(e){var n,r,t=function(e,n){for(var r=0;r<n.length;r++)if(a(n[r],e))return!0;return!1},o=function(e){return e.map(function(e){return[+e.lat,+e.lon]})},a=function(e,n){for(var r=e[0],t=e[1],o=!1,a=0,i=n.length-1;a<n.length;i=a++){var u=n[a][0],s=n[a][1],l=n[i][0],f=n[i][1],c=s>t!=f>t&&(l-u)*(t-s)/(f-s)+u>r;c&&(o=!o)}return o};for(e=o(e),n=0;n<s.length;n++)if(r=o(s[n]),t(r,e))return n}var a,i=!1;a=n.members.filter(function(e){return"way"===e.type}),a=a.map(function(e){var n=d[e.ref];return void 0===n?(i=!0,void 0):{id:e.ref,role:e.role||"outer",way:n,nodes:n.nodes.filter(function(e){return void 0!==e?!0:(i=!0,!1)})}}),a=r.compact(a);var s,l;s=t(a.filter(function(e){return"outer"===e.role})),l=t(a.filter(function(e){return"inner"===e.role}));var f;f=s.map(function(e){return[e]});for(var c=0;c<l.length;c++){var p=o(l[c]);void 0!==p&&f[p].push(l[c])}var g=[];if(g=r.compact(f.map(function(e){var n=r.compact(e.map(function(e){return e.length<4?void 0:r.compact(e.map(function(e){return[+e.lon,+e.lat]}))}));if(0!=n.length)return n})),0==g.length)return!1;var y="MultiPolygon";1===g.length&&(y="Polygon",g=g[0]);var m={type:"Feature",id:e.type+"/"+e.id,properties:{type:e.type,id:e.id,tags:e.tags||{},relations:b[e.type][e.id]||[],meta:u(e)},geometry:{type:y,coordinates:g}};return i&&(m.properties.tainted=!0),m}for(var f=new Object,c=0;c<e.length;c++)void 0!==e[c].lat&&(f[e[c].id]=e[c]);for(var p=new Object,c=0;c<e.length;c++)"undefined"!=typeof e[c].tags&&i(e[c].tags)&&(p[e[c].id]=!0);for(var c=0;c<a.length;c++)if(r.isArray(a[c].members))for(var g=0;g<a[c].members.length;g++)"node"==a[c].members[g].type&&(p[a[c].members[g].ref]=!0);for(var d=new Object,y=new Object,c=0;c<o.length;c++)if(r.isArray(o[c].nodes)){d[o[c].id]=o[c];for(var g=0;g<o[c].nodes.length;g++)y[o[c].nodes[g]]=!0,o[c].nodes[g]=f[o[c].nodes[g]]}for(var m=new Array,c=0;c<e.length;c++)(!y[e[c].id]||p[e[c].id])&&m.push(e[c]);for(var h=new Array,c=0;c<a.length;c++)r.isArray(a[c].members)&&(h[a[c].id]=a[c]);for(var b={node:{},way:{},relation:{}},c=0;c<a.length;c++)if(r.isArray(a[c].members))for(var g=0;g<a[c].members.length;g++){var v;switch(a[c].members[g].type){case"node":v=f[a[c].members[g].ref];break;case"way":v=d[a[c].members[g].ref];break;case"relation":v=h[a[c].members[g].ref]}if(v){var w=a[c].members[g].type,x=a[c].members[g].ref;"undefined"==typeof b[w][x]&&(b[w][x]=[]),b[w][x].push({role:a[c].members[g].role,rel:a[c].id,reltags:a[c].tags})}}var j,_={type:"FeatureCollection",features:new Array};for(c=0;c<m.length;c++)"undefined"!=typeof m[c].lon&&"undefined"!=typeof m[c].lat&&_.features.push({type:"Feature",id:"node/"+m[c].id,properties:{type:"node",id:m[c].id,tags:m[c].tags||{},relations:b.node[m[c].id]||[],meta:u(m[c])},geometry:{type:"Point",coordinates:[+m[c].lon,+m[c].lat]}});for(var A={type:"FeatureCollection",features:new Array},P={type:"FeatureCollection",features:new Array},c=0;c<a.length;c++)if("undefined"!=typeof a[c].tags&&("multipolygon"==a[c].tags.type||"boundary"==a[c].tags.type)){if(!r.isArray(a[c].members))continue;for(var E=0,g=0;g<a[c].members.length;g++)"outer"==a[c].members[g].role&&E++;if(a[c].members.forEach(function(e){d[e.ref]&&("outer"!==e.role||i(d[e.ref].tags,a[c].tags)||(d[e.ref].is_multipolygon_outline=!0),"inner"!==e.role||i(d[e.ref].tags)||(d[e.ref].is_multipolygon_outline=!0))}),0==E)continue;var O=!1;1!=E||i(a[c].tags,{type:!0})||(O=!0);var C=null;if(O){var S=a[c].members.filter(function(e){return"outer"===e.role})[0];if(S=d[S.ref],void 0===S)continue;S.is_multipolygon_outline=!0,C=l(S,a[c])}else C=l(a[c],a[c]);if(C===!1)continue;P.features.push(C)}for(var c=0;c<o.length;c++)if(r.isArray(o[c].nodes)&&!o[c].is_multipolygon_outline){for(o[c].tainted=!1,o[c].hidden=!1,coords=new Array,g=0;g<o[c].nodes.length;g++)"object"==typeof o[c].nodes[g]?coords.push([+o[c].nodes[g].lon,+o[c].nodes[g].lat]):o[c].tainted=!0;if(!(coords.length<=1)){var T="LineString";"undefined"!=typeof o[c].nodes[0]&&o[c].nodes[0]===o[c].nodes[o[c].nodes.length-1]&&"undefined"!=typeof o[c].tags&&s(o[c].tags)&&(T="Polygon",coords=[coords]);var C={type:"Feature",id:"way/"+o[c].id,properties:{type:"way",id:o[c].id,tags:o[c].tags||{},relations:b.way[o[c].id]||[],meta:u(o[c])},geometry:{type:T,coordinates:coords}};o[c].tainted&&(C.properties.tainted=!0),"LineString"==T?A.features.push(C):P.features.push(C)}}return j={type:"FeatureCollection",features:[]},j.features=j.features.concat(P.features),j.features=j.features.concat(A.features),j.features=j.features.concat(_.features),n.flatProperties&&j.features.forEach(function(e){e.properties=r.merge(e.properties.meta,e.properties.tags,{id:e.properties.type+"/"+e.properties.id})}),j=t(j,!0)}function s(e){var r=n.polygonFeatures;if("function"==typeof r)return r(e);if("no"===e.area)return!1;for(var t in e){var o=e[t],a=r[t];if("undefined"!=typeof a&&"no"!==o){if(a===!0)return!0;if(a.included_values&&a.included_values[o]===!0)return!0;if(a.excluded_values&&a.excluded_values[o]!==!0)return!0}}return!1}n=r.merge({flatProperties:!1,uninterestingTags:{source:!0,source_ref:!0,"source:ref":!0,history:!0,attribution:!0,created_by:!0,"tiger:county":!0,"tiger:tlid":!0,"tiger:upload_uuid":!0},polygonFeatures:o},n);var l;return l="undefined"!=typeof XMLDocument&&e instanceof XMLDocument||"undefined"==typeof XMLDocument&&e.childNodes?i(e):a(e)},a.toGeojson=a,n.exports=a},{"./lodash.custom.js":2,"./polygon_features.json":6,"geojson-rewind":3}],2:[function(e,n,r){var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(){function e(e,n,r){for(var t=(r||0)-1,o=e?e.length:0;++t<o;)if(e[t]===n)return t;return-1}function o(){return R.pop()||[]}function a(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}function i(e){e.length=0,R.length<q&&R.push(e)}function u(e,n,r){n||(n=0),"undefined"==typeof r&&(r=e?e.length:0);for(var t=-1,o=r-n||0,a=Array(0>o?0:o);++t<o;)a[t]=e[n+t];return a}function s(){}function l(e){function n(){if(t){var e=u(t);xn.apply(e,arguments)}if(this instanceof n){var a=c(r.prototype),i=r.apply(a,e||arguments);return P(i)?i:a}return r.apply(o,e||arguments)}var r=e[0],t=e[2],o=e[4];return In(n,e),n}function f(e,n,r,t,s){if(r){var l=r(e);if("undefined"!=typeof l)return l}var c=P(e);if(!c)return e;var p=mn.call(e);if(!rn[p]||!Tn.nodeClass&&a(e))return e;var g=Cn[p];switch(p){case z:case J:return new g(+e);case Y:case nn:return new g(e);case en:return l=g(e.source,U.exec(e)),l.lastIndex=e.lastIndex,l}var d=Nn(e);if(n){var y=!t;t||(t=o()),s||(s=o());for(var m=t.length;m--;)if(t[m]==e)return s[m];l=d?g(e.length):{}}else l=d?u(e):qn({},e);return d&&(wn.call(e,"index")&&(l.index=e.index),wn.call(e,"input")&&(l.input=e.input)),n?(t.push(e),s.push(l),(d?Hn:$n)(e,function(e,o){l[o]=f(e,n,r,t,s)}),y&&(i(t),i(s)),l):l}function c(e){return P(e)?kn(e):{}}function p(e,n,r){if("function"!=typeof e)return D;if("undefined"==typeof n||!("prototype"in e))return e;var t=e.__bindData__;if("undefined"==typeof t&&(Tn.funcNames&&(t=!e.name),t=t||!Tn.funcDecomp,!t)){var o=bn.call(e);Tn.funcNames||(t=!$.test(o)),t||(t=X.test(o),In(e,t))}if(t===!1||t!==!0&&1&t[1])return e;switch(r){case 1:return function(r){return e.call(n,r)};case 2:return function(r,t){return e.call(n,r,t)};case 3:return function(r,t,o){return e.call(n,r,t,o)};case 4:return function(r,t,o,a){return e.call(n,r,t,o,a)}}return N(e,n)}function g(e){function n(){var e=l?i:this;if(o){var m=u(o);xn.apply(m,arguments)}if((a||p)&&(m||(m=u(arguments)),a&&xn.apply(m,a),p&&m.length<s))return t|=16,g([r,d?t:-4&t,m,null,i,s]);if(m||(m=arguments),f&&(r=e[y]),this instanceof n){e=c(r.prototype);var h=r.apply(e,m);return P(h)?h:e}return r.apply(e,m)}var r=e[0],t=e[1],o=e[2],a=e[3],i=e[4],s=e[5],l=1&t,f=2&t,p=4&t,d=8&t,y=r;return In(n,e),n}function d(e,n,r,t,u,s){if(r){var l=r(e,n);if("undefined"!=typeof l)return!!l}if(e===n)return 0!==e||1/e==1/n;var f=typeof e,c=typeof n;if(!(e!==e||e&&an[f]||n&&an[c]))return!1;if(null==e||null==n)return e===n;var p=mn.call(e),g=mn.call(n);if(p==V&&(p=Z),g==V&&(g=Z),p!=g)return!1;switch(p){case z:case J:return+e==+n;case Y:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case en:case nn:return e==String(n)}var y=p==W;if(!y){var m=wn.call(e,"__wrapped__"),h=wn.call(n,"__wrapped__");if(m||h)return d(m?e.__wrapped__:e,h?n.__wrapped__:n,r,t,u,s);if(p!=Z||!Tn.nodeClass&&(a(e)||a(n)))return!1;var b=!Tn.argsObject&&x(e)?Object:e.constructor,v=!Tn.argsObject&&x(n)?Object:n.constructor;if(b!=v&&!(A(b)&&b instanceof b&&A(v)&&v instanceof v)&&"constructor"in e&&"constructor"in n)return!1}var w=!u;u||(u=o()),s||(s=o());for(var j=u.length;j--;)if(u[j]==e)return s[j]==n;var _=0;if(l=!0,u.push(e),s.push(n),y){if(j=e.length,_=n.length,l=_==j,l||t)for(;_--;){var k=j,P=n[_];if(t)for(;k--&&!(l=d(e[k],P,r,t,u,s)););else if(!(l=d(e[_],P,r,t,u,s)))break}}else Un(n,function(n,o,a){return wn.call(a,o)?(_++,l=wn.call(e,o)&&d(e[o],n,r,t,u,s)):void 0}),l&&!t&&Un(e,function(e,n,r){return wn.call(r,n)?l=--_>-1:void 0});return u.pop(),s.pop(),w&&(i(u),i(s)),l}function y(e,n,r,t,o){(Nn(n)?S:$n)(n,function(n,a){var i,u,s=n,l=e[a];if(n&&((u=Nn(n))||Xn(n))){for(var f=t.length;f--;)if(i=t[f]==n){l=o[f];break}if(!i){var c;r&&(s=r(l,n),(c="undefined"!=typeof s)&&(l=s)),c||(l=u?Nn(l)?l:[]:Xn(l)?l:{}),t.push(n),o.push(l),c||y(l,n,r,t,o)}}else r&&(s=r(l,n),"undefined"==typeof s&&(s=n)),"undefined"!=typeof s&&(l=s);e[a]=l})}function m(e,n,r,t,o,a){var i=1&n,s=2&n,f=4&n,c=16&n,p=32&n;if(!s&&!A(e))throw new TypeError;c&&!r.length&&(n&=-17,c=r=!1),p&&!t.length&&(n&=-33,p=t=!1);var d=e&&e.__bindData__;if(d&&d!==!0)return d=u(d),d[2]&&(d[2]=u(d[2])),d[3]&&(d[3]=u(d[3])),!i||1&d[1]||(d[4]=o),!i&&1&d[1]&&(n|=8),!f||4&d[1]||(d[5]=a),c&&xn.apply(d[2]||(d[2]=[]),r),p&&_n.apply(d[3]||(d[3]=[]),t),d[1]|=n,m.apply(null,d);var y=1==n||17===n?l:g;return y([e,n,r,t,o,a])}function h(){on.shadowedProps=G,on.array=on.bottom=on.loop=on.top="",on.init="iterable",on.useHas=!0;for(var e,n=0;e=arguments[n];n++)for(var r in e)on[r]=e[r];var t=on.args;on.firstArg=/^[^,]+/.exec(t)[0];var o=Function("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+t+") {\n"+Ln(on)+"\n}");return o(p,K,gn,wn,H,x,Nn,E,on.keys,dn,an,Sn,nn,yn,mn)}function b(){var n=(n=s.indexOf)===L?e:n;return n}function v(e){return"function"==typeof e&&hn.test(e)}function w(e){var n,r;return!e||mn.call(e)!=Z||(n=e.constructor,A(n)&&!(n instanceof n))||!Tn.argsClass&&x(e)||!Tn.nodeClass&&a(e)?!1:Tn.ownLast?(Un(e,function(e,n,t){return r=wn.call(t,n),!1}),r!==!1):(Un(e,function(e,n){r=n}),"undefined"==typeof r||wn.call(e,r))}function x(e){return e&&"object"==typeof e&&"number"==typeof e.length&&mn.call(e)==V||!1}function j(e,n,r,t){return"boolean"!=typeof n&&null!=n&&(t=r,r=n,n=!1),f(e,n,"function"==typeof r&&p(r,t,1))}function _(e){var n=!0;if(!e)return n;var r=mn.call(e),t=e.length;return r==W||r==nn||(Tn.argsClass?r==V:x(e))||r==Z&&"number"==typeof t&&A(e.splice)?!t:($n(e,function(){return n=!1}),n)}function A(e){return"function"==typeof e}function P(e){return!(!e||!an[typeof e])}function E(e){return"string"==typeof e||e&&"object"==typeof e&&mn.call(e)==nn||!1}function O(e){var n=arguments,r=2;if(!P(e))return e;if("number"!=typeof n[2]&&(r=n.length),r>3&&"function"==typeof n[r-2])var t=p(n[--r-1],n[r--],2);else r>2&&"function"==typeof n[r-1]&&(t=n[--r]);for(var a=u(arguments,1,r),s=-1,l=o(),f=o();++s<r;)y(e,a[s],t,l,f);return i(l),i(f),e}function C(e,n,r){var t=-1,o=b(),a=e?e.length:0,i=!1;return r=(0>r?On(0,a+r):r)||0,Nn(e)?i=o(e,n,r)>-1:"number"==typeof a?i=(E(e)?e.indexOf(n,r):o(e,n,r))>-1:Hn(e,function(e){return++t>=r?!(i=e===n):void 0}),i}function S(e,n,r){if(n&&"undefined"==typeof r&&Nn(e))for(var t=-1,o=e.length;++t<o&&n(e[t],t,e)!==!1;);else Hn(e,n,r);return e}function T(e){for(var n=-1,r=e?e.length:0,t=[];++n<r;){var o=e[n];o&&t.push(o)}return t}function L(n,r,t){if("number"==typeof t){var o=n?n.length:0;t=0>t?On(0,o+t):t||0}else if(t){var a=I(n,r);return n[a]===r?a:-1}return e(n,r,t)}function I(e,n,r,t){var o=0,a=e?e.length:o;for(r=r?s.createCallback(r,t,1):D,n=r(n);a>o;){var i=o+a>>>1;r(e[i])<n?o=i+1:a=i}return o}function N(e,n){return arguments.length>2?m(e,17,u(arguments,2),null,n):m(e,1,null,null,n)}function F(e,n,r){var t=typeof e;if(null==e||"function"==t)return p(e,n,r);if("object"!=t)return B(e);var o=Dn(e),a=o[0],i=e[a];return 1!=o.length||i!==i||P(i)?function(n){for(var r=o.length,t=!1;r--&&(t=d(n[o[r]],e[o[r]],null,!0)););return t}:function(e){var n=e[a];return i===n&&(0!==i||1/i==1/n)}}function D(e){return e}function M(){}function B(e){return function(n){return n[e]}}var R=[],H={},q=40,U=/\w*$/,$=/^\s*function[ \n\r\t]+\w/,X=/\bthis\b/,G=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],V="[object Arguments]",W="[object Array]",z="[object Boolean]",J="[object Date]",K="[object Error]",Q="[object Function]",Y="[object Number]",Z="[object Object]",en="[object RegExp]",nn="[object String]",rn={};rn[Q]=!1,rn[V]=rn[W]=rn[z]=rn[J]=rn[Y]=rn[Z]=rn[en]=rn[nn]=!0;var tn={configurable:!1,enumerable:!1,value:null,writable:!1},on={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},an={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},un=an[typeof window]&&window||this,sn=an[typeof r]&&r&&!r.nodeType&&r,ln=an[typeof n]&&n&&!n.nodeType&&n,fn=ln&&ln.exports===sn&&sn,cn=an[typeof t]&&t;!cn||cn.global!==cn&&cn.window!==cn||(un=cn);var pn=[],gn=Error.prototype,dn=Object.prototype,yn=String.prototype,mn=dn.toString,hn=RegExp("^"+String(mn).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),bn=Function.prototype.toString,vn=v(vn=Object.getPrototypeOf)&&vn,wn=dn.hasOwnProperty,xn=pn.push,jn=dn.propertyIsEnumerable,_n=pn.unshift,An=function(){try{var e={},n=v(n=Object.defineProperty)&&n,r=n(e,e,e)&&n}catch(t){}return r}(),kn=v(kn=Object.create)&&kn,Pn=v(Pn=Array.isArray)&&Pn,En=v(En=Object.keys)&&En,On=Math.max,Cn={};Cn[W]=Array,Cn[z]=Boolean,Cn[J]=Date,Cn[Q]=Function,Cn[Z]=Object,Cn[Y]=Number,Cn[en]=RegExp,Cn[nn]=String;var Sn={};Sn[W]=Sn[J]=Sn[Y]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Sn[z]=Sn[nn]={constructor:!0,toString:!0,valueOf:!0},Sn[K]=Sn[Q]=Sn[en]={constructor:!0,toString:!0},Sn[Z]={constructor:!0},function(){for(var e=G.length;e--;){var n=G[e];for(var r in Sn)wn.call(Sn,r)&&!wn.call(Sn[r],n)&&(Sn[r][n]=!1)}}();var Tn=s.support={};!function(){var e=function(){this.x=1},n={0:1,length:1},r=[];e.prototype={valueOf:1,y:1};for(var t in new e)r.push(t);for(t in arguments);Tn.argsClass=mn.call(arguments)==V,Tn.argsObject=arguments.constructor==Object&&!(arguments instanceof Array),Tn.enumErrorProps=jn.call(gn,"message")||jn.call(gn,"name"),Tn.enumPrototypes=jn.call(e,"prototype"),Tn.funcDecomp=!v(un.WinRTError)&&X.test(function(){return this}),Tn.funcNames="string"==typeof Function.name,Tn.nonEnumArgs=0!=t,Tn.nonEnumShadows=!/valueOf/.test(r),Tn.ownLast="x"!=r[0],Tn.spliceObjects=(pn.splice.call(n,0,1),!n[0]),Tn.unindexedChars="xx"!="x"[0]+Object("x")[0];try{Tn.nodeClass=!(mn.call(document)==Z&&!({toString:0}+""))}catch(o){Tn.nodeClass=!0}}(1);var Ln=function(e){var n="var index, iterable = "+e.firstArg+", result = "+e.init+";\nif (!iterable) return result;\n"+e.top+";";e.array?(n+="\nvar length = iterable.length; index = -1;\nif ("+e.array+") { ",Tn.unindexedChars&&(n+="\n if (isString(iterable)) {\n iterable = iterable.split('')\n } "),n+="\n while (++index < length) {\n "+e.loop+";\n }\n}\nelse { "):Tn.nonEnumArgs&&(n+="\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += '';\n "+e.loop+";\n }\n } else { "),Tn.enumPrototypes&&(n+="\n var skipProto = typeof iterable == 'function';\n "),Tn.enumErrorProps&&(n+="\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ");var r=[];if(Tn.enumPrototypes&&r.push('!(skipProto && index == "prototype")'),Tn.enumErrorProps&&r.push('!(skipErrorProps && (index == "message" || index == "name"))'),e.useHas&&e.keys)n+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n",r.length&&(n+=" if ("+r.join(" && ")+") {\n "),n+=e.loop+"; ",r.length&&(n+="\n }"),n+="\n } ";else if(n+="\n for (index in iterable) {\n",e.useHas&&r.push("hasOwnProperty.call(iterable, index)"),r.length&&(n+=" if ("+r.join(" && ")+") {\n "),n+=e.loop+"; ",r.length&&(n+="\n }"),n+="\n } ",Tn.nonEnumShadows){for(n+="\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ",k=0;7>k;k++)n+="\n index = '"+e.shadowedProps[k]+"';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",e.useHas||(n+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),n+=") {\n "+e.loop+";\n } ";n+="\n } "}return(e.array||Tn.nonEnumArgs)&&(n+="\n}"),n+=e.bottom+";\nreturn result"};kn||(c=function(){function e(){}return function(n){if(P(n)){e.prototype=n;var r=new e;e.prototype=null}return r||un.Object()}}());var In=An?function(e,n){tn.value=n,An(e,"__bindData__",tn)}:M;Tn.argsClass||(x=function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&wn.call(e,"callee")&&!jn.call(e,"callee")||!1});var Nn=Pn||function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&mn.call(e)==W||!1},Fn=h({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),Dn=En?function(e){return P(e)?Tn.enumPrototypes&&"function"==typeof e||Tn.nonEnumArgs&&e.length&&x(e)?Fn(e):En(e):[]}:Fn,Mn={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:Dn,loop:"if (callback(iterable[index], index, collection) === false) return result"},Bn={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",keys:Dn,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},Rn={top:"if (!objectTypes[typeof iterable]) return result;\n"+Mn.top,array:!1},Hn=h(Mn),qn=h(Bn,{top:Bn.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),Un=h(Mn,Rn,{useHas:!1}),$n=h(Mn,Rn);A(/x/)&&(A=function(e){return"function"==typeof e&&mn.call(e)==Q});var Xn=vn?function(e){if(!e||mn.call(e)!=Z||!Tn.argsClass&&x(e))return!1;var n=e.valueOf,r=v(n)&&(r=vn(n))&&vn(r);return r?e==r||vn(e)==r:w(e)}:w;s.assign=qn,s.bind=N,s.compact=T,s.createCallback=F,s.forEach=S,s.forIn=Un,s.forOwn=$n,s.keys=Dn,s.merge=O,s.property=B,s.each=S,s.extend=qn,s.clone=j,s.contains=C,s.identity=D,s.indexOf=L,s.isArguments=x,s.isArray=Nn,s.isEmpty=_,s.isFunction=A,s.isObject=P,s.isPlainObject=Xn,s.isString=E,s.noop=M,s.sortedIndex=I,s.include=C,s.VERSION="2.4.1",sn&&ln&&fn&&((ln.exports=s)._=s)}).call(this)},{}],3:[function(e,n){function r(e,n){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(t(r,n)),e;case"Feature":return e.geometry=r(e.geometry,n),e;case"Polygon":case"MultiPolygon":return o(e,n);default:return e}}function t(e,n){return function(r){return e(r,n)}}function o(e,n){return"Polygon"===e.type?e.coordinates=a(e.coordinates,n):"MultiPolygon"===e.type&&(e.coordinates=e.coordinates.map(t(a,n))),e}function a(e,n){n=!!n,e[0]=i(e[0],!n);for(var r=1;r<e.length;r++)e[r]=i(e[r],n);return e}function i(e,n){return u(e)===n?e:e.reverse()}function u(e){return s.ring(e)>=0}var s=e("geojson-area");n.exports=r},{"geojson-area":4}],4:[function(e,n){function r(e){if("Polygon"===e.type)return t(e.coordinates);if("MultiPolygon"===e.type){for(var n=0,r=0;r<e.coordinates.length;r++)n+=t(e.coordinates[r]);return n}return null}function t(e){var n=0;if(e&&e.length>0){n+=Math.abs(o(e[0]));for(var r=1;r<e.length;r++)n-=Math.abs(o(e[r]))}return n}function o(e){var n=0;if(e.length>2){for(var r,t,o=0;o<e.length-1;o++)r=e[o],t=e[o+1],n+=a(t[0]-r[0])*(2+Math.sin(a(r[1]))+Math.sin(a(t[1])));n=n*i.RADIUS*i.RADIUS/2}return n}function a(e){return e*Math.PI/180}var i=e("wgs84");n.exports.geometry=r,n.exports.ring=o},{wgs84:5}],5:[function(e,n){n.exports.RADIUS=6378137,n.exports.FLATTENING=1/298.257223563,n.exports.POLAR_RADIUS=6356752.3142},{}],6:[function(e,n){n.exports={building:!0,highway:{included_values:{services:!0,rest_area:!0,escape:!0}},natural:{excluded_values:{coastline:!0,ridge:!0,arete:!0,tree_row:!0}},landuse:!0,waterway:{included_values:{riverbank:!0,dock:!0,boatyard:!0,dam:!0}},amenity:!0,leisure:!0,barrier:{included_values:{city_wall:!0,ditch:!0,hedge:!0,retaining_wall:!0,wall:!0,spikes:!0}},railway:{included_values:{station:!0,turntable:!0,roundhouse:!0,platform:!0}},area:!0,boundary:!0,man_made:{excluded_values:{cutline:!0,embankment:!0,pipeline:!0}},power:{included_values:{generator:!0,station:!0,sub_station:!0,transformer:!0}},place:!0,shop:!0,aeroway:{excluded_values:{taxiway:!0}},tourism:!0,historic:!0,public_transport:!0,office:!0,"building:part":!0,military:!0,ruins:!0,"area:highway":!0,craft:!0}},{}]},{},[1])(1)});
View
33 test/osm.test.js
@@ -889,13 +889,13 @@ describe("osm (json)", function () {
meta: {}
},
geometry: {
- type: "MultiPolygon",
- coordinates: [[[
+ type: "Polygon",
+ coordinates: [[
[2.0,1.0],
[1.0,1.0],
[2.0,2.0],
[2.0,1.0]
- ].reverse()]]
+ ].reverse()]
}
},
{
@@ -1216,10 +1216,9 @@ describe("osm (json)", function () {
result = osmtogeojson.toGeojson(json);
expect(result.features).to.have.length(1);
expect(result.features[0].properties.id).to.equal(1);
- expect(result.features[0].geometry.type).to.equal("MultiPolygon");
+ expect(result.features[0].geometry.type).to.equal("Polygon");
expect(result.features[0].geometry.coordinates).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0]).to.have.length(1);
- /*
+
// simple multipolygon
json = {
elements: [
@@ -1299,8 +1298,6 @@ describe("osm (json)", function () {
expect(result.features[0].properties.id).to.equal(2);
expect(result.features[0].geometry.type).to.equal("Polygon");
expect(result.features[0].geometry.coordinates).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0]).to.have.length(1);
- */
});
// non-trivial ring building (way order and direction)
it("multipolygon: non-trivial ring building", function() {
@@ -1367,10 +1364,9 @@ describe("osm (json)", function () {
result = osmtogeojson.toGeojson(json);
expect(result.features).to.have.length(1);
expect(result.features[0].properties.id).to.equal(1);
- expect(result.features[0].geometry.type).to.equal("MultiPolygon");
+ expect(result.features[0].geometry.type).to.equal("Polygon");
expect(result.features[0].geometry.coordinates).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0]).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0][0]).to.have.length(4);
+ expect(result.features[0].geometry.coordinates[0]).to.have.length(4);
// way directions
json = {
elements: [
@@ -1482,10 +1478,9 @@ describe("osm (json)", function () {
result = osmtogeojson.toGeojson(json);
expect(result.features).to.have.length(1);
expect(result.features[0].properties.id).to.equal(1);
- expect(result.features[0].geometry.type).to.equal("MultiPolygon");
+ expect(result.features[0].geometry.type).to.equal("Polygon");
expect(result.features[0].geometry.coordinates).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0]).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0][0]).to.have.length(7);
+ expect(result.features[0].geometry.coordinates[0]).to.have.length(7);
});
// unclosed rings
it("multipolygon: unclosed ring", function() {
@@ -1548,10 +1543,9 @@ describe("osm (json)", function () {
result = osmtogeojson.toGeojson(json);
expect(result.features).to.have.length(1);
expect(result.features[0].properties.id).to.equal(1);
- expect(result.features[0].geometry.type).to.equal("MultiPolygon");
+ expect(result.features[0].geometry.type).to.equal("Polygon");
expect(result.features[0].geometry.coordinates).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0]).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0][0]).to.have.length(4);
+ expect(result.features[0].geometry.coordinates[0]).to.have.length(4);
expect(result.features[0].properties.tainted).to.not.equal(true);
// matching ways, but unclosed ring
json = {
@@ -1612,10 +1606,9 @@ describe("osm (json)", function () {
result = osmtogeojson.toGeojson(json);
expect(result.features).to.have.length(1);
expect(result.features[0].properties.id).to.equal(1);
- expect(result.features[0].geometry.type).to.equal("MultiPolygon");
+ expect(result.features[0].geometry.type).to.equal("Polygon");
expect(result.features[0].geometry.coordinates).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0]).to.have.length(1);
- expect(result.features[0].geometry.coordinates[0][0]).to.have.length(4);
+ expect(result.features[0].geometry.coordinates[0]).to.have.length(4);
expect(result.features[0].properties.tainted).to.not.equal(true);
});
// overpass area

0 comments on commit 4b4ad62

Please sign in to comment.
Something went wrong with that request. Please try again.