I've got QGIS server (2.6) and QGIS web client working on a windows machine. Eventually I'll get it running on linux, but for now I need to get it working on my localhost, because I need to prove this system can work for a bigger rollout on another host.

I'm trying to get the map button that allows you to email a link working. When I click the link, I get the URL:


the map gui loads, but the map just sits there "loading". I'm pretty sure it's not working because the URL is being created with this path:


instead of


I'm assuming this URL is created by the GetUrlParams.js in my web client files. That script is here: GetUrlParams.js

Does anyone know how to edit this script to correct the location of the forward slash from before the C: to after the C:?

Update: inspecting the part suggested below, I checked what urlParams.map is giving me with an alert:

urlParams = Ext.urlDecode(urlArray[1]);
    if (norewrite) {
        if (urlParams.map == undefined) {
            urlParamsOK = false;
        } else {
            wmsURI = serverAndCGI + "?map=" + urlParams.map + "&";
            printURI = printServer + "?map=" + urlParams.map + "&";
            wmsMapName = urlParams.map;

and that correctly gives me what should be there:


But that's not what's being written to the URL when I press the email link:


So to me there's something else going on somewhere else when that email link is generated, but I don't understand where. Does anyone know if the email linking feature is built into Openlayers, or is this some sort of plugin? I've searched quite of few of the obvious places in the different javascript files for the Web Client and I can't find references to the email link - to try and narrow down where that URL is being generated.

2 Answers 2


I managed to find my answer and fix it. It turns out the permanent link to email in the QGIS Web Client button is done in the WebgisInit.js file of the Web Client. After line 1784, I found this:

else {
    permalink = urlArray[0] + "?map=";
    permalink = permalink + "/" + wmsMapName.replace("/", "");
    //add .qgs if it is missing
    if (!permalink.match(/\.qgs$/)) {
        permalink += ".qgs";
    permalink += "&";

and substituted the line:

permalink = permalink + "/" + wmsMapName.replace("/", "");


permalink = permalink + "" + wmsMapName;

And the email permanent link worked after that. Thanks for the suggestions though.

  • Excellent catch. I appreciated your Update section where you checked the urlParams array contents...good follow-through. Feb 26, 2015 at 0:07

The call on line 68 of your GetUrlParams.js sets the urlParams array to the returns from Ext.urlDecode(urlArray[1]). Within that urlDecode() subprogram is where the .map element is being assigned....it includes the slash that you want to reposition.

On line 74 of your GetUrlParams.js, the wmsURI is assigned by sandwiching the urlParams.map element between the serverandcgi variable and more syntax. You could 'patch' this result on line 74 by if-testing the first character of the urlParams.map element.

Bottom line: you want the variables to look like this:

 serverandcgi = http://localhost/web/site/qgiswebclient.html?
 urlParams.map = C:/OSGEO4W32/apache/htdocs/.....

using a test on urlParams.map you can re-assign the strings however you want them.

Be sure to comment your code, so when you move to Linux, you can repair it again...because of course you will have no C: drive then!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.