aboutsummaryrefslogtreecommitdiff
path: root/resources/map.js
diff options
context:
space:
mode:
authorHarry Cutts <eternal.linux@gmail.com>2012-12-02 13:50:10 +0000
committerHarry Cutts <eternal.linux@gmail.com>2012-12-02 13:50:10 +0000
commitb09b0a7b374c1d60e5f3d041bb45b15bccaca5b3 (patch)
treeb1ce8280170493859cb97d19c44a0b7c61f95273 /resources/map.js
parentc2e6cb5ed6e35c42659f10f7e5703798938335a6 (diff)
downloadhealth-map-b09b0a7b374c1d60e5f3d041bb45b15bccaca5b3.tar
health-map-b09b0a7b374c1d60e5f3d041bb45b15bccaca5b3.tar.gz
Change from using GET to POST, for neatness
Diffstat (limited to 'resources/map.js')
-rw-r--r--resources/map.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/resources/map.js b/resources/map.js
index b9edc79..86b6ea6 100644
--- a/resources/map.js
+++ b/resources/map.js
@@ -53,10 +53,11 @@ $(document).ready(function() {
$('.leaflet-control-layers-selector').first().trigger('click')
}
- function createQueryURL(bbox) {
- return "http://overpass-api.de/api/interpreter?" +
- "data=[out:json];(node[amenity=hospital](" + bbox +
- ");way[amenity=hospital]("+ bbox +");node(w););out;";
+ function createQueryData(bbox) {
+ // TODO: Use POST instead of GET, for neatness
+ return "data=[out:json];" +
+ "(node[amenity=hospital]("+ bbox
+ +");way[amenity=hospital]("+ bbox +");node(w););out;";
}
map.on('hospitalsfetched', addHospitalLayer);
@@ -74,9 +75,9 @@ $(document).ready(function() {
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
bbox = [sw.lat, sw.lng, ne.lat, ne.lng].join(',');
- var url = createQueryURL(bbox);
+ var data = createQueryData(bbox);
converter = new op2geojson();
- converter.fetch(url, function(data) {
+ converter.fetch("http://overpass-api.de/api/interpreter", data, function(data) {
self.hospitals = data;
layer = buildLayer(data)
self.hospitalLayer.addData(data);
@@ -124,9 +125,9 @@ $(document).ready(function() {
}
function geojsonLayer() {
- url = createQueryURL(52.34,13.3,52.52,13.6);
+ data = createQueryData([52.34,13.3,52.52,13.6]);
converter = new op2geojson();
- converter.fetch(url, function(data) {
+ converter.fetch("http://overpass-api.de/api/interpreter", data, function(data) {
self.hospitals = data;
layer = buildLayer(data);
self.hospitalLayer = layer;