Force coordinates into bounds when using the query tool

This commit is contained in:
Tom Hughes 2015-02-25 11:16:10 +00:00
parent e434cb154c
commit 2d22ab10f7
2 changed files with 8 additions and 7 deletions

View file

@ -259,8 +259,8 @@ OSM.Query = function(map) {
* for each object.
*/
function queryOverpass(lat, lng) {
var latlng = L.latLng(lat, lng),
bounds = map.getBounds(),
var latlng = L.latLng(lat, lng).wrap(),
bounds = map.getBounds().wrap(),
bbox = bounds.getSouth() + "," + bounds.getWest() + "," + bounds.getNorth() + "," + bounds.getEast(),
radius = 10 * Math.pow(1.5, 19 - map.getZoom()),
around = "around:" + radius + "," + lat + "," + lng,
@ -293,8 +293,9 @@ OSM.Query = function(map) {
function clickHandler(e) {
var precision = OSM.zoomPrecision(map.getZoom()),
lat = e.latlng.lat.toFixed(precision),
lng = e.latlng.lng.toFixed(precision);
latlng = e.latlng.wrap(),
lat = latlng.lat.toFixed(precision),
lng = latlng.lng.toFixed(precision);
OSM.router.route("/query?lat=" + lat + "&lon=" + lng);
}

View file

@ -126,7 +126,7 @@ CREATE TYPE user_status_enum AS ENUM (
CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
LANGUAGE c STRICT
AS '/srv/www/omniauth.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
--
@ -135,7 +135,7 @@ CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
LANGUAGE c STRICT
AS '/srv/www/omniauth.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
--
@ -144,7 +144,7 @@ CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
CREATE FUNCTION xid_to_int4(xid) RETURNS integer
LANGUAGE c IMMUTABLE STRICT
AS '/srv/www/omniauth.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
SET default_tablespace = '';