From 58359fe4ac1cc833abdc2e66dc70b20a1a95a575 Mon Sep 17 00:00:00 2001 From: Dr Scott Date: Thu, 1 Mar 2012 23:21:27 +0100 Subject: [PATCH 1/2] support coordinates as start/end point --- Docs/WebFrontend/Geocode.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Docs/WebFrontend/Geocode.js b/Docs/WebFrontend/Geocode.js index 0757177ef..24f71e5a0 100644 --- a/Docs/WebFrontend/Geocode.js +++ b/Docs/WebFrontend/Geocode.js @@ -50,6 +50,23 @@ function geocodeAddress(tf){ freeform = document.getElementById('tfEndSearch').value; } + if(freeform.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*,\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ + + var marker; + if(tf == 'start'){ + isStartPointSet = true; + marker = 'start'; + } + if(tf == 'end'){ + isEndPointSet = true; + marker = 'end'; + } + var coord = freeform.split(","); + lonlat = new OpenLayers.LonLat(coord[1],coord[0]); + setMarkerAndZoom(marker, lonlat); + return; + } + document.getElementById('information').style.visibility = 'visible'; document.getElementById('information').innerHTML = '

One moment please ...

'; From 93bccf36ba10a264841bab77f109b1b1915b2ca7 Mon Sep 17 00:00:00 2001 From: Dr Scott Date: Fri, 2 Mar 2012 19:05:17 +0100 Subject: [PATCH 2/2] support coordinates as start/end point: also accept semicolon as separator --- Docs/WebFrontend/Geocode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/WebFrontend/Geocode.js b/Docs/WebFrontend/Geocode.js index 24f71e5a0..82958b0dd 100644 --- a/Docs/WebFrontend/Geocode.js +++ b/Docs/WebFrontend/Geocode.js @@ -50,7 +50,7 @@ function geocodeAddress(tf){ freeform = document.getElementById('tfEndSearch').value; } - if(freeform.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*,\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ + if(freeform.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ var marker; if(tf == 'start'){ @@ -61,7 +61,7 @@ function geocodeAddress(tf){ isEndPointSet = true; marker = 'end'; } - var coord = freeform.split(","); + var coord = freeform.split(/[,;]/); lonlat = new OpenLayers.LonLat(coord[1],coord[0]); setMarkerAndZoom(marker, lonlat); return;