all files / src/ osm.js

78.37% Statements 547/698
55.25% Branches 121/219
73.66% Functions 151/205
76.66% Lines 440/574
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282           23×     19×             19×     19×     19×                                                                                                                                                                                                                                                                                                                                                                                                       13×     13× 13×   13×                         34×   13×                     13×   13× 13× 13× 13× 13×                         11×                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   13× 13× 13×                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           27×   25×                     25×   25× 25× 25×         24× 24× 24×       24×                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         13×         13× 13×                         13×                   13×                         13×                                             39× 14× 25× 13×   12×     21× 21× 21× 13×   21×                                     12×                                                                                                                                                                                                                                                                                  
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
 
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
 
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;
 
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};
 
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
 
/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;
 
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
 
 
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
 
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
 
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/_karma_webpack_//";
 
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _oauth = __webpack_require__(1);
 
	var _oauth2 = _interopRequireDefault(_oauth);
 
	var _base = __webpack_require__(6);
 
	var _base2 = _interopRequireDefault(_base);
 
	var _api = __webpack_require__(3);
 
	var _api2 = _interopRequireDefault(_api);
 
	var _overpass = __webpack_require__(8);
 
	var _overpass2 = _interopRequireDefault(_overpass);
 
	var _taginfo = __webpack_require__(10);
 
	var _taginfo2 = _interopRequireDefault(_taginfo);
 
	var _nominatim = __webpack_require__(12);
 
	var _nominatim2 = _interopRequireDefault(_nominatim);
 
	var _togeojson = __webpack_require__(14);
 
	var _togeojson2 = _interopRequireDefault(_togeojson);
 
	var _osrm = __webpack_require__(17);
 
	var _osrm2 = _interopRequireDefault(_osrm);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	angular.module('osm', [_api2.default.name, _base2.default.name, _oauth2.default.name, _overpass2.default.name, _taginfo2.default.name, _nominatim2.default.name, _togeojson2.default.name, _osrm2.default.name]);
	exports.default = angular.module('osm');
 
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _oauth = __webpack_require__(2);
 
	var _oauth2 = _interopRequireDefault(_oauth);
 
	var _api = __webpack_require__(3);
 
	var _api2 = _interopRequireDefault(_api);
 
	var _x2js = __webpack_require__(5);
 
	var _x2js2 = _interopRequireDefault(_x2js);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmOAuthModule = angular.module('osm.oauth', [_api2.default.name, _x2js2.default.name]).provider('osmAuthService', function osmAuthServiceProvider() {
	    this.options = {};
 
	    this.$get = function osmAuthServiceFactory($q, osmx2js) {
	        return new _oauth2.default($q, osmx2js, this.options);
	    };
	    this.$get.$inject = ['$q', 'osmx2js'];
	});
 
	exports.default = osmOAuthModule;
 
/***/ },
/* 2 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	/**
	* @ngdoc service
	* @name osm.oauth.osmAuthService
	* @description handle osm oauth
	*/
 
	var osmAuthService = function () {
	    function osmAuthService($q, osmx2js, options) {
	        _classCallCheck(this, osmAuthService);
 
	        if (options) {
	            if (options.oauth_secret && options.oauth_consumer_key) {
	                this.auth = osmAuth(options);
	            }
	        }
	        this.osmx2js = osmx2js;
	        this.$q = $q;
	        this._options = options;
	    }
	    /**
	     * @ngdoc method
	     * @name logout
	     * @methodOf osm.auth.osmAuthService
	     */
 
 
	    _createClass(osmAuthService, [{
	        key: 'logout',
	        value: function logout() {
	            this.auth.logout();
	        }
	        /**
	         * @ngdoc method
	         * @name authenticated
	         * @methodOf osm.auth.osmAuthService
	         * @return {boolean} authenticated
	         */
 
	    }, {
	        key: 'authenticated',
	        value: function authenticated() {
	            return this.auth.authenticated();
	        }
	        /**
	         * @ngdoc method
	         * @name authenticate
	         * @methodOf osm.auth.osmAuthService
	         * @return {Promise} true/false
	         */
 
	    }, {
	        key: 'authenticate',
	        value: function authenticate() {
	            var deferred = this.$q.defer();
	            this.auth.authenticate(function () {
	                deferred.resolve(true);
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name xhr
	         * @methodOf osm.auth.osmAuthService
	         * @return {Promise} http response
	         */
 
	    }, {
	        key: 'xhr',
	        value: function xhr(options) {
	            var self = this;
	            var deferred = this.$q.defer();
	            options.path = '/api' + options.path;
	            if (options.data) {
	                options.body = options.data;
	                options.data = undefined;
	            }
	            this.auth.xhr(options, function (err, data) {
	                if (err) {
	                    deferred.reject(err);
	                } else {
	                    if (data instanceof XMLDocument) {
	                        deferred.resolve(self.osmx2js.dom2js(data));
	                    } else {
	                        deferred.resolve(data);
	                    }
	                }
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name options
	         * @methodOf osm.auth.osmAuthService
	         */
 
	    }, {
	        key: 'options',
	        value: function options(_options) {
	            if (this.auth) {
	                this.auth.options(_options);
	            } else {
	                this.auth = osmAuth(_options);
	            }
	        }
	    }]);
 
	    return osmAuthService;
	}();
 
	exports.default = osmAuthService;
 
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _api = __webpack_require__(4);
 
	var _api2 = _interopRequireDefault(_api);
 
	var _x2js = __webpack_require__(5);
 
	var _x2js2 = _interopRequireDefault(_x2js);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmAPIModule = angular.module('osm.api', [_x2js2.default.name]).provider('osmAPI', function osmAPIProvider() {
	    this.options = {
	        url: 'http://api.openstreetmap.org/api'
	    };
	    this.$get = function osmAPIFactory($http, $q, osmx2js) {
	        return new _api2.default($http, $q, osmx2js, this.options);
	    };
	    this.$get.$inject = ['$http', '$q', 'osmx2js'];
	});
 
	exports.default = osmAPIModule;
 
/***/ },
/* 4 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	/**
	 * @ngdoc service
	 * @name osm.oauth.osmAuthService
	 * @description The main idea is use geojson object where it is possible
	 * for the rest of the API (changeset, ...) it's XML2JS that is used so always expect objects.
	 * @param  {Object} $http angular http
	 * @param  {Object} $q angular promise
	 */
 
	var osmAPI = function () {
	    function osmAPI($http, $q, osmx2js, options) {
	        _classCallCheck(this, osmAPI);
 
	        this.url = options.url;
	        this.$http = $http;
	        this.$q = $q;
	        this.osmx2js = osmx2js;
	        this._oauth = null;
	    }
 
	    /**
	     * @ngdoc method
	     * @name setAuthAdapter
	     * @description provide an adapter to make authenticated request
	     * @methodOf osm.api.osmAPI
	    */
 
 
	    _createClass(osmAPI, [{
	        key: 'setAuthAdapter',
	        value: function setAuthAdapter(oauth) {
	            this._oauth = oauth;
	        }
 
	        /**
	         * @ngdoc method
	         * @name setOauth
	         * @description use oauth object to call API
	         * @methodOf osm.api.osmAPI
	         * @return {Object} oauth
	        */
 
	    }, {
	        key: 'getAuthAdapter',
	        value: function getAuthAdapter() {
	            return this._oauth;
	        }
 
	        // ------------------ INTERNAL CALL SERVER (API) -----------------
 
	        /**
	         * @ngdoc method
	         * @name xhr
	         * @description call the API
	         * @param {Object} options
	         * ```
	            var options = {
	                method: 'GET', // POST, DELETE, PUT
	                path: '/0.6/changesets', //without the /api
	                data: content //if you need a payload
	            };
	            osmAPI.xhr(options);
	            ```
	         * @methodOf osm.api.osmAPI
	         * @return {Object} oauth
	        */
 
	    }, {
	        key: 'xhr',
	        value: function xhr(options) {
	            var deferred = this.$q.defer();
	            return this._oauth.xhr(options);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getAuthenticated
	         * @description send a get request to OSM with
	         * @methodOf osm.api.osmAPI
	         * @returns {Promise} $http response
	        */
 
	    }, {
	        key: 'getAuthenticated',
	        value: function getAuthenticated(method, config) {
	            var _config = angular.copy(config);
	            Eif (!_config) {
	                _config = {};
	            }
	            _config.method = 'GET';
	            _config.path = method;
	            return this.xhr(_config);
	        }
	        /**
	         * @ngdoc method
	         * @name get
	         * @description send a get request
	         * @methodOf osm.api.osmAPI
	         * @param {string} method the api method
	         * @param {Object} config the $http.get config
	         * @returns {Promise} $http response with XML as string
	        */
 
	    }, {
	        key: 'get',
	        value: function get(method, config) {
	            var deferred = this.$q.defer();
	            var self = this;
	            var url = this.url + method;
	            this.$http.get(url, config).then(function (data) {
	                deferred.resolve(self.osmx2js.xml2js(data.data));
	            }, function (error) {
	                deferred.reject(error);
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name put
	         * @description send a put request
	         * @methodOf osm.api.osmAPI
	         * @param {string} method the api method
	         * @param {Object} content payload
	         * @param {Object} config the $http.put config
	         * @returns {Promise} $http response
	        */
 
	    }, {
	        key: 'put',
	        value: function put(method, content, config) {
	            Eif (!config) {
	                config = {};
	            }
	            var _config = angular.copy(config);
	            _config.method = 'PUT';
	            _config.path = method;
	            _config.data = this.osmx2js.js2xml(content);
	            return this.xhr(_config);
	        }
	        /**
	         * @ngdoc method
	         * @name delete
	         * @description send a delete request
	         * @methodOf osm.api.osmAPI
	         * @param {string} method the api method
	         * @param {Object} config the $http.delete config
	         * @returns {Promise} $http response
	        */
 
	    }, {
	        key: 'delete',
	        value: function _delete(method, config) {
	            Eif (!config) {
	                config = {};
	            }
	            var _config = angular.copy(config);
	            _config.method = 'DELETE';
	            _config.path = method;
	            return this.xhr(_config);
	        }
 
	        // ------------------ CHANGESET -----------------
 
	        /**
	         * @ngdoc method
	         * @name createChangeset
	         * @methodOf osm.api.osmAPI
	         * @param {string} comment the comment assiociated to the changeset
	         * @returns {Promise} $http response
	        */
 
	    }, {
	        key: 'createChangeset',
	        value: function createChangeset(comment) {
	            var self = this;
	            var deferred = this.$q.defer();
	            var changeset = { osm: {
	                    changeset: {
	                        tag: [{ _k: 'created_by', _v: 'Angular-OSM' }, { _k: 'comment', _v: comment }]
	                    }
	                } };
	            this.put('/0.6/changeset/create', changeset).then(function (data) {
	                deferred.resolve(data);
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name getLastOpenedChangesetId
	         * @methodOf osm.api.osmAPI
	         * @returns {Promise} $http response with the last changeset id
	         * or undefined if no changeset was opened
	        */
 
	    }, {
	        key: 'getLastOpenedChangesetId',
	        value: function getLastOpenedChangesetId() {
	            var self = this;
	            var deferred = this.$q.defer();
	            var config = {
	                params: { user: this._oauth.getUserID(), open: true }
	            };
	            this.get('/0.6/changesets', config).then(function (data) {
	                var changesets = data.osm.changeset;
	                Iif (changesets.length > 0) {
	                    deferred.resolve(changesets[0].id);
	                } else Eif (changesets._id) {
	                    deferred.resolve(changesets._id);
	                } else {
	                    deferred.resolve();
	                }
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name closeChangeset
	         * @methodOf osm.api.osmAPI
	         * @returns {Promise} $http.put response of
	         * /0.6/changeset/CHANGESET_ID/close
	        */
 
	    }, {
	        key: 'closeChangeset',
	        value: function closeChangeset(id) {
	            var self = this;
	            return this.put('/0.6/changeset/' + id + '/close').then(function (data) {
	                return data;
	            });
	        }
 
	        // ------------------ USER API -----------------
 
	        /**
	         * @ngdoc method
	         * @name getUserById
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id of the user
	         * @returns {Promise} $http.get response
	         * /0.6/user/#id
	        */
 
	    }, {
	        key: 'getUserById',
	        value: function getUserById(id) {
	            return this.getAuthenticated('/0.6/user/' + id);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getUserDetails
	         * @methodOf osm.api.osmAPI
	         * @returns {Promise} $http.get response
	         * /0.6/user/details
	        */
 
	    }, {
	        key: 'getUserDetails',
	        value: function getUserDetails() {
	            return this.getAuthenticated('/0.6/user/details');
	        }
	        /**
	         * @ngdoc method
	         * @name getUserPreferences
	         * @methodOf osm.api.osmAPI
	         * @returns {Promise} $http.get response
	         * /0.6/user/preferences
	        */
 
	    }, {
	        key: 'getUserPreferences',
	        value: function getUserPreferences() {
	            return this.getAuthenticated('/0.6/user/preferences');
	        }
 
	        /**
	         * @ngdoc method
	         * @name putUserPreferences
	         * @methodOf osm.api.osmAPI
	         * @param {string} key the preference key
	         * @param {string} value the preference value
	         * @returns {Promise} $http.get response
	         * /0.6/user/preferences
	        */
 
	    }, {
	        key: 'putUserPreferences',
	        value: function putUserPreferences(key, value) {
	            return this.put('/0.6/user/preferences/' + key, value);
	        }
 
	        //------------------ MAP DATA -------------------------
 
	        /**
	         * @ngdoc method
	         * @name getMap
	         * @methodOf osm.api.osmAPI
	         * @param {string} bbox left,bottom,right,top
	         * where:
	            left is the longitude of the left (westernmost) side of the bounding box.
	            bottom is the latitude of the bottom (southernmost) side of the bounding box.
	            right is the longitude of the right (easternmost) side of the bounding box.
	            top is the latitude of the top (northernmost) side of the bounding box.
	         * @returns {Promise} $http.get response
	         * /0.6/map?bbox=bbox
	        */
 
	    }, {
	        key: 'getMap',
	        value: function getMap(bbox) {
	            return this.get('/0.6/map?bbox=' + bbox);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getNotes
	         * @methodOf osm.api.osmAPI
	         * @param {string} bbox left,bottom,right,top
	         * where:
	            left is the longitude of the left (westernmost) side of the bounding box.
	            bottom is the latitude of the bottom (southernmost) side of the bounding box.
	            right is the longitude of the right (easternmost) side of the bounding box.
	            top is the latitude of the top (northernmost) side of the bounding box.
	         * @returns {Promise} $http.get response
	        */
 
	    }, {
	        key: 'getNotes',
	        value: function getNotes(bbox) {
	            var url = '/0.6/notes?bbox=' + bbox;
	            return this.get(url);
	        }
 
	        //------------------ ELEMENTS: Node ----------------
 
	        /**
	         * @ngdoc method
	         * @name createNode
	         * @methodOf osm.api.osmAPI
	         * @param {Object/string} node
	             var node = {osm: {node: {
	                _changeset: '12', _lat: '...', _lon: '...',
	                tags: [
	                    {_k: '...', _v: '...'}
	                ]
	            }}};
	         * @returns {Promise} $http.put response
	         * PUT /0.6/node/create
	        */
 
	    }, {
	        key: 'createNode',
	        value: function createNode(node) {
	            return this.put('/0.6/node/create', node);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getNode
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/node/#id
	        */
 
	    }, {
	        key: 'getNode',
	        value: function getNode(id) {
	            return this.get('/0.6/node/' + id);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getNodeRelations
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/node/#id/relations
	        */
 
	    }, {
	        key: 'getNodeRelations',
	        value: function getNodeRelations(id) {
	            return this.get('/0.6/node/' + id + '/relations');
	        }
 
	        /**
	         * @ngdoc method
	         * @name getNodeWays
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/node/#id/ways
	        */
 
	    }, {
	        key: 'getNodeWays',
	        value: function getNodeWays(id) {
	            return this.get('/0.6/node/' + id + '/ways');
	        }
 
	        /**
	         * @ngdoc method
	         * @name getNodes
	         * @methodOf osm.api.osmAPI
	         * @param {array} ids ids
	         * @returns {Promise} $http.get response
	         * GET /0.6/node/#id
	        */
 
	    }, {
	        key: 'getNodes',
	        value: function getNodes(ids) {
	            return this.get('/0.6/nodes?nodes=' + ids.join(','));
	        }
 
	        /**
	         * @ngdoc method
	         * @name deleteNode
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.delete response
	         * DELETE /0.6/node/#id
	        */
 
	    }, {
	        key: 'deleteNode',
	        value: function deleteNode(id) {
	            return this.delete('/0.6/node/' + id);
	        }
 
	        //------------------ ELEMENTS: WAY ----------------
 
	        /**
	         * @ngdoc method
	         * @name createWay
	         * @methodOf osm.api.osmAPI
	         * @param {Object/string} way
	            var way = {osm: {way: {
	                _changeset: '12', _lat: '...', _lon: '...',
	                tags: [
	                    {_k: '...', _v: '...'}
	                ],
	                nd: [
	                    {_ref: '123'},
	                    {_ref: '456'},
	                ]
	            }}};
	         * @returns {Promise} $http.put response
	         * PUT /0.6/way/create
	        */
 
	    }, {
	        key: 'createWay',
	        value: function createWay(way) {
	            return this.put('/0.6/way/create', way);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getWay
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/way/#id
	        */
 
	    }, {
	        key: 'getWay',
	        value: function getWay(id) {
	            return this.get('/0.6/way/' + id);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getWayRelations
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/way/#id/relations
	        */
 
	    }, {
	        key: 'getWayRelations',
	        value: function getWayRelations(id) {
	            return this.get('/0.6/way/' + id + '/relations');
	        }
 
	        /**
	         * @ngdoc method
	         * @name getWayFull
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/way/#id/full
	        */
 
	    }, {
	        key: 'getWayFull',
	        value: function getWayFull(id) {
	            return this.get('/0.6/way/' + id + '/full');
	        }
 
	        /**
	         * @ngdoc method
	         * @name getWays
	         * @methodOf osm.api.osmAPI
	         * @param {array} ids ids
	         * @returns {Promise} $http.get response
	         * GET /0.6/ways?ways=ids
	        */
 
	    }, {
	        key: 'getWays',
	        value: function getWays(ids) {
	            return this.get('/0.6/ways?ways=' + ids.join(','));
	        }
 
	        /**
	         * @ngdoc method
	         * @name deleteWay
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.delete response
	         * DELETE /0.6/way/#id
	        */
 
	    }, {
	        key: 'deleteWay',
	        value: function deleteWay(id) {
	            return this.delete('/0.6/way/' + id);
	        }
 
	        //------------------ ELEMENTS: RELATION ----------------
 
	        /**
	         * @ngdoc method
	         * @name createRelation
	         * @methodOf osm.api.osmAPI
	         * @param {Object/string} relation
	            var relation = {osm: {relation: {
	                _changeset: '12', _lat: '...', _lon: '...',
	                tags: [
	                    {_k: '...', _v: '...'}
	                ],
	                member: [
	                    {_type: 'node', _role: 'stop', 'ref': '123'},
	                    {_type: 'way', 'ref': '234'}
	                ]
	            }}};
	         * @returns {Promise} $http.put response
	         * PUT /0.6/relation/create
	        */
 
	    }, {
	        key: 'createRelation',
	        value: function createRelation(relation) {
	            return this.put('/0.6/relation/create', relation);
	        }
 
	        /**
	         * @ngdoc method
	         * @name getRelation
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/relation/#id
	        */
 
	    }, {
	        key: 'getRelation',
	        value: function getRelation(id) {
	            return this.get('/0.6/relation/' + id);
	        }
	        /**
	         * @ngdoc method
	         * @name getRelationRelations
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/relation/#id/relations
	        */
 
	    }, {
	        key: 'getRelationRelations',
	        value: function getRelationRelations(id) {
	            return this.get('/0.6/relation/' + id + '/relations');
	        }
 
	        /**
	         * @ngdoc method
	         * @name getRelationFull
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.get response
	         * GET /0.6/relation/#id/full
	        */
 
	    }, {
	        key: 'getRelationFull',
	        value: function getRelationFull(id) {
	            return this.get('/0.6/relation/' + id + '/full');
	        }
 
	        /**
	         * @ngdoc method
	         * @name getRelations
	         * @methodOf osm.api.osmAPI
	         * @param {array} ids ids
	         * @returns {Promise} $http.get response
	         * GET /0.6/relations?relations=ids
	        */
 
	    }, {
	        key: 'getRelations',
	        value: function getRelations(ids) {
	            return this.get('/0.6/relations?relations=' + ids.join(','));
	        }
 
	        /**
	         * @ngdoc method
	         * @name deleteRelation
	         * @methodOf osm.api.osmAPI
	         * @param {string} id id
	         * @returns {Promise} $http.delete response
	         * DELETE /0.6/relation/#id
	        */
 
	    }, {
	        key: 'deleteRelation',
	        value: function deleteRelation(id) {
	            return this.delete('/0.6/relation/' + id);
	        }
	    }]);
 
	    return osmAPI;
	}();
 
	osmAPI.$inject = ['$http', '$q', 'osmx2js'];
	exports.default = osmAPI;
 
/***/ },
/* 5 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
	//https://github.com/abdmob/x2js as angular service
	var osmx2jsModule = angular.module('osm.x2js', []).provider('osmx2js', function osmx2jsProvider() {
	    this.options = {};
	    this.$get = function osmx2jsFactory() {
	        return new X2JS(this.options); //X2JS must be global
	    };
	});
 
	exports.default = osmx2jsModule;
 
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _base = __webpack_require__(7);
 
	var _base2 = _interopRequireDefault(_base);
 
	var _api = __webpack_require__(3);
 
	var _api2 = _interopRequireDefault(_api);
 
	var _x2js = __webpack_require__(5);
 
	var _x2js2 = _interopRequireDefault(_x2js);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmBase64Module = angular.module('osm.base64', [_x2js2.default.name, _api2.default.name, 'base64']).provider('osmBase64', function osmBase64Provider() {
	    this.options = {
	        url: 'http://api.openstreetmap.org/api'
	    };
	    this.$get = function osmBase64Factory($base64, $http, $q, osmx2js) {
	        return new _base2.default($base64, $http, $q, osmx2js, this.options);
	    };
	    this.$get.$inject = ['$base64', '$http', 'osmx2js'];
	});
 
	exports.default = osmBase64Module;
 
/***/ },
/* 7 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	var Base64backend = function () {
	    function Base64backend($base64, $http, osmx2js) {
	        _classCallCheck(this, Base64backend);
 
	        this.$base64 = $base64;
	        this.storage = {};
	        this.$http = $http;
	        this.url = 'http://api.openstreetmap.org/api';
	        this.osmx2js = osmx2js;
	    }
 
	    _createClass(Base64backend, [{
	        key: 'xhr',
	        value: function xhr(options) {
	            var self = this;
	            options.url = this.url + options.path;
	            options.headers = {
	                Authorization: this.getAuthorization()
	            };
	            return this.$http(options).then(function (data) {
	                var d = data.data;
	                Iif (!d) {
	                    return;
	                }
	                Eif (d.substr) {
	                    Eif (d.substr(0, 5) === '<?xml') {
	                        return self.osmx2js.xml2js(d);
	                    }
	                }
	                return d;
	            });
	        }
	        /**
	         * @ngdoc method
	         * @name setCredentials
	         * @description if you don't use oauth, you can save
	         * credentials here using base64 localstorage (completly unsecure)
	         * @methodOf osm.api.osmAPI
	         * @returns {string} crendentials
	        */
 
	    }, {
	        key: 'setCredentials',
	        value: function setCredentials(username, password) {
	            this.storage.username = username;
	            var credentials = this.$base64.encode(username + ':' + password);
	            this.storage.credentials = credentials;
	            return credentials;
	        }
	        /**
	         * @ngdoc method
	         * @name getCredentials
	         * @description if you don't use oauth, you can manage
	         * credentials here using base64 headers
	         * @methodOf osm.api.osmAPI
	         * @returns {string} crendentials from the last set
	        */
 
	    }, {
	        key: 'getCredentials',
	        value: function getCredentials() {
	            return this.storage.credentials;
	        }
	        /**
	         * @ngdoc method
	         * @name getAuthorization
	         * @description compute authorization header from credentials
	         * @methodOf osm.api.osmAPI
	         * @returns {string} HTTP Header 'Basic CREDENTIAL AS BASE64'
	        */
 
	    }, {
	        key: 'getAuthorization',
	        value: function getAuthorization() {
	            return 'Basic ' + this.storage.credentials;
	        }
	        /**
	         * @ngdoc method
	         * @name clearCredentials
	         * @description remove credentials from the localstorage
	         * @methodOf osm.api.osmAPI
	         * @returns {string} HTTP Header 'Basic CREDENTIAL AS BASE64'
	        */
 
	    }, {
	        key: 'clearCredentials',
	        value: function clearCredentials() {
	            Iif (this.storage.removeItem) {
	                this.storage.removeItem('credentials');
	            } else {
	                delete this.storage.credentials;
	            }
	        }
	    }]);
 
	    return Base64backend;
	}();
 
	Base64backend.$inject = ['$base64', '$http', 'osmx2js'];
 
	exports.default = Base64backend;
 
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _overpass = __webpack_require__(9);
 
	var _overpass2 = _interopRequireDefault(_overpass);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmOverpassModule = angular.module('osm.overpass', []).provider('osmOverpassAPI', function osmOverpassAPIProvider() {
	    this.options = {
	        url: 'http://overpass-api.de/api/interpreter'
	    };
	    this.$get = function osmOverpassAPIFactory($http, $q) {
	        return new _overpass2.default($http, $q, this.options);
	    };
	    this.$get.$inject = ['$http', '$q'];
	});
 
	exports.default = osmOverpassModule;
 
/***/ },
/* 9 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	/**
	 * @ngdoc service
	 * @name overpassAPI
	 * @param  {any} $http
	 * @param  {any} $q
	 */
 
	var osmOverpassAPI = function () {
	    function osmOverpassAPI($http, $q, options) {
	        _classCallCheck(this, osmOverpassAPI);
 
	        this.url = options.url;
	        this.$http = $http;
	        this.$q = $q;
	    }
	    /**
	     * @ngdoc method
	     * @name overpass
	     * @param {Object/String} query
	     * http://wiki.openstreetmap.org/wiki/FR:Overpass_API
	     * @methodOf osm.overpass.osmOverpassAPI
	     * @return {Promise} $http.get
	    */
 
 
	    _createClass(osmOverpassAPI, [{
	        key: 'overpass',
	        value: function overpass(query) {
	            var url = this.url;
	            var deferred = this.$q.defer();
	            var headers = {
	                'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
	            };
	            this.$http.post(url, 'data=' + encodeURIComponent(query), { headers: headers }).then(function (data) {
	                deferred.resolve(data.data);
	            }, function (data) {
	                deferred.reject(data);
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name overpass
	         * @description
	         * http://wiki.openstreetmap.org/wiki/FR:Overpass_API/Overpass_QL#By_area_.28area.29
	            By convention the area id can be calculated from an existing OSM way by adding 2400000000 to its OSM id, or in case of a relation by adding 3600000000 respectively. Note that area creation is subject to some extraction rules, i.e. not all ways/relations have an area counterpart (notably those that are tagged with area=no, and most multipolygons and that don't have a defined name=* will not be part of areas).
	         * @param {String} type 'r'/'relation' or 'w'/'way'
	         * @param {String/Number} osmId the id of the element
	         * @methodOf osm.overpass.osmOverpassAPI
	         * @return {Number} the area id
	        */
 
	    }, {
	        key: 'getAreaId',
	        value: function getAreaId(type, osmId) {
	            var id;
	            if (typeof osmId === 'string') {
	                id = parseInt(osmId, 10);
	            } else {
	                id = osmId;
	            }
	            if (type === 'r' || type === 'relation') {
	                return 3600000000 + id;
	            } else if (type === 'w' || type === 'way') {
	                return 2400000000 + id;
	            }
	        }
	    }, {
	        key: 'overpassToGeoJSON',
	        value: function overpassToGeoJSON(query, filter) {
	            var deferred = this.$q.defer();
	            var features = [];
	            var relations = [];
	            var result = {
	                type: 'FeatureCollection',
	                features: features,
	                relations: relations
	            };
	            if (filter === undefined) {
	                filter = function filter() {};
	            }
	            this.overpass(query).then(function (data) {
	                //TODO check if data is XML or JSON, here it's JSON
	                var node, feature, coordinates;
	                var cache = { loaded: false };
	                function getNodeById(id) {
	                    if (!cache.loaded) {
	                        var tmp;
	                        for (var i = 0; i < data.elements.length; i++) {
	                            tmp = data.elements[i];
	                            cache[tmp.id] = tmp;
	                        }
	                    }
	                    return cache[id];
	                }
	                for (var i = 0; i < data.elements.length; i++) {
	                    node = data.elements[i];
	                    if (node.type === 'node') {
	                        feature = {
	                            type: 'Feature',
	                            properties: node.tags,
	                            id: node.id,
	                            geometry: {
	                                type: 'Point',
	                                coordinates: [node.lon, node.lat]
	                            }
	                        };
	                        if (!filter(feature)) {
	                            features.push(feature);
	                        }
	                    } else if (node.type === 'way') {
	                        coordinates = [];
	                        feature = {
	                            type: 'Feature',
	                            properties: node.tags,
	                            id: node.id,
	                            geometry: {
	                                type: 'LineString',
	                                coordinates: coordinates
	                            }
	                        };
	                        for (var j = 0; j < node.nodes.length; j++) {
	                            coordinates.push([getNodeById(node.nodes[j]).lon, getNodeById(node.nodes[j]).lat]);
	                        }
	                        if (!filter(feature)) {
	                            features.push(feature);
	                        }
	                    } else if (node.type === 'relation') {
	                        result.relations.push({
	                            ref: node.id,
	                            tags: node.tags,
	                            type: 'relation',
	                            members: node.members
	                        });
	                    }
	                }
	                deferred.resolve(result);
	            }, function (error) {
	                deferred.reject(error);
	            });
	            return deferred.promise;
	        }
	    }]);
 
	    return osmOverpassAPI;
	}();
 
	exports.default = osmOverpassAPI;
 
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	  value: true
	});
 
	var _taginfo = __webpack_require__(11);
 
	var _taginfo2 = _interopRequireDefault(_taginfo);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmTagInfoModule = angular.module('osm.taginfo', []).service('osmTagInfoAPI', _taginfo2.default);
 
	exports.default = osmTagInfoModule;
 
/***/ },
/* 11 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	/**
	 * @ngdoc service
	 * @name osmTagInfoAPI
	 * @description integration of taginfo
	 * http://taginfo.openstreetmap.org/taginfo/apidoc
	 * @param  {any} $http
	 * @param  {any} $q
	 */
 
	var osmTagInfoAPI = function () {
	    function osmTagInfoAPI($http, $q) {
	        _classCallCheck(this, osmTagInfoAPI);
 
	        this.$http = $http;
	        this.$q = $q;
	        this.url = 'https://taginfo.openstreetmap.org/api/4';
	    }
 
	    _createClass(osmTagInfoAPI, [{
	        key: 'get',
	        value: function get(method, config) {
	            var deferred = this.$q.defer();
	            this.$http.get(this.url + method, config).then(function (data) {
	                deferred.resolve(data.data);
	            }, function (error) {
	                deferred.reject(error);
	            });
	            return deferred.promise;
	        }
	        /**
	         * @ngdoc method
	         * @name getKeyCombinations
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            query — Only show results where the other_key matches this query (substring match, optional).
	         */
 
	    }, {
	        key: 'getKeyCombinations',
	        value: function getKeyCombinations(params) {
	            return this.get('/key/combinations', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeyDistributionNodes
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	         */
 
	    }, {
	        key: 'getKeyDistributionNodes',
	        value: function getKeyDistributionNodes(params) {
	            return this.get('/key/distribution/nodes', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeyDistributionWays
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	         * key — Tag key (required).
	         */
 
	    }, {
	        key: 'getKeyDistributionWays',
	        value: function getKeyDistributionWays(params) {
	            return this.get('/key/distribution/ways', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeyStats
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	         * key — Tag key (required).
	         */
 
	    }, {
	        key: 'getKeyStats',
	        value: function getKeyStats(params) {
	            return this.get('/key/stats', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeyValues
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            lang — Language for description (optional, default: 'en').
	            query — Only show results where the value matches this query (substring match, optional).
	         */
 
	    }, {
	        key: 'getKeyValues',
	        value: function getKeyValues(params) {
	            return this.get('/key/values', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeyWikiPages
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	         */
 
	    }, {
	        key: 'getKeyWikiPages',
	        value: function getKeyWikiPages(params) {
	            return this.get('/key/wiki_pages', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeysAll
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Only show keys matching this query (substring match, optional).
	         */
 
	    }, {
	        key: 'getKeysAll',
	        value: function getKeysAll(params) {
	            return this.get('/keys/all', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeysWikiPages
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Only show keys matching this query (substring match, optional).
	         */
 
	    }, {
	        key: 'getKeysWikiPages',
	        value: function getKeysWikiPages(params) {
	            return this.get('/keys/wiki_pages', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getKeysWithoutWikiPage
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            english — Check for key wiki pages in any language (0, default) or in the English language (1).
	            min_count — How many tags with this key must there be at least to show up here? (default 10000).
	            query — Only show results where the key matches this query (substring match, optional).
	         */
 
	    }, {
	        key: 'getKeysWithoutWikiPage',
	        value: function getKeysWithoutWikiPage(params) {
	            return this.get('/keys/without_wiki_page', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getRelationRoles
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Only show results where the role matches this query (substring match, optional).
	            rtype — Relation type (required).
	         */
 
	    }, {
	        key: 'getRelationRoles',
	        value: function getRelationRoles(params) {
	            return this.get('/relation/roles', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getRelationStats
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            rtype — Relation type (required).
	         */
 
	    }, {
	        key: 'getRelationStats',
	        value: function getRelationStats(params) {
	            return this.get('/relation/stats', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getRelationWikiPages
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            rtype — Relation type (required).
	         */
 
	    }, {
	        key: 'getRelationWikiPages',
	        value: function getRelationWikiPages(params) {
	            return this.get('/relation/wiki_pages', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getRelationsAll
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Only show results where the relation type matches this query (substring match, optional).
	         */
 
	    }, {
	        key: 'getRelationsAll',
	        value: function getRelationsAll(params) {
	            return this.get('/relations/all', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getSearchByKeyAndValue
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Value to search for (substring search, required).
	         */
 
	    }, {
	        key: 'getSearchByKeyAndValue',
	        value: function getSearchByKeyAndValue(params) {
	            return this.get('/search/by_key_and_value', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getSearchByKeyword
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Value to search for (substring search, required).
	         */
 
	    }, {
	        key: 'getSearchByKeyword',
	        value: function getSearchByKeyword(params) {
	            return this.get('/search/by_keyword', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getSearchByRole
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Role to search for (substring search, required).
	         */
 
	    }, {
	        key: 'getSearchByRole',
	        value: function getSearchByRole(params) {
	            return this.get('/search/by_role', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getSearchByValue
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Value to search for (substring search, required).
	         */
 
	    }, {
	        key: 'getSearchByValue',
	        value: function getSearchByValue(params) {
	            return this.get('/search/by_value', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getSiteInfo
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	             param: No params
	         */
 
	    }, {
	        key: 'getSiteInfo',
	        value: function getSiteInfo(params) {
	            return this.get('/site/info', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getSiteSources
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	             param: No params
	         */
 
	    }, {
	        key: 'getSiteSources',
	        value: function getSiteSources(params) {
	            return this.get('/site/sources', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getTagCombinations
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            query — Only show results where the other_key or other_value matches this query (substring match, optional).
	            value — Tag value (required).
	         */
 
	    }, {
	        key: 'getTagCombinations',
	        value: function getTagCombinations(params) {
	            return this.get('/tag/combinations', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getTagDistributionNodes
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            value — Tag value (required).
	         */
 
	    }, {
	        key: 'getTagDistributionNodes',
	        value: function getTagDistributionNodes(params) {
	            return this.get('/tag/distribution/nodes', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getTagDistributionWays
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            value — Tag value (required).
	         */
 
	    }, {
	        key: 'getTagDistributionWays',
	        value: function getTagDistributionWays(params) {
	            return this.get('/tag/distribution/ways', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getTagStats
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            value — Tag value (required).
	         */
 
	    }, {
	        key: 'getTagStats',
	        value: function getTagStats(params) {
	            return this.get('/tag/stats', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getTagWikiPages
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            key — Tag key (required).
	            value — Tag value (required).
	         */
 
	    }, {
	        key: 'getTagWikiPages',
	        value: function getTagWikiPages(params) {
	            return this.get('/tag/wiki_pages', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getTagsPopular
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	            query — Only show tags matching this query (substring match in key and value, optional).
	         */
 
	    }, {
	        key: 'getTagsPopular',
	        value: function getTagsPopular(params) {
	            return this.get('/tags/popular', { params: params });
	        }
	        /**
	         * @ngdoc method
	         * @name getWikiLanguages
	         * @methodOf osm.taginfo.osmTagInfoAPI
	         * @param {any} params
	             param: No params
	         */
 
	    }, {
	        key: 'getWikiLanguages',
	        value: function getWikiLanguages(params) {
	            return this.get('/wiki/languages', { params: params });
	        }
	    }]);
 
	    return osmTagInfoAPI;
	}();
 
	osmTagInfoAPI.$inject = ['$http', '$q'];
 
	exports.default = osmTagInfoAPI;
 
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _nominatim = __webpack_require__(13);
 
	var _nominatim2 = _interopRequireDefault(_nominatim);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmNominatimModule = angular.module('osm.nominatim', []).factory('osmNominatim', _nominatim2.default).provider('osmNominatim', function osmNominatimProvider() {
	    this.options = {
	        url: 'https://nominatim.openstreetmap.org'
	    };
	    this.$get = function osmNominatimFactory($q) {
	        return new _nominatim2.default($q, this.options);
	    };
	    this.$get.$inject = ['$http'];
	});
 
	exports.default = osmNominatimModule;
 
/***/ },
/* 13 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	/**
	* @ngdoc service
	* @name osm.nominatim.osmNominatim
	* @description handle nominatim query
	*/
 
	var osmNominatim = function () {
	    function osmNominatim($http, options) {
	        _classCallCheck(this, osmNominatim);
 
	        this.url = options.url;
	        this.$http = $http;
	    }
 
	    /**
	     * @ngdoc method
	     * @name search
	     * @param {Object/String} query
	     * http://wiki.openstreetmap.org/wiki/Nominatim
	     * @methodOf osm.nominatim.osmNominatim
	     * @return {Promise} $http.get
	    */
 
 
	    _createClass(osmNominatim, [{
	        key: 'search',
	        value: function search(query) {
	            //https://nominatim.openstreetmap.org/search
	            //?X-Requested-With=overpass-turbo&format=json&q=vern-sur-seiche
	            //params['accept-language'] = 'fr';
	            var params;
	            Eif (typeof query === 'string' || !query) {
	                params = {
	                    format: 'json',
	                    q: query
	                };
	            } else {
	                params = angular.copy(query);
	                params.format = 'json';
	            }
	            var config = {
	                params: params
	            };
	            var url = this.url + '/search';
	            return this.$http.get(url, config);
	        }
 
	        /**
	         * @ngdoc method
	         * @name reverse
	         * @param {Object/String} query
	         * http://wiki.openstreetmap.org/wiki/Nominatim
	         * @methodOf osm.nominatim.osmNominatim
	         * @return {Promise} $http.get
	        */
 
	    }, {
	        key: 'reverse',
	        value: function reverse(query) {
	            //https://nominatim.openstreetmap.org/reverse
	            //?X-Requested-With=overpass-turbo&format=json&q=vern-sur-seiche
	            //params['accept-language'] = 'fr';
	            var params;
	            Iif (typeof query === 'string') {
	                params = {
	                    format: 'json',
	                    q: query
	                };
	            } else {
	                params = angular.copy(query);
	                params.format = 'json';
	            }
	            var config = {
	                params: params
	            };
	            var url = this.url + '/reverse';
	            return this.$http.get(url, config);
	        }
 
	        /**
	         * @ngdoc method
	         * @name lookup
	         * @description
	         *  http://nominatim.openstreetmap.org/lookup?osm_ids=R146656,W104393803,N240109189
	         * @param {Object/String} query
	         * http://wiki.openstreetmap.org/wiki/Nominatim
	         * @methodOf osm.nominatim.osmNominatim
	         * @return {Promise} $http.get
	        */
 
	    }, {
	        key: 'lookup',
	        value: function lookup(query) {
	            var params;
	            Iif (typeof query === 'string') {
	                params = {
	                    format: 'json',
	                    q: query
	                };
	            } else {
	                params = angular.copy(query);
	                params.format = 'json';
	            }
	            var config = {
	                params: params
	            };
	            var url = this.url + '/lookup';
	            return this.$http.get(url, config);
	        }
	    }]);
 
	    return osmNominatim;
	}();
 
	exports.default = osmNominatim;
 
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	  value: true
	});
 
	var _togeojson = __webpack_require__(15);
 
	var _togeojson2 = _interopRequireDefault(_togeojson);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osmtogeojsonModule = angular.module('osm.togeojson', []).provider('osmtogeojson', _togeojson2.default);
 
	exports.default = osmtogeojsonModule;
 
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _togeojson = __webpack_require__(16);
 
	var _togeojson2 = _interopRequireDefault(_togeojson);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	function osmtogejsonProvider() {
	    this.options = {
	        areaTags: ['area', 'building', 'leisure', 'tourism', 'ruins', 'historic', 'landuse', 'military', 'natural', 'sport'],
	        uninterestingTags: ['source', 'source_ref', 'source:ref', 'history', 'attribution', 'created_by', 'tiger:county', 'tiger:tlid', 'tiger:upload_uuid'],
	        styles: {}
	    };
	    this.$get = function () {
	        return (0, _togeojson2.default)(this.options);
	    };
	}
	exports.default = osmtogejsonProvider;
 
/***/ },
/* 16 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
 
	/**
	 * @ngdoc service
	 * @name osmtogeojson
	 * @description osm to geojson without dependencies :)
	   
	   Import Note : geojson wait for lon/lat where every body else use lat/lon
	 */
	function factory(options) {
	    //copy/pasted/adapter from https://github.com/jfirebaugh/leaflet-osm/blob/master/leaflet-osm.js
	    var service = {
	        options: options,
	        getAsArray: getAsArray,
	        getFeatures: getFeatures,
	        getNodes: getNodes,
	        getWays: getWays,
	        getRelations: getRelations,
	        getTags: getTags,
	        buildFeatures: buildFeatures,
	        isWayArea: isWayArea,
	        interestingNode: interestingNode,
	        togeojson: togeojson
	    };
	    return service;
 
	    function getFeatures(data) {
	        var features = [];
	        if (!(data instanceof Array)) {
	            data = buildFeatures(data);
	        }
 
	        for (var i = 0; i < data.length; i++) {
	            var d = data[i];
	            var feature = {
	                type: 'Feature',
	                geometry: {},
	                properties: {
	                    id: d.id,
	                    tags: d.tags
	                }
	            };
	            if (d.type === "changeset") {
	                //build rectangle
	                // X = Long; Y = Lat, lets do it clockwise
	                feature.geometry.type = 'Polygon';
	                var bounds = d.latLngBounds;
	                feature.geometry.coordinates = [[[parseFloat(bounds._min_lon), parseFloat(bounds._min_lat)], [parseFloat(bounds._min_lon), parseFloat(bounds._max_lat)], [parseFloat(bounds._max_lon), parseFloat(bounds._max_lat)], [parseFloat(bounds._max_lon), parseFloat(bounds._min_lat)], [parseFloat(bounds._min_lon), parseFloat(bounds._min_lat)]]];
	            } else if (d.type === "node") {
	                //add a Point
	                feature.geometry.type = 'Point';
	                feature.geometry.coordinates = [d.latLng[1], d.latLng[0]];
	            } else {
	                var lngLats = new Array(d.nodes.length);
 
	                for (var j = 0; j < d.nodes.length; j++) {
	                    var latLng = d.nodes[j].latLng;
	                    lngLats[j] = [latLng[1], latLng[0]];
	                }
 
	                if (isWayArea(d)) {
	                    feature.geometry.type = 'Polygon';
	                    feature.geometry.coordinates = [lngLats];
	                } else {
	                    feature.geometry.type = 'LineString';
	                    feature.geometry.coordinates = lngLats;
	                }
	            }
	            features.push(feature);
	        }
	        return features;
	    }
	    function getAsArray(data) {
	        if (Array.isArray(data)) {
	            return data;
	        } else if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === "object") {
	            return [data];
	        } else {
	            return [];
	        }
	    }
	    function getTags(data) {
	        var rawtags = getAsArray(data.tag);
	        var tags = {};
	        rawtags.forEach(function (t) {
	            tags[t._k] = t._v;
	        });
	        return tags;
	    }
	    function getChangesets(data) {
	        var result = [];
 
	        var nodes = getAsArray(data.osm.changeset);
	        for (var i = 0; i < nodes.length; i++) {
	            var node = nodes[i];
	            result.push({
	                id: node._id,
	                type: "changeset",
 
	                latLngBounds: node,
	                tags: getTags(node)
	            });
	        }
 
	        return result;
	    }
 
	    function getNodes(data) {
	        var nodesAsArray = getAsArray(data.osm.node);
	        var nodesById = {};
	        nodesAsArray.forEach(function (node) {
	            nodesById[node._id] = {
	                id: node._id,
	                type: 'node',
	                latLng: [parseFloat(node._lat), parseFloat(node._lon)],
	                tags: getTags(node)
	            };
	        });
	        return nodesById;
	    }
	    function getWays(data, nodes) {
	        var result = [];
	        var ways = getAsArray(data.osm.way);
	        var features = [];
	        ways.forEach(function (way) {
	            var nds = way.nd;
	            var way_object = {
	                id: way._id,
	                type: "way",
	                nodes: new Array(nds.length),
	                tags: getTags(way)
	            };
	            for (var j = 0; j < nds.length; j++) {
	                way_object.nodes[j] = nodes[nds[j]._ref];
	            }
	            result.push(way_object);
	        });
	        return result;
	    }
	    function getRelations(data, nodes, way) {
	        var result = [];
 
	        var rels = getAsArray(data.osm.relation);
	        for (var i = 0; i < rels.length; i++) {
	            var rel = rels[i];
	            var members = getAsArray(rel.member);
	            var rel_object = {
	                id: rel._id,
	                type: "relation",
	                members: new Array(members.length),
	                tags: getTags(rel)
	            };
	            for (var j = 0; j < members.length; j++) {
	                if (members[j]._type === "node") {
	                    rel_object.members[j] = nodes[members[j]._ref];
	                } else {
	                    // relation-way and relation-relation membership not implemented
	                    rel_object.members[j] = null;
	                }
	            }
	            result.push(rel_object);
	        }
	        return result;
	    }
 
	    function buildFeatures(data) {
	        var features = [];
	        var nodes = getNodes(data); //-> {id: data, ...}
	        var ways = getWays(data, nodes); //->[]
	        var relations = getRelations(data, nodes, ways); //->[]
 
	        for (var node_id in nodes) {
	            var node = nodes[node_id];
	            if (interestingNode(node, ways, relations)) {
	                features.push(node);
	            }
	        }
 
	        for (var i = 0; i < ways.length; i++) {
	            var way = ways[i];
	            features.push(way);
	        }
 
	        return features;
	    }
 
	    function isWayArea(way) {
	        if (way.nodes[0] != way.nodes[way.nodes.length - 1]) {
	            return false;
	        }
 
	        for (var key in way.tags) {
	            Eif (options.areaTags.indexOf(key)) {
	                return true;
	            }
	        }
 
	        return false;
	    }
 
	    function interestingNode(node, ways, relations) {
	        var used = false;
 
	        for (var i = 0; i < ways.length; i++) {
	            Eif (ways[i].nodes.indexOf(node) >= 0) {
	                used = true;
	                break;
	            }
	        }
 
	        if (!used) {
	            return true;
	        }
 
	        for (var _i = 0; _i < relations.length; _i++) {
	            if (relations[_i].members.indexOf(node) >= 0) {
	                return true;
	            }
	        }
 
	        return false;
	    }
	    function togeojson(data, options) {
	        var res = {
	            type: 'FeatureCollection',
	            features: []
	        };
	        if (data) {
	            res.features = getFeatures(data);
	        }
	        return res;
	    }
	}
 
	exports.default = factory;
 
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _osrm = __webpack_require__(18);
 
	var _osrm2 = _interopRequireDefault(_osrm);
 
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
	var osrmModule = angular.module('osm.osrm', []).provider('osrmAPI', function osrmAPIProvider() {
	    this.options = {
	        url: 'http://router.project-osrm.org'
	    };
	    this.$get = function osrmAPIFactory($http, $q) {
	        return new _osrm2.default($http, $q, this.options);
	    };
	    this.$get.$inject = ['$http', '$q'];
	});
 
	exports.default = osrmModule;
 
/***/ },
/* 18 */
/***/ function(module, exports) {
 
	'use strict';
 
	Object.defineProperty(exports, "__esModule", {
	    value: true
	});
 
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
	function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
	/**
	 * @ngdoc service
	 * @name osrmAPI
	 * @param  {any} $http
	 * @param  {any} $q
	 * @description
	 * https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md
	 */
 
	var osrmAPI = function () {
	    function osrmAPI($http, $q, options) {
	        _classCallCheck(this, osrmAPI);
 
	        this.url = options.url;
	        this.$http = $http;
	        this.$q = $q;
	    }
 
	    _createClass(osrmAPI, [{
	        key: 'get',
	        value: function get(service, version, profile, coordinates, options) {
	            var _coordinates = coordinates;
	            if (Array.isArray(coordinates)) {
	                _coordinates = coordinates.join(';');
	            }
	            var url = this.url + '/' + service + '/' + version + '/' + profile + '/' + _coordinates;
	            return this.$http.get(url, { params: options });
	        }
	        //coordinates is String of format {longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]
 
	    }, {
	        key: 'nearest',
	        value: function nearest(profile, coordinates, number) {
	            var options;
	            Iif (number) {
	                options = { number: number };
	            }
	            return this.get('nearest', 'v1', profile, coordinates, options);
	        }
	    }, {
	        key: 'route',
	        value: function route(profile, coordinates, options) {
	            return this.get('route', 'v1', profile, coordinates, options);
	        }
	    }, {
	        key: 'table',
	        value: function table(profile, coordinates, options) {
	            return this.get('table', 'v1', profile, coordinates, options);
	        }
	    }, {
	        key: 'match',
	        value: function match(profile, coordinates, options) {
	            return this.get('match', 'v1', profile, coordinates, options);
	        }
	    }, {
	        key: 'trip',
	        value: function trip(profile, coordinates, options) {
	            return this.get('trip', 'v1', profile, coordinates, options);
	        }
	    }]);
 
	    return osrmAPI;
	}();
 
	exports.default = osrmAPI;
 
/***/ }
/******/ ]);