Skip to content

Commit

Permalink
Merge pull request bcgov#227 from BK01/gh-pages
Browse files Browse the repository at this point in the history
Updated Location Services in Action demo app
  • Loading branch information
3rdmike authored Sep 23, 2024
2 parents 2e69870 + b43f10f commit af590bf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ols-demo/betweenPairs.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ <h1>BetweenPairs Demo</h1>

// API URLs
var apiKey = "11dd756f680c47b5aef5093d95543738";
var gcApi = "https://apps.gov.bc.ca/pub/geocoder/";
var gcApi = "https://geocoder.api.gov.bc.ca/";
var routeApi = "https://router.api.gov.bc.ca/";
var routeMethod = 'POST';
if(queryParams['env'] == 'tst') {
gcApi = "https://test.apps.gov.bc.ca/pub/geocoder/";
gcApi = "https://geocodertst.api.gov.bc.ca/";
routeApi = "https://routertst.api.gov.bc.ca/";
} else if(queryParams['env'] == 'dlv') {
gcApi = "https://delivery.apps.gov.bc.ca/pub/geocoder/";
gcApi = "https://geocoderdlv.api.gov.bc.ca/";
routeApi = "https://routerdlv.api.gov.bc.ca/";
} else if(queryParams['env'] == 'rri') {
gcApi = "https://ssl.refractions.net/ols/pub/geocoder/";
Expand Down
25 changes: 22 additions & 3 deletions ols-demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,13 @@
</button>
</div>
</div>
<!--div>
<div>
<input id="exactSpellingChk" type="checkbox" aria-label="Exact Spelling" title="Exact Spelling"> Exact Spelling<br/>
</div-->
</div>
</form>

<div>
<h5><b>Note:</b> exactSpelling is only suitable for demos. Enable by appending '&gc=tst' to the URL of this web application.</h5><br/>
<h4>Examples:</h4>
<ul>
<li>1175 Douglas St Victoria BC</li>
Expand Down Expand Up @@ -563,6 +565,10 @@ <h4>Examples:</h4>
<input id="simplifyDirectionsChk" class="routeOnChange" type="checkbox" aria-label="Simplify Directions" title="Simplify Directions"> Simplify Directions &nbsp;
Threshold (m): <input id="simplifyThreshold" class="routeOnChange" type="input" value="250" size="10" aria-label="Simply Threshold" title="Simplify Threshold">
</div>
<div class="routerControl" style="margin-right: 50px;">
<input id="snapDistanceChk" class="routeOnChange" type="checkbox" aria-label="Snap Distance" title="Snap Distance">
Snap Distance (m): <input id="snapDistance" class="routeOnChange" type="input" value="1000" size="10" aria-label="Snap Distance" title="Snap Distance">
</div>
<div class="routerControl">
<input id="truckControlsChk" class="routeOnChange" type="checkbox" aria-label="Truck Mode" title="Truck Mode"> Truck Mode</br>
<div id="truckControls">
Expand Down Expand Up @@ -1788,7 +1794,7 @@ <h4>Examples:</h4>
echo: true,
brief: true,
autoComplete: true,
//exactSpelling: $('#exactSpellingChk').is(':checked'),
exactSpelling: $('#exactSpellingChk').is(':checked'),
matchPrecisionNot: matchPrecisionNot,
locationDescriptor: defaultLocationDescriptor,
addressString: request.term
Expand Down Expand Up @@ -2049,6 +2055,13 @@ <h4>Examples:</h4>
if(!isNaN( $('#simplifyThreshold').val()) ) {
params['simplifyThreshold'] = $('#simplifyThreshold').val();
}

if($('#snapDistanceChk').is(':checked')) {
params['snapDistance'] = "true";
}
if(!isNaN( $('#snapDistance').val()) ) {
params['snapDistance'] = $('#snapDistance').val();
}

var date = $('#time').timepicker('getTime', $('#date').datepicker('getDate'));
params['departure'] = date2String(date);
Expand Down Expand Up @@ -2153,6 +2166,9 @@ <h4>Examples:</h4>
setCheckbox('#simplifyDirectionsChk', params['simplifyDirections']);
setTextField('#simplifyThreshold', params['simplifyThreshold']);

setCheckbox('#snapDistanceChk', params['snapDistance']);
setTextField('#snapDistance', params['snapDistance']);

if(params['departure']) {
let date = new Date(params['departure']);
$('#date').datepicker('setDate', date);
Expand Down Expand Up @@ -2953,6 +2969,9 @@ <h4>Examples:</h4>
if(data.simplifyThreshold) {
$('#simplifyThreshold').val(data.simplifyThreshold);
}
if(data.snapDistance) {
$('#snapDistance').val(data.snapDistance);
}
if(data.xingCost) {
var xingCosts = data.xingCost.split(",");
$('#yieldCost').val(xingCosts[0]);
Expand Down

0 comments on commit af590bf

Please sign in to comment.