Backend: implemented get cells in a rectangle geolocation. Frontend: added map style, and antena icon.

This commit is contained in:
arnaucode
2017-07-31 19:55:42 +02:00
parent 536af3ea4d
commit 66a9ce4f85
12 changed files with 61 additions and 250 deletions

View File

@@ -16,13 +16,21 @@ angular.module('app.main', ['ngRoute', 'ui-leaflet'])
$scope.markers = [];
$scope.paths = [];
$scope.tiles = {
url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
//url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
url: "http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
// més estils https://leaflet-extras.github.io/leaflet-providers/preview/
options: {
attribution: '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}
};
//var antennaIcon = L.icon({
var antennaIcon = {
iconUrl: 'img/antenna.png',
iconSize: [50, 50], // size of the icon
iconAnchor: [25, 50], // point of the icon which will correspond to marker's location
};
$http.get(urlapi + 'allcells')
$http.get(urlapi + 'cells/43.73429/7.41841/43.73210/7.42196')
.then(function(data) {
console.log('data success');
console.log(data);
@@ -33,19 +41,15 @@ angular.module('app.main', ['ngRoute', 'ui-leaflet'])
$scope.markers.push({
lat: Number($scope.cells[i].lat),
lng: Number($scope.cells[i].lon),
message: $scope.cells[i].mcc
});
$scope.markers.push({
lat: Number($scope.cells[i].lat),
lng: Number($scope.cells[i].lon),
message: $scope.cells[i].mcc
message: $scope.cells[i].mcc,
icon: antennaIcon
});
}
$scope.center = {
lat: (Number($scope.cells[0].lat) + Number($scope.cells[0].lat)) / 2,
lng: (Number($scope.cells[0].lon) + Number($scope.cells[0].lon)) / 2,
zoom: 4
zoom: 16
};
}, function(data) {
console.log('data error');