]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Mapstraction/usermap.js
169686a5040038942d8e9ba86802563be1fec342
[quix0rs-gnu-social.git] / plugins / Mapstraction / usermap.js
1 $(document).ready(function() {
2      var mapstraction = new mxn.Mapstraction("map_canvas", _provider);
3
4      var minLat = 181.0;
5      var maxLat = -181.0;
6      var minLon = 181.0;
7      var maxLon = -181.0;
8
9      for (var i in _notices)
10      {
11           var n = _notices[i];
12
13           var lat = n['geo']['coordinates'][0];
14           var lon = n['geo']['coordinates'][1];
15
16           if (lat < minLat) {
17                minLat = lat;
18           }
19
20           if (lat > maxLat) {
21                maxLat = lat;
22           }
23
24           if (lon < minLon) {
25                minLon = lon;
26           }
27
28           if (lon > maxLon) {
29                maxLon = lon;
30           }
31      }
32
33      var myPoint = new mxn.LatLonPoint(minLat + Math.abs(maxLat - minLat)/2,
34                                        minLon + Math.abs(maxLon - minLon)/2);
35
36      // display the map centered on a latitude and longitude (Google zoom levels)
37
38      mapstraction.setCenterAndZoom(myPoint, 9);
39 });