diff --git a/query/reverse.js b/query/reverse.js index dba05935..a9c1d25c 100644 --- a/query/reverse.js +++ b/query/reverse.js @@ -65,25 +65,24 @@ function generateQuery( clean ){ // where point.lan/point.lon are provided in the // absense of boundary.circle.lat/boundary.circle.lon if( check.number(clean['boundary.circle.lat']) && - check.number(clean['boundary.circle.lon']) && - check.number(clean['boundary.circle.radius']) ){ - vs.set({ - 'boundary:circle:lat': clean['boundary.circle.lat'], - 'boundary:circle:lon': clean['boundary.circle.lon'], - 'boundary:circle:radius': clean['boundary.circle.radius'] + 'km' - }); - logStr += '[param:boundary_circle] '; - } - - // for coarse reverse when boundary circle radius is undefined - if( check.number(clean['boundary.circle.lat']) && - check.number(clean['boundary.circle.lon']) && - check.undefined(clean['boundary.circle.radius']) ){ - vs.set({ - 'boundary:circle:lat': clean['boundary.circle.lat'], - 'boundary:circle:lon': clean['boundary.circle.lon'], - 'boundary:circle:radius': defaults['boundary:circle:radius'] - }); + check.number(clean['boundary.circle.lon']) ){ + + vs.set({ + 'boundary:circle:lat': clean['boundary.circle.lat'], + 'boundary:circle:lon': clean['boundary.circle.lon'] + }); + + if (check.undefined(clean['boundary.circle.radius'])){ + // for coarse reverse when boundary circle radius is undefined + vs.set({ + 'boundary:circle:radius': defaults['boundary:circle:radius'] + }); + } else if (check.number(clean['boundary.circle.radius'])){ + // plain reverse where boundary circle is a valid number + vs.set({ + 'boundary:circle:radius': clean['boundary.circle.radius'] + 'km' + }); + } logStr += '[param:boundary_circle] '; }