-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapBoundsLatLng
More file actions
25 lines (24 loc) · 1.1 KB
/
MapBoundsLatLng
File metadata and controls
25 lines (24 loc) · 1.1 KB
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
function _showZones() {
vm.schoolsInMapBounds = [];
NgMap.getMap('map').then(function(map)
{
vm.map = map;
var bounds = vm.map.getBounds()
var bounds = bounds.toString();
var string = bounds.split(' ');
var latS = string[0].split('((');
var latS = latS[1];
var latN = string[2].split('(');
var latN = latN[1]
var lastLatN = latN.split(',');
var lastLatN = lastLatN[0];
var lonW = string[1].split('),');
var lonW = lonW[0];
var lonE = string[3].split('))');
var lonE = lonE[0];
var polygon = 'POLYGON(('+lonW + ' ' + latN + ' ' + lonW + ' ' + latS + ' ' + lonE + ' ' + latS + ' ' + lonE + ' ' + latN + ' ' + lonW + ' ' + lastLatN + '))';
var call = {polygon:polygon};
vm.emptySchools();
vm.schoolsService.getMapBoundsSchools(call, vm.onSuccessGetMapSchools, vm.onError);
});
}