Skip to content
This repository was archived by the owner on Feb 28, 2022. It is now read-only.

Commit 71eb56e

Browse files
committed
feature: add osm.togeojson with a osmtogeojson injectable
the following API: osmtogeojson.options : object options osmtogeojson.getAsArray: return Array osmtogeojson.getFeatures: return Array osmtogeojson.getNodes: return Object osmtogeojson.getWays: return Array osmtogeojson.getRelations: return Array osmtogeojson.getTags: return Array osmtogeojson.buildFeatures: return Array osmtogeojson.isWayArea: return Boolean osmtogeojson.interestingNode: return Boolean osmtogeojson.togeojson: return Object
1 parent 6260a5d commit 71eb56e

9 files changed

+826
-6
lines changed

karma/conf.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
basePath : '',
33
files : [
4-
{pattern: '../node_modules/angular/angular.min.js', watched: true, included: true, nocache: true},
4+
{pattern: '../node_modules/angular/angular.js', watched: true, included: true, nocache: true},
55
{pattern: '../node_modules/ngstorage/ngStorage.min.js', watched: true, included: true, nocache: true},
66
{pattern: '../node_modules/angular-base64/angular-base64.min.js', watched: true, included: true, nocache: true},
77
{pattern: '../node_modules/x2js/x2js.js', watched: true, included: true, nocache: true},
@@ -13,12 +13,10 @@ module.exports = {
1313
exclude : [],
1414
autoWatch : true,
1515
frameworks: ['jasmine'],
16-
reporters: ['dots', 'coverage'],
16+
reporters: ['dots'],
1717
coverageReporter: {
1818
dir: '../coverage/'
1919
},
20-
preprocessors: {
21-
'../dist/osm-full.js': ['coverage']
22-
},
20+
preprocessors: {},
2321
logLevel: 'LOG_DEBUG'
2422
};

karma/karma.travis.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var conf = require('./conf');
22

33
module.exports = function(config){
44
conf.browsers = ['PhantomJS'];
5+
conf.reporters.push('coverage', 'coveralls');
6+
conf.preprocessors['../dist/osm-full.js'] = ['coverage'];
57
config.singleRun = true;
68
conf.coverageReporter.type = 'lcov';
79
config.set(conf);

src/api/api.service.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,54 @@ function osmAPI($base64, $http, $q, osmSettingsService, osmUtilsService, options
467467
return this.get('/0.6/node/' + id);
468468
};
469469

470+
/**
471+
* @ngdoc method
472+
* @name getNodeRelations
473+
* @methodOf osm.api.osmAPI
474+
* @param {string} id
475+
* @returns {Promise} $http.get response
476+
* GET /0.6/node/#id/relations
477+
*/
478+
this.getNodeRelations = function (id) {
479+
return this.get(`/0.6/node/${id}/relations`);
480+
};
481+
482+
/**
483+
* @ngdoc method
484+
* @name getNodeWays
485+
* @methodOf osm.api.osmAPI
486+
* @param {string} id
487+
* @returns {Promise} $http.get response
488+
* GET /0.6/node/#id/ways
489+
*/
490+
this.getNodeWays = function (id) {
491+
return this.get(`/0.6/node/${id}/ways`);
492+
};
493+
494+
/**
495+
* @ngdoc method
496+
* @name getNodeFull
497+
* @methodOf osm.api.osmAPI
498+
* @param {string} id
499+
* @returns {Promise} $http.get response
500+
* GET /0.6/node/#id/full
501+
*/
502+
this.getNodeFull = function (id) {
503+
return this.get(`/0.6/node/${id}/full`);
504+
};
505+
506+
/**
507+
* @ngdoc method
508+
* @name getNodes
509+
* @methodOf osm.api.osmAPI
510+
* @param {array} ids
511+
* @returns {Promise} $http.get response
512+
* GET /0.6/node/#id
513+
*/
514+
this.getNodes = function (ids) {
515+
return this.get('/0.6/nodes?nodes=' + ids.join(','));
516+
};
517+
470518
/**
471519
* @ngdoc method
472520
* @name deleteNode
@@ -518,6 +566,44 @@ function osmAPI($base64, $http, $q, osmSettingsService, osmUtilsService, options
518566
return this.get('/0.6/way/' + id);
519567
};
520568

569+
/**
570+
* @ngdoc method
571+
* @name getWayRelations
572+
* @methodOf osm.api.osmAPI
573+
* @param {string} id
574+
* @returns {Promise} $http.get response
575+
* GET /0.6/way/#id/relations
576+
*/
577+
this.getWayRelations = function (id) {
578+
return this.get(`/0.6/way/${id}/relations`);
579+
};
580+
581+
582+
/**
583+
* @ngdoc method
584+
* @name getWayFull
585+
* @methodOf osm.api.osmAPI
586+
* @param {string} id
587+
* @returns {Promise} $http.get response
588+
* GET /0.6/way/#id/full
589+
*/
590+
this.getWayFull = function (id) {
591+
return this.get(`/0.6/way/${id}/full`);
592+
};
593+
594+
/**
595+
* @ngdoc method
596+
* @name getWays
597+
* @methodOf osm.api.osmAPI
598+
* @param {array} ids
599+
* @returns {Promise} $http.get response
600+
* GET /0.6/ways?ways=ids
601+
*/
602+
this.getWays = function (ids) {
603+
return this.get('/0.6/ways?ways=' + ids.join(','));
604+
};
605+
606+
521607
/**
522608
* @ngdoc method
523609
* @name deleteWay
@@ -566,6 +652,42 @@ function osmAPI($base64, $http, $q, osmSettingsService, osmUtilsService, options
566652
this.getRelation = function (id) {
567653
return this.get('/0.6/relation/' + id);
568654
};
655+
/**
656+
* @ngdoc method
657+
* @name getRelationRelations
658+
* @methodOf osm.api.osmAPI
659+
* @param {string} id
660+
* @returns {Promise} $http.get response
661+
* GET /0.6/relation/#id/relations
662+
*/
663+
this.getRelationRelations = function (id) {
664+
return this.get(`/0.6/relation/${id}/relations`);
665+
};
666+
667+
668+
/**
669+
* @ngdoc method
670+
* @name getRelationFull
671+
* @methodOf osm.api.osmAPI
672+
* @param {string} id
673+
* @returns {Promise} $http.get response
674+
* GET /0.6/relation/#id/full
675+
*/
676+
this.getRelationFull = function (id) {
677+
return this.get(`/0.6/relation/${id}/full`);
678+
};
679+
680+
/**
681+
* @ngdoc method
682+
* @name getRelations
683+
* @methodOf osm.api.osmAPI
684+
* @param {array} ids
685+
* @returns {Promise} $http.get response
686+
* GET /0.6/relations?relations=ids
687+
*/
688+
this.getRelations = function (ids) {
689+
return this.get('/0.6/relations?relations=' + ids.join(','));
690+
};
569691

570692
/**
571693
* @ngdoc method

src/osm.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import overpass from './overpass/overpass';
66
import taginfo from './taginfo/taginfo';
77
import settings from './settings/settings';
88
import nominatim from './nominatim/nominatim';
9+
import togeojson from './togeojson/togeojson';
910

1011
angular.module('osm', [
1112
settings.name,
1213
api.name,
1314
overpass.name,
1415
taginfo.name,
1516
oauth.name,
16-
nominatim.name
17+
nominatim.name,
18+
togeojson.name
1719
]);

0 commit comments

Comments
 (0)