summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-09-06 18:22:54 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-09-06 18:22:54 +0100
commit063c97feb6a9cafc822fab0b53e66ff1cd0c10a3 (patch)
tree78b1fb3f2d0b33507cda61d85e74ee0b30c0f3fb
parent6efe207d14c79229cb4c02ffd56270ad05f671ce (diff)
downloadleaflet-soton-063c97feb6a9cafc822fab0b53e66ff1cd0c10a3.tar
leaflet-soton-063c97feb6a9cafc822fab0b53e66ff1cd0c10a3.tar.gz
Precalculate centers for buildings
Currently done because this is the simplist way of doing it.
-rwxr-xr-xcreate-data.js5
-rw-r--r--src/leaflet-soton.js10
2 files changed, 5 insertions, 10 deletions
diff --git a/create-data.js b/create-data.js
index d97092c..d0e8202 100755
--- a/create-data.js
+++ b/create-data.js
@@ -209,8 +209,9 @@ function createTable(name, query, callback) {
function createCollections(callback) {
var collectionQueries = {
- buildings: 'select ST_AsGeoJSON(ST_Transform(way, 4326), 10) as \
- polygon,name,loc_ref,uri,leisure,height \
+ buildings: 'select ST_AsGeoJSON(ST_Transform(way, 4326), 10) as polygon,\
+ ST_AsText(ST_Transform(ST_Centroid(way), 4326)) as center,\
+ name,loc_ref,uri,leisure,height \
from uni_building where uri is not null',
parking: 'select ST_AsGeoJSON(ST_Transform(way, 4326), 10) as polygon,\
name,access,capacity,"capacity:disabled",fee from uni_parking',
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js
index b9818bc..e5bb696 100644
--- a/src/leaflet-soton.js
+++ b/src/leaflet-soton.js
@@ -821,15 +821,9 @@ SELECT * WHERE {\
map,
function() { map.closeInfo(); });
- var temp = { _rings: building.geometry.coordinates, _map: this };
+ map.panTo(building.properties.center);
-
- var center = building.geometry.coordinates[0][0];
- center = [center[1], center[0]];
-
- map.panTo(center);
-
- map.showInfo(content, center);
+ map.showInfo(content, building.properties.center);
return;
}