diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d0fb7d6..0517ed8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Deprecated ### Removed--> +## [v0.5.2] - 2020-05-12 + +### Fixed +- avoid features & polygons not working for isochrones +### Changed +- isochrones endpoint to V2 API +### Removed +- Mapsurfer baselayer + ## [v0.5.1] - 2020-05-07 ### Added diff --git a/Gruntfile.default.js b/Gruntfile.default.js index 5961d5d6..9c066434 100644 --- a/Gruntfile.default.js +++ b/Gruntfile.default.js @@ -274,7 +274,7 @@ module.exports = function(grunt) { directions: "http://localhost:3005/ors/v2/directions", isochrones: - "http://localhost:3005/ors/isochrones", + "http://localhost:3005/ors/v2/isochrones", matrix: "http://localhost:3005/ors/matrix", pois: @@ -298,7 +298,7 @@ module.exports = function(grunt) { directions: "https://api.openrouteservice.org/v2/directions", isochrones: - "https://api.openrouteservice.org/isochrones", + "https://api.openrouteservice.org/v2/isochrones", matrix: "https://api.openrouteservice.org/matrix", pois: "https://api.openrouteservice.org/pois", shortenlink: "https://api-ssl.bitly.com/v3/shorten", diff --git a/app/components/ors-header/ors-header.js b/app/components/ors-header/ors-header.js index b2bc333e..4ea85466 100755 --- a/app/components/ors-header/ors-header.js +++ b/app/components/ors-header/ors-header.js @@ -74,8 +74,13 @@ angular.module("orsApp.ors-header", []).component("orsHeader", { angular.forEach(Object.keys(ctrl.currentOptions.env), key => { ctrl.envBase = "https://api.openrouteservice.org"; ctrl.currentOptions.env[key] = ctrl.envBase + "/"; - ctrl.currentOptions.env[key] += - key === "directions" ? "v2/" + key : key; + ctrl.currentOptions.env[key] += [ + "directions", + "isochrones", + "matrix" + ].includes(key) + ? "v2/" + key + : key; }); } else if (fill === "default") { angular.forEach(Object.keys(ctrl.currentOptions.env), key => { diff --git a/app/components/ors-map/ors-map.js b/app/components/ors-map/ors-map.js index ee7d2c7c..ed76819c 100755 --- a/app/components/ors-map/ors-map.js +++ b/app/components/ors-map/ors-map.js @@ -62,10 +62,6 @@ angular.module("orsApp").directive("orsMap", () => { let ak = "?api_key=" + apiKey; $scope.translateFilter = $filter("translate"); - const mapsurfer = L.tileLayer(ENV.mapsurfer + ak, { - attribution: orsNamespaces.layerMapSurfer.attribution, - id: 0 - }); const bkgtopplus = L.tileLayer.wms(orsNamespaces.layerBkgTopPlus.url, { layers: "web", format: "image/png", @@ -397,7 +393,7 @@ angular.module("orsApp").directive("orsMap", () => { orsCookiesFactory.getMapOptions() && orsCookiesFactory.getMapOptions().msi ? orsCookiesFactory.getMapOptions().msi - : 0; + : 3; // mapOptionsInitSubject is a replay subject and only subscribes once let mapInitSubject = orsSettingsFactory.mapOptionsInitSubject.subscribe( @@ -514,7 +510,6 @@ angular.module("orsApp").directive("orsMap", () => { setSettings(); }; $scope.baseLayers = { - OpenMapSurfer: mapsurfer, "TopPlus-Web-Open": bkgtopplus, "TopPlus-Web-Open Greyscale": bkgtopplusgrey, OpenStreetMap: openstreetmap, @@ -530,7 +525,6 @@ angular.module("orsApp").directive("orsMap", () => { // add mapstyle angular.forEach($scope.baseLayers, (value, key) => { if (value.options.id === $scope.mapStyleId) { - console.log($scope.mapStyleId, $scope.baseLayers); $scope.baseLayers[key].addTo($scope.orsMap); } }); diff --git a/app/components/ors-navigation/ors-nav.js b/app/components/ors-navigation/ors-nav.js index 00e86165..270b97bf 100755 --- a/app/components/ors-navigation/ors-nav.js +++ b/app/components/ors-navigation/ors-nav.js @@ -13,7 +13,7 @@ angular if ($location.path() === "/") { ctrl.activeMenu = "/directions"; } else ctrl.activeMenu = $location.path(); - ctrl.version = "0.5.1"; + ctrl.version = "0.5.2"; } ], $routeConfig: [ diff --git a/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-queries.html b/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-queries.html index 8fd98334..1cbeb353 100755 --- a/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-queries.html +++ b/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-queries.html @@ -1,5 +1,15 @@ -
@@ -93,7 +93,7 @@ |
- + | @@ -109,25 +109,31 @@ | |||
---|---|---|---|---|---|
- + - + | - + | -- + | + | - + | diff --git a/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-query/ors-aa-query.js b/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-query/ors-aa-query.js index 3e88372f..de6c070c 100755 --- a/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-query/ors-aa-query.js +++ b/app/components/ors-panel-accessibilityanalysis/ors-aa-queries/ors-aa-query/ors-aa-query.js @@ -128,8 +128,7 @@ angular.module("orsApp.ors-aa-query", []).component("orsAaQuery", { ctrl.toggleInterval = (intervalIdx, event) => { event.preventDefault(); event.stopPropagation(); - let reverseIndex = - ctrl.attributes.info.query.ranges.length - 1 - intervalIdx; + let reverseIndex = ctrl.attributes.features.length - 1 - intervalIdx; ctrl.onToggleInterval({ obj: { isoidx: ctrl.isochroneIdx, diff --git a/app/constants/lists.js b/app/constants/lists.js index c47531be..bfb33697 100755 --- a/app/constants/lists.js +++ b/app/constants/lists.js @@ -271,13 +271,7 @@ angular.module("orsApp").constant("lists", { }, fords: { name: "fords", - subgroups: [ - "Car", - "Bicycle", - "HeavyVehicle", - "Wheelchair", - "Pedestrian" - ] + subgroups: ["Bicycle", "Wheelchair", "Pedestrian"] }, steps: { name: "steps", diff --git a/app/constants/namespaces.js b/app/constants/namespaces.js index 80cb5312..8ea06f22 100755 --- a/app/constants/namespaces.js +++ b/app/constants/namespaces.js @@ -47,15 +47,6 @@ angular.module("orsApp").constant("orsNamespaces", { keywords: "Openrouteservice. Routing. GIS. Universität Heidelberg", src: "Route point logged using Openrouteservice" }, - /** - * map layers used on the openlayers map - */ - //url to Open Map Surfer layer - layerMapSurfer: { - url: "https://api.openrouteservice.org/mapsurfer/{z}/{x}/{y}.png", - attribution: - 'Map data © OpenStreetMap contributors, powered by MapSurfer.NET' - }, //url to hillshade overlay layerHs: "https://korona.geog.uni-heidelberg.de/tiles/asterh/x={x}&y={y}&z={z}", diff --git a/app/infrastructure/ors-aa-service.js b/app/infrastructure/ors-aa-service.js index 7fea1b7b..b733bdb0 100755 --- a/app/infrastructure/ors-aa-service.js +++ b/app/infrastructure/ors-aa-service.js @@ -143,7 +143,7 @@ angular.module("orsApp.aa-service", []).factory("orsAaService", [ action = orsObjectsFactory.createMapAction( 34, lists.layers[5], - isochronesObj.info.query.locations[0], + isochronesObj.metadata.query.locations[0], idx ); orsMapFactory.mapServiceSubject.onNext(action); @@ -186,7 +186,7 @@ angular.module("orsApp.aa-service", []).factory("orsAaService", [ orsAaService.processResponse = (data, settings) => { orsAaService.orsAaObj = data; // add geocode address - orsAaService.orsAaObj.info.address = settings.waypoints[0]._address; + orsAaService.orsAaObj.metadata.address = settings.waypoints[0]._address; // reverse order, needed as leaflet ISO 6709 for (let i = 0; i < orsAaService.orsAaObj.features.length; i++) { for ( @@ -199,39 +199,12 @@ angular.module("orsApp.aa-service", []).factory("orsAaService", [ ].reverse(); } } - // split ranges into list - orsAaService.orsAaObj.info.query.ranges = orsAaService.orsAaObj.info.query.ranges.split( - "," - ); orsAaService.aaSubject.onNext(orsAaService.orsAaObj); }; /** Subscription function to current aa responses object, used in panel. */ orsAaService.subscribeToAaQueries = o => { return orsAaService.aaSubject.subscribe(o); }; - /** - * Requests accessiblity analysis from ORS backend - * @param {String} requestData: XML for request payload - */ - orsAaService.getIsochrones = requestData => { - var url = ENV.isochrones; - var canceller = $q.defer(); - var cancel = reason => { - canceller.resolve(reason); - }; - var promise = $http - .get(url, { - params: requestData, - timeout: canceller.promise - }) - .then(response => { - return response.data; - }); - return { - promise: promise, - cancel: cancel - }; - }; return orsAaService; } ]); diff --git a/app/infrastructure/ors-importexport-service.js b/app/infrastructure/ors-importexport-service.js index 71df0b59..75f67448 100755 --- a/app/infrastructure/ors-importexport-service.js +++ b/app/infrastructure/ors-importexport-service.js @@ -79,7 +79,7 @@ angular // create a simple Course TCX file (MARQ24) // see https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd let toTcx = (name, speedInKmPerH) => { - let version = "0.5.1"; + let version = "0.5.2"; let pointInformation = orsRouteService.data.features[orsRouteService.getCurrentRouteIdx()] .point_information; diff --git a/app/infrastructure/ors-route-service.js b/app/infrastructure/ors-route-service.js index 1dedc4aa..a5421594 100755 --- a/app/infrastructure/ors-route-service.js +++ b/app/infrastructure/ors-route-service.js @@ -56,29 +56,6 @@ angular.module("orsApp.route-service", []).factory("orsRouteService", [ } orsRouteService.routingRequests.requests = []; }; - /** - * Requests route from ORS backend - * @param {String} requestData: XML for request payload - */ - orsRouteService.fetchRoute = requestData => { - let url = ENV.directions; - const canceller = $q.defer(); - const cancel = reason => { - canceller.resolve(reason); - }; - url += `/${requestData.profile}/${requestData.geometry_format}`; - delete requestData.profile; - delete requestData.geometry_format; - const promise = $http - .post(url, requestData, { timeout: canceller.promise }) - .then(response => { - return response.data; - }); - return { - promise: promise, - cancel: cancel - }; - }; orsRouteService.setCurrentRouteIdx = idx => { orsRouteService.currentRouteIdx = idx; }; diff --git a/app/infrastructure/ors-settings-service.js b/app/infrastructure/ors-settings-service.js index 2479e54f..b85230aa 100755 --- a/app/infrastructure/ors-settings-service.js +++ b/app/infrastructure/ors-settings-service.js @@ -245,7 +245,7 @@ angular.module("orsApp.settings-service", []).factory("orsSettingsFactory", [ orsRouteService.resetRoute(); const userOptions = orsSettingsFactory.getUserOptions(); const payload = orsUtilsService.routingPayload(settings, userOptions); - const request = orsRouteService.fetchRoute(payload); + const request = orsUtilsService.createRequest("directions", payload); orsRouteService.routingRequests.requests.push(request); request.promise.then( function(response) { @@ -280,7 +280,7 @@ angular.module("orsApp.settings-service", []).factory("orsSettingsFactory", [ /** Cancel outstanding requests */ orsAaService.aaRequests.clear(); const payload = orsUtilsService.isochronesPayload(settings); - const request = orsAaService.getIsochrones(payload); + const request = orsUtilsService.createRequest("isochrones", payload); orsAaService.aaRequests.requests.push(request); request.promise.then( function(response) { diff --git a/app/infrastructure/ors-utils-service.js b/app/infrastructure/ors-utils-service.js index d0587826..9ec5c7c3 100755 --- a/app/infrastructure/ors-utils-service.js +++ b/app/infrastructure/ors-utils-service.js @@ -430,20 +430,23 @@ angular.module("orsApp.utils-service", []).factory("orsUtilsService", [ let payload; payload = { format: "json", - locations: - orsUtilsService.roundCoordinate(settings.waypoints[0]._latlng.lng) + - "," + - orsUtilsService.roundCoordinate(settings.waypoints[0]._latlng.lat), + locations: [ + [ + orsUtilsService.roundCoordinate(settings.waypoints[0]._latlng.lng), + orsUtilsService.roundCoordinate(settings.waypoints[0]._latlng.lat) + ] + ], // this will suppress the jshint error for linebreak before ternary /*jshint -W014 */ range_type: parseInt(settings.profile.options.analysis_options.method) === 0 ? "time" : "distance", - range: + range: [ parseInt(settings.profile.options.analysis_options.method) === 0 ? settings.profile.options.analysis_options.isovalue * 60 - : settings.profile.options.analysis_options.isovalue * 1000, + : settings.profile.options.analysis_options.isovalue * 1000 + ], interval: parseInt(settings.profile.options.analysis_options.method) === 0 ? settings.profile.options.analysis_options.isointerval * 60 @@ -454,8 +457,8 @@ angular.module("orsApp.utils-service", []).factory("orsUtilsService", [ : lists.isochroneOptionList.reverseFlow.start, /*jshint +W014 */ profile: lists.profiles[settings.profile.type].request, - attributes: "area|reachfactor|total_pop", - options: JSON.stringify(orsUtilsService.generateOptions(settings)) + attributes: ["area", "reachfactor", "total_pop"], + options: orsUtilsService.generateOptions(settings) }; // remove options if empty if ( @@ -829,6 +832,27 @@ angular.module("orsApp.utils-service", []).factory("orsUtilsService", [ } } }; + orsUtilsService.createRequest = (type, requestData) => { + let url = ENV[type]; + const canceller = $q.defer(); + const cancel = reason => { + canceller.resolve(reason); + }; + url += `/${requestData.profile}`; + if (type === "directions") url += `/${requestData.geometry_format}`; + delete requestData.profile; + delete requestData.geometry_format; + delete requestData.format; + const promise = $http + .post(url, requestData, { timeout: canceller.promise }) + .then(response => { + return response.data; + }); + return { + promise: promise, + cancel: cancel + }; + }; return orsUtilsService; } ]); diff --git a/app/js/app.js b/app/js/app.js index 3b54ed9f..6b718e39 100755 --- a/app/js/app.js +++ b/app/js/app.js @@ -10,7 +10,7 @@ *|------------------------------------------------------------------------------------*/ /** * @author: Amandus Butzer, amandus@openrouteservice.org, Timothy Ellersiek, timothy@openrouteservice.org - * @version: 0.5.1 + * @version: 0.5.2 */ (function(searchString, position) { fetchData().then(bootstrapApplication); @@ -96,7 +96,7 @@ config.url === ENV.geocode + "/autocomplete" || config.url === ENV.geocode + "/reverse" || config.url.startsWith(ENV.directions) || - config.url === ENV.isochrones || + config.url.startsWith(ENV.isochrones) || config.url === ENV.pois || config.url === ENV.matrix || config.url === ENV.mapsurfer || diff --git a/bower.json b/bower.json index 1847f0c7..2343f914 100755 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "openrouteservice.org", "description": "angular version of openrouteservice.org", - "version": "0.5.1", + "version": "0.5.2", "homepage": "http://www.heigit.org", "license": "ISC", "private": true, diff --git a/package-lock.json b/package-lock.json index 822ac8cd..e534b2f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "maps.openrouteservice.org", - "version": "0.5.1", + "version": "0.5.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f2e3014a..5a2714b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maps.openrouteservice.org", - "version": "0.5.1", + "version": "0.5.2", "repository": { "type": "git", "url": "https://github.com/GIScience/openrouteservice-app.git" |