Maprunner / rg2

Updated user interface for Routegadget
MIT License
36 stars 19 forks source link

Error Getting Map List #471

Open cmorse01 opened 4 years ago

cmorse01 commented 4 years ago

I am trying to set up an RG2 instance on my local machine running Apache2 on PopOS! (Ubuntu). Running as localhost. Have things apparently up and running, but upon attempting to load a map and georeference it (set up EPSG:2032 - UTM18N - appears fine in locator map). I get an error message that "Map Request Failed: Error Getting Map List" I'm not really sure where to look to chase this down - I don't see any errors in console or apache logs. (Note: I've done some coding with PHP, but not much JS). The map and world file are successfully saved in /routegadget/ as kartat1.jpg and kartatworldfile_1.txt but I get no map options populating the drop down to create an event.

Probably a simple thing I'm overlooking - but can't find any error messages that give more clarity than what I've attached. Does the map file need to be initialized somehow? Thanks in advance..

Map List from 2020-07-13 16-30-00

Maprunner commented 4 years ago

Not quite sure what is going on. All files should be created in a kartat directory which in your case is probably routegadget/kartat. What are the settings in your rg2config.php file for RG_BASE_DIRECTORY and OVERRIDE_KARTAT_DIRECTORY (if it is set)?

You can try accessing the API directly in the browser. Just add /rg2/rg2api.php?type=maps to your base directory. e.g.:

http://localhost/rg2/rg2api.php?type=maps

This might give you a clue about what is happening. It is also worth looking at the network requests and responses in Dev Tools (F12). It is the XHR requests that you need to look at. If you log on as manager you should see calls to:

rg2/rg2api.php?type=events rg2/rg2api.php?type=login rg2/rg2api.php?type=maps

cmorse01 commented 4 years ago

define('RG_BASE_DIRECTORY', '/routegadget'); define('OVERRIDE_KARTAT_DIRECTORY', '/var/www/routegadget/kartat');

Tried commenting out the override directory (got same map list error) as well as '/routegadget/kartat' without the /var/www - but that throws the error that kartat directory not found.

I have noted since I originally posted that map files are indeed created - but they wind up in the routegadget directory, not the kartat subdirectory. But manually moving the files over to kartat hasn't helped. Also created in the routegadget directory is a file called kartatkartat.txt (not sure why kartat twice) that has an entry for my map file with georeferencing data in place. Moving this to kartat directory didn't help either.

I am getting a 500 Server Error when the error message pops up. See attached screenshot.

I'm sure its something ludicrously simple that I'm just overlooking. Thanks for taking the time to assist..

Screenshot from 2020-07-15 14-16-02

Maprunner commented 4 years ago

I think it is somehow related to the two DIRECTORY definitions. Getting things to work locally can be a bit problematic depending on the exact environment. I use XAMPP on Windows which needs "//localhost" rather than "/var/www".

I'd suggest deleting all the data files and starting again with no override directory defined. That should create data files in the routegadget/kartat directory by default.

If that doesn't work then trying adding a slash to the end of the kartat override so it ends "kartat/".

And if that doesn't work then try using a relative path for the override (although that would end up as "./kartat/" which should be what it defaults to.

cmorse01 commented 4 years ago

Deleting data files and starting again does result in the maps going into the kartat directory properly. However, none of the directory definition permutations I tried have cleared the error.

I am getting a Fatal PHP error in my apache logs however: PHP Fatal error: Uncaught Error: Call to undefined function mb_convert_encoding() in /var/www/routegadget/rg2/app/utils.php:181\nStack trace:\n#0 /var/www/routegadget/rg2/app/map.php(13): utils::encode_rg_input()

But that function is in the PHP manual so I presumed it is a built-in function - I'm running PHP 7.4.3. Maybe its in a module I don't have loaded?

I disabled the encoding step and added a workaround (map.php line 13/14) and the map now appears to load and I can pull it up in the event tab. But I'm sure that encoding step is there for a reason, so I'm a little remiss to just leave it like that.

{edit} looks like the encoding function is in the mbstring module which is a non-default module of PHP. I'll mess around with reinstalling PHP with that enabled later...

Screenshot from 2020-07-15 16-43-28