script csv to mongodb, REST server, webapp showing map with allcells

This commit is contained in:
arnaucode
2017-07-30 01:18:25 +02:00
parent 57dc303615
commit 536af3ea4d
22 changed files with 1074 additions and 0 deletions

37
web/views/main/main.html Normal file
View File

@@ -0,0 +1,37 @@
<div class="container">
<div class="row">
<div class="col-sm-3">
<div class="panel">
<div class="panel-heading c_blueGrey300">
<h3 class="panel-title">Cells</h3>
</div>
<div class="panel-body" style="max-height: 500px;overflow-y: scroll;">
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>MCC</th>
<th>Area</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="cell in cells">
<td>{{cell.mcc}}</td>
<td>{{cell.area}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-9">
<div class="panel">
<div class="panel-heading c_blueGrey300">
<h3 class="panel-title">Map</h3>
</div>
<div class="panel-body">
<leaflet width="100%" height="600px" markers="markers" paths="paths" center="center" tiles="tiles" id="map-simple-map"></leaflet>
</div>
</div>
</div>
</div>
</div>

53
web/views/main/main.js Normal file
View File

@@ -0,0 +1,53 @@
'use strict';
angular.module('app.main', ['ngRoute', 'ui-leaflet'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/main', {
templateUrl: 'views/main/main.html',
controller: 'MainCtrl'
});
}])
.controller('MainCtrl', function($scope, $http) {
//map
$scope.center = {};
$scope.bounds = {};
$scope.markers = [];
$scope.paths = [];
$scope.tiles = {
url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
options: {
attribution: '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}
};
$http.get(urlapi + 'allcells')
.then(function(data) {
console.log('data success');
console.log(data);
$scope.cells = data.data;
//draw markers on map
$scope.markers = [];
for (var i = 0; i < $scope.cells.length; i++) {
$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
});
}
$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
};
}, function(data) {
console.log('data error');
});
});