osm-search / nominatim-ui

Debug UI for Nominatim
GNU General Public License v2.0
83 stars 31 forks source link

Nominatim-UI config.theme.js not applying? #194

Closed cjba850 closed 2 years ago

cjba850 commented 2 years ago

I'm a newcomer to Nominatim (and notably, Nominatim-UI), but I'm having difficulty setting the theme config parameters for nominatim-ui.

Minor - It seems that there is a typo (missing closing ' in the config.theme.js.example), but that's not the problem here.

I am setting the parameters I wish in a config.theme.js in the theme/ directory and they are simply not being applied.

Nominatim_Config.Nominatim_API_Endpoint = 'http://192.168.1.2';
Nominatim_Config.Page_Title = 'Local Nominatim Server';
Nominatim_Config.Reverse_Only: true;
Nominatim_Config.Reverse_Default_Search_Zoom: 15;
Nominatim_Config.Map_Default_Lat: -33.85237;
Nominatim_Config.Map_Default_Lon: 151.21129;
Nominatim_Config.Map_Default_Zoom: 16;

Not sure where I'm going wrong here, but I have a working Nominatim instance (just as a standalone server, not /nominatim/ subfolder), so I want to set the UI to point to the root folder for API endpoint requests.

So: http://192.168.1.2/reverse.php?lat=-33.85237&lon=151.21129&zoom=18&format=jsonv2

Correctly gives result: {"place_id":1970389,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","osm_type":"way","osm_id":205149952,"lat":"-33.85214725","lon":"151.2107619962694","place_rank":30,"category":"man_made","type":"bridge","importance":0.4459485686094176,"addresstype":"man_made","name":"Sydney Harbour Bridge","display_name":"Sydney Harbour Bridge, Hickson Road, Dawes Point, Sydney, Council of the City of Sydney, New South Wales, 2000, Australia","address":{"man_made":"Sydney Harbour Bridge","road":"Hickson Road","suburb":"Dawes Point","city":"Sydney","municipality":"Council of the City of Sydney","state":"New South Wales","ISO3166-2-lvl4":"AU-NSW","postcode":"2000","country":"Australia","country_code":"au"},"boundingbox":["-33.8545548","-33.8500183","151.2090827","151.2122706"]}

However, even simple changes to the theme config like Default Latitude + Longitude, viewport, and Page titles aren't applied. It's as if the UI build isn't reading the theme file. Permissions are at 777, so there isn't an issue there either.

Nominatim-UI shows Error fetching data from http://localhost/nominatim/status.php?format=json (TypeError: Failed to fetch) which makes sense - since it's looking at http://localhost/nominatim/ which has no content.

Any thoughts as to what I'm missing?

Yep - also posted here for visibility: https://stackoverflow.com/questions/74148650/nominatim-ui-config-theme-js-not-applying

The setup:

lonvia commented 2 years ago

(I've fixed the syntax error in the example config.)

Your configuration file contains wrong syntax. Nominatim_Config.Reverse_Only: true; should be Nominatim_Config.Reverse_Only = true; etc. This might be the problem.

cjba850 commented 2 years ago

Yep - that was it. Thank you! @lonvia

Seems like if there is any error in the syntax, the whole file isn't read (so the missing quote ' in the sample file actually invalidated my initial attempts, then adding the default positions when trying that for debugging with the : compounded the problem.

I'd suggest the sample file should at least have that quote added in, so it is syntactically valid, and thus a copyable starting point for a newbie (like me). - minor issue, but if you aren't used to the finer specifics, easy to miss.

EDIT - realised you fixed that file for the defaults - thanks!