~mil/mepo-devel

Fix Nominatim search non-latin queries v1 PROPOSED

Dimitri Kaparis: 1
 Fix Nominatim search non-latin queries

 2 files changed, 2 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/mepo-devel/patches/55985/mbox | git am -3
Learn more about email & git

[PATCH] Fix Nominatim search non-latin queries Export this patch

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.
---
 scripts/mepo_ui_menu_reposition_nominatim.sh | 2 +-
 scripts/mepo_ui_menu_search_nominatim.sh     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/mepo_ui_menu_reposition_nominatim.sh b/scripts/mepo_ui_menu_reposition_nominatim.sh
index e854dc8..dcb455f 100755
--- a/scripts/mepo_ui_menu_reposition_nominatim.sh
+++ b/scripts/mepo_ui_menu_reposition_nominatim.sh
@@ -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 
  )"
diff --git a/scripts/mepo_ui_menu_search_nominatim.sh b/scripts/mepo_ui_menu_search_nominatim.sh
index 5b454d7..819a27b 100755
--- a/scripts/mepo_ui_menu_search_nominatim.sh
+++ b/scripts/mepo_ui_menu_search_nominatim.sh
@@ -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='
-- 
2.47.0