~mil/mepo

246ff11511940b0fe22f75fb02e2dd087e000ef2 — Dimitri Kaparis 19 days ago 9d8bd98 master
Fix Nominatim search non-latin queries

Submitting query to Nominatim with non-latin characters fails and no
results are displayed. Using the data-urlencode option of curl encodes
the query properly.
2 files changed, 2 insertions(+), 2 deletions(-)

M scripts/mepo_ui_menu_reposition_nominatim.sh
M scripts/mepo_ui_menu_search_nominatim.sh
M scripts/mepo_ui_menu_reposition_nominatim.sh => scripts/mepo_ui_menu_reposition_nominatim.sh +1 -1
@@ 37,7 37,7 @@ main() {
  echo "$QUERY" | grep -q . || err "Blank search query"

  RESULT="$(
    curl -Ss "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY" |
    curl -GSs --data-urlencode "q=$QUERY" "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json" |
      jq '.[] | "\(.display_name) \(.lat) \(.lon)" ' |
      PROMPT="Pick result" mepo_ui_helper_menu.sh 
  )"

M scripts/mepo_ui_menu_search_nominatim.sh => scripts/mepo_ui_menu_search_nominatim.sh +1 -1
@@ 33,7 33,7 @@ main() {

  VIEWBOX="$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON,$MEPO_BR_LAT"
  JSONRESULTS="$(
    curl -Ss "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50&extratags=1"
    curl -GSs --data-urlencode "q=$QUERY" "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&viewbox=$VIEWBOX&bounded=1&limit=50&extratags=1"
  )"

  PINSETUPCOMMANDS='