3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
257 stars 143 forks source link

Search by address bar on my lizmap map #4372

Closed soukac98 closed 2 months ago

soukac98 commented 5 months ago

What is the question? (in English)

How to add a tool/search bar into lizmap, so that the user can search by address?

Versions, safeguards, check summary etc

https://github.com/3liz/lizmap-web-client/releases/tag/3.7.6

Check Lizmap plugin

Operating system

windows 10 professionnel

Browsers

Chrome

Browsers version

Chrome

Relevant log output

No response

guenterw commented 5 months ago

this setting in the QGIS Lizmap plugin image

leads to the search field at the top right image (the terms have been changed to German)

soukac98 commented 5 months ago

this setting in the QGIS Lizmap plugin image

leads to the search field at the top right image (the terms have been changed to German)

It doesn't seem to work for me : I tried it before, using a precise address , It shows no data...

Gustry commented 5 months ago

@soukac98 And what does it return on osm.org website ? It's the same endpoint, nominatim.

Then you can do F12 in Lizmap Web Client to see returned data from https://nominatim.openstreetmap.org/ui/search.html website

soukac98 commented 5 months ago

@soukac98 And what does it return on osm.org website ? It's the same endpoint, nominatim.

Then you can do F12 in Lizmap Web Client to see returned data from https://nominatim.openstreetmap.org/ui/search.html website

this is what it returns : image

However, the address is recognizable on osm's website, if that's what you meant

Gustry commented 5 months ago

Please use F12 to open the developer toolbox in your webbrowser to see the request in the backend.

Lizmap Web Client is filtering the data according to your "allowed map extent" for your project etc (or visible extent) (can you pan on Paris ?)

soukac98 commented 5 months ago

Please use F12 to open the developer toolbox in your webbrowser to see the request in the backend.

Lizmap Web Client is filtering the data according to your "allowed map extent" for your project etc (or visible extent) (can you pan on Paris ?)

image

the only error i could catch up is the title of the refresh button next to my search bar..

Gustry commented 5 months ago

Then, you have a "Network" tab, you should see requests to the Nominatim server.

soukac98 commented 5 months ago

Then, you have a "Network" tab, you should see requests to the Nominatim server.

I did, but i am still lost on what the problem really is, I am not very familiar with it.. I saw a similar issue here on GItHub #1548 , still not working

Gustry commented 5 months ago
  1. Go in your network tab
  2. Empty it, with the trash icon
  3. Start typing in the search bar, press enter
  4. Check the nominatim request which has been sent, and you can see the result of the request. You can copy/paste the query
soukac98 commented 4 months ago
  1. Go in your network tab
  2. Empty it, with the trash icon
  3. Start typing in the search bar, press enter
  4. Check the nominatim request which has been sent, and you can see the result of the request. You can copy/paste the query

Hello again, i am now familiar with the console and the network tab, thanks to you :D so i added a new json script to media files, that adds a search bar, but it doesn't show any adress in my map : i added markers to the script but it either blocks the entire map loading or it doesn't seem to recognize the marker (undefined), here is my script , maybe you can point me into the right direction

nominatim.zip

Gustry commented 4 months ago

Sorry, I won't debug your script myself. Please follow the instruction in my previous message, there is already a native search tool with Nominatim, we would be nice to understand first why it doesn't fit your need. I know there is a some extent restriction for instance, when sending the nominatim request.

arno974 commented 4 months ago
  1. you do not need to create your own search bar as it is provided by default in Lizmap. My advice will be to pass some time reading the documentation instead of creating a custom js script
  2. I don't know where did you find this script but it is for Leaflet. Lizmap uses OpenLayers. It will not works.
MaxiReb commented 4 months ago

Hi, i have the same problem as soukac98 and to continue the discussion, in the network tab, the nominatim request that is returned by my project Lizmap is ok and gives a good answer (i changed the name of my domain but this request sends a json file) : https://mylizmap/osm/nominatim?repository=epfl2023v2&project=20240412_projet_lizmap&query=place%20du%20capitole%20toulouse&bbox=1.348681%2C43.545515%2C1.432578%2C43.606323

But in my project, i have only this which is display : image

For information, the search by address is working fine on others of my projects...

guenterw commented 4 months ago

I don't understand why the existing search with “Nominatim (OSM)” should not work. I have many different Lizmap versions in use and it works everywhere.

But I have an idea: Could it be that addresses are being searched that are outside the coordinate range defined for the QGIS server? In this case, the search doesn't actually work for me either, but I think that's ok.

In the example above, the search was for Paris but the section shows an area in Germany image

if the coordinate range is large enough, the address will be found by me: image https://cx21.webgis.biz/ Project Test (Background map OpenStreetMap, scale 1:2500)

arno974 commented 4 months ago

From my understanding Lizmap (see lizmap code) get the current project BBOX and search only inside this bounding box.

In the message @guenterw from we can see that this parameter is specified in the URL :

https://mylizmap/osm/nominatim?repository=epfl2023v2&project=20240412_projet_lizmap&query=place%20du%20capitole%20toulouse&bbox=1.348681%2C43.545515%2C1.432578%2C43.606323

MaxiReb commented 4 months ago

It was indeed the bbox of my QGIS project which was too restricted... It works now, thanks for your help !

soukac98 commented 4 months ago

It was indeed the bbox of my QGIS project which was too restricted... It works now, thanks for your help !

It was indeed the bbox of my QGIS project which was too restricted... It works now, thanks for your help !

I modified the extent of my curent project, but it still doesn't work. I also tried searching inside and outside the bbox , but the "no results" still persists. Maybe I am missing something?

Gustry commented 4 months ago

The tip about the project extent was mentioned earlier. It's indeed taken into account to determine if a result can be shown to the user.

Maybe I am missing something?

Please, as describe, use the "Network tab" of your web-browser, when you enter an OSM address, you will be able to see if you got at least one response from the server etc.

soukac98 commented 4 months ago

The tip about the project extent was mentioned earlier. It's indeed taken into account to determine if a result can be shown to the user.

Maybe I am missing something?

Please, as describe, use the "Network tab" of your web-browser, when you enter an OSM address, you will be able to see if you got at least one response from the server etc.

Yes, that is exactly what I verify, no response from the server

Gustry commented 4 months ago

Can you share the HTTP request and the response, as already described before https://github.com/3liz/lizmap-web-client/issues/4372#issuecomment-2084760880

soukac98 commented 4 months ago

image

Gustry commented 4 months ago

Please share your HTTP request parameters which has been sent, your HTTP code, the status of the request etc. There is something wrong indeed, but we won't be able to help you with a screenshot. For us, it seems Nominatim is working fine. You right click on the request, and copy as curl for instance

github-actions[bot] commented 3 months ago

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎