After testing original QGIS Web Client I (QWC) about good year ago, We quickly start to think what on our opinion and experiences is missing or should be different. But we liked the whole project and idea of QGIS Extending some general classes of GeoExt and WMS standard. One drawback could be that QWC is running on old versions of external librariers, but upgrading here it’s not easy task, basically means starting from scratch and migrating certain parts, but that’s a different story. I only update OpenLayers 2.13 to newer version from GitHub and ExtJS 3.4.0 to 3.4.1.1.
So I started searching for various solutions and then integrating them into new client.
Jump directly to the client or read more below.
Server side
1. Database
I set up PostgreSQL database with following relevant tables:
- projects (every qgis project has own record with settings for overview layer, base or external WMS layers)
- users (name, email, password hash and list of projects that user is allowed to use)
- layers (layer settings for using as overview, base or external layers)
2. Additional project settings
I moved all of project related settings from inside the code (search panel, themeswitcher and new settings for layer filtering and geonames search) into separate json file, which should exist beside project qgs file.
eu_demo.json – project settings for our hosted example
3. User authentication
We needed to have QWC and QGIS project data accessed for specific users only. When user is succesfully logged in, all necessary data is stored into PHP session variables and browser is redirected to QWC which initially reads those session variables and stores them into js variables. If there is no session, login window shows up.
It is also possible to enable public access on project (Guest login).
3a. QGIS Server proxy
Latest adition (September 2015) is a proxy PHP script for all requests to QGIS Server. This script serves 2 reasons:
- Caching requests which are static as long as QGIS project (and data) stays the same. This requests are: GetProjectSettings, GetLegendGraphics and GetFeatureInfo when it is used with empty filter (get atributes for all features).
- Calling QGIS Server only for requests from users that are logged in.
So this feature means higher performance and better security. Users have manual control to see and delete cache content if it is changed.
Client (user interface)
4. Layer context menu
Each vector layer from QGIS project has context menu with following options:
- Zoom to layer extent
- Open attribute table
- Export layer to…
- Currently supported formats are SHP, DXF and CSV
- Option for exporting just current bounding box
Displaying attribute table is done using WMS GetFeatureInfo request, the same as when searching on layer with QGIS.SearchPanel. Only filter string is empty in this case.
Of course, this is a problem with large data. So first thing: I switched off Adding geometry to feature response in QGIS Projects properties to significantly reduce returned XML size. It’ s too bad that means for the whole project and not just specific layer.
Another thing is setting feature count limit, which means that you cannot receive all results in case of layers with number of features over your limit. This could be done with adding bounding box to GetFeatureInfo filter, but I think QGIS Server currently doesn’t support that (I read that Geoserver has this option). In this case, you could open attributes for currently visible features on the map, which would be very cool for my opinion.
5. Geolocation button
Simple button for showing your current location with accuracy information. Another click removes marker.
6. Google StreetView integration
With Google StreetView mode enabled, click on the map displays StreetView panel. Marker on the map is syncronising when you rotate view or move positon in StreetView.
7. Layer tree
Legend for visible layers is displayed in layer tree (taken from Customization scripts). Removed button “i” icon for displaying legend and layer properties since this can be added to context menu and legend is already displayed.
8. Minor consolidations
Stuff below is based upon subjective opinion.
- use ExtJS blue theme (just to differ from original QWC)
- GeoExt popup instead of OpenLayers window. This fit’s more into ExtJS application look and feel.
- Buttons and icons (some new, some changed, some removed)
- Layer ordering removed. In general this is cool option, but has to be done with simple drag&drop (which is possible with GeoEXt). Solution here was for my opinion too much for clean and simple user interface.
- Set default Object identification mode to “All layers” since I think this is generally what user expects. I also hide selection for other identification modes.
Try it out
On our GIS Clients page there is a link to demo project with login info.
Credits
Certain parts were done using or helping with code from other users:
This a great news that you’re implementing some interesting changes. I like these changes:
1. Legend symbols are shown by default, instead of having to click the “i” button. This is great.
2. I don’t like and don’t use the old Theme Switcher. This meant my only customization was with changes in GlobalOption.js – I could not figure out how to create custom project settings. It hasn’t bothered me so far. Does the new separate json project file mean I can set project settings without changing any other parameters in GlobalOptions.js or elsewhere?
3. I like the new login option ! That’s perfect, something we need.
4. I like the layer context menu ! I agree, seeing attribute table results from the currently visible view would be good.
5. Geolocate button is nice, but what I really need as far as buttons is a WFS-T button or buttons, to allow the user to draw on the map, and save or export that shapefile. This is the most asked for feature by my users. I don’t know how to implement this type of drawing ( http://demo.3liz.com/wfst/wfs-transaction-polygon.html ) with points, lines and polygons. I really wish I could do this. Is it possible to add buttons to the current QWC do do this? If so, how would I accomplish this?
6. Street view integration. Great !
7. Can themes be changed to any of several choices?
8. I agree, I didn’t like or need layer ordering.
Great work. Thank you. Now I have to figure out how to implement your changes…
thanks, really nice to read such respond. I agree on you, that editing functionality should be main focus on further development. OpenLayers have this and as you wrote it is implemented in LizMap, so it is possible. If you wish to implement all of current changes I will have to prepare some instructions and support because it is not out of the box package (at least at this moment). I will contact you directly on this shortly.
If you mean other background layers in point 7, yes you can easily add definitions to table of external layers and then specify for your project which layers to use. But for this you are working directly with database (pgAdmin), for now there si no administration page, yet.
regards,
Uros
Actually, for item 7, I meant the Extjs blue theme for the whole interface – in the old one it was grey but professional looking, and in the one you made, it’s blue, which is nice also. I was wondering if it’s possible to have a range of theme colors, or if it’s difficult to allow me to experiment with different colors or pre-made themes. It’s not critical, but choosing a base color would allow me to make the map seem more similar to the rest of my website’s colors.
Thank you, you’ve done some great work !
-Jan, Wellington, New Zealand
Aha, themes. Well you could switch back to grey of course. Blue theme is also part of ExtJs 3 original themes, there is another dark theme, you can check it out here http://cpansearch.perl.org/src/VANSTYN/Alien-Web-ExtJS-V3-3.4.11/share/examples/themes/index.html (change it in upper right corner)
Own themes are possible too, but that’s some extra work.
Hi Jan,
I have a working version of item 5 at the moment. Unfortunately Im still running it locally, so cant send you a link for a demo. Basically, the drawn features are converted to KML string using openlayers, then make an ajax call to php script with KML string and output as DXF/Shapefile using OGR. Let me know if youre interested and I can send you some snippets.
Hi,
I think right approach is to create WFS editable layer and store drawn features and attributes to postgis table and then exporting is just one of the options whenever user wants it. I invite you to Github repository where we can discuss further details and test code.
Hi Uros,
Thank you for your great work. Unfortunately I’ve lost my job because there isn’t enough work for me to do, and so I won’t be able to develop with your wonderful updates with QGIS web client. Hopefully I can find other job which I could make use of it. I will definitely be in contact again if I’m able to do so.
Thank you again !
-Jan
Hi,
I really wish you all the best in searching new job. Hope to hear from you soon, regards
Uros
Hi Uros,
thank you for the great work you are doing! It seems like a really good extension to QWC.
In trying to follow the procedure thou, I get an error while executing the SQL query located in /var/www/html/gisapp/_scripts/001_setup.sql . The error is the following:
ERROR: role “pguser” does not exist
********** Error **********
ERROR: role “pguser” does not exist
SQL state: 42704
This only happens while executing the query on the new database I created (owned by Admin, a new role), while it doesn’t happen if I try to execute it on postgres default database (where the simple SELECT test you mentioned works well).
Any idea on how to make it work?
Keep up the good work!
All the bests,
Marco
Marco,
I removed all dependency to pguser from script, so now it should be OK if you are running it with different user. Take new version from GitHub. You should have separate database and connect to that database and then run setup script. I will continue to add documentation to GitHub repo, later today.
thanks
Thank you very much, it works great now.
Is it possible to make it work with a database previously created and already online on QWC?
I followed the instructions but it gives me a not found error while trying to visit the page on localhost. In the settings.php file I specified the db name on which the QWC project is based; the db user and password of the database owner; the project path of the .qgs project located in the QWC project folder along with other projects.
Do you know why it is not working properly?
Thanks a lot,
Marco
Hi,
Thank you for the great job! You are implementing really interesting things.
I have tried it up to the end of the setup you provided on github, everything works great and at the end I receive the “user doesn’t exist” error message.
Now my question is about how to continue the process converting a QWC .project connected to a PostgreSQL database to the extended version you provided. How can I do that? Thanks.
Regards,
Andrea
Just post another chapter here – https://github.com/uprel/gisapp/wiki/3.-Managing-Database
glad you find it interesting, regards
uros
Added information about Guest access, which is now possible.
After extensive reading and exploring, I’m happy to post new feature (3a) QGIS Server proxy. This part is really important, currently I released v1.0.0. beta, I still need to test it and work on couple of issues. Latest info and instructions on this I will prepare on GitHub shortly.
Hi,
You’ve done an incredible job. Is there any instruction how to implement editing functionality for features?
Thanks!
Hi,
Thanks, editing is really on top of the TODO list, currently I’m busy with other things. Project is OpenSource so anyone can help with this. So there is no instructions, we just need to integrate it into user interface, since we know that Server side and OpenLayers library supports this. I was looking to use this – https://github.com/geops/ole.
Hi, you are doing a great job with the updates! Thanks a lot!
I have a simple question.. I am trying to add a URL link to the logo image, but it seems like I am doing something wrong.. I added a local adress (the aim is to see a pdf file) in the var headerLogoLink in the LoadAppProjectData.js file.
Any advices?
Thanks a lot and keep up the good work!
Andrea
Hi,
Yes, link wasn’t working so I made a quick fix (v 1.0.3) and now it should. After update, just hit F5 to reload page (some static files might get stuck in cache)
It works perfectly now, thanks a lot for the update!
One more thing, I noticed that the map is not referred to the advertised extent limit I specify in the OWS server of the qgis project but it sometimes changes… Should I specify somewhere the EPSG I’m using or something? I’m working on 32632.
Thank you,
Andrea
Hi,
I’m glad it’s working. About map extent, yes that’s related to EPSG, I Will have to check this, probably in couple of days. Currently EPSG is hardcoded in LoadAppProjectData.js to 3857. You can try edit this value, but this certainly needs fix to read EPSG code from project (keep in mind that Open Layer map CRS is defined with Base Layer).
Just published new fix so that project CRS is read from qgis file, so you don’t set EPSG code in LoadProjectData. Also map EPSG code is displayed by coordinates. Look for more info at GitHub repo – https://github.com/uprel/gisapp.
Also:
– If you are changing something inside qgis project, always clear your cache – http://localhost/gisapp/admin/cache.php
– Map CRS is defined upon base layers, so you must set up corresponding EPSG in QGIS project properties
– And when you set up CRS then set up map extent also in project properties
– Check that for your project CRS exists EPSG js file in /var/www/html/gisapp/client/site/libs/proj4js/defs
If you still have problems contact me directly on email or preferred open an issue on GitHub.
regards,
Uros
Hi,
My name is Felipe, l am from brazil and starting to use QGIS Web Client.
I am having problems to use label in the project. Every time when I use label appear a BIG POINT
Can you help me?
Hi Uros,
Thanks a lot for this great Qgis Web Client, is there still possibilty that you implement editing functionality for features?
Thanks!
Hi,
It would be possible with additional work of course. I’ll send more information by email.
Hello. I have a problem with using OpenLayers in my EPSG:2180 but I think it’s because I’m still not familiar with OpenLayers. Can someone tell me how to change parameters of layers to use them in EPSG:2180 and how to use WMTS layers as background?
Second thing is that when I create print composer with any ‘text label’ item and use it with QWC printing is not possible. When I throw away ‘text label’ printing is possible. I want to write some info on my map, how can I do it?
Thenks for the great client!
Hi,
I think we solved that by email,right?. In general you can use any coordinate system, follow this short guide – https://github.com/uprel/gisapp/wiki/5.-Project-configuration#project-crs
Hi Uros,
Thank you for this job.
My question is about the integration of Google StreetView.
I see in this page: “https://developers.google.com/maps/pricing-and-plans/#details” that we can use this functionality 25,000/days for free.
Do you know another API that includes this functionality for unlimited access ?
Than you.
Hi,
Google StreetView is quite unique, I do not know of any such service available almost globally.
hi Uros,
i configured following your wiki , no problem with desktop interface but mobile one doesn’t work , i see a black page with only side menu , i have to do something else? there is another wiki to do this?
Hello, my name is Pablo, I am new to qgis web, I found very interesting user management and options for desktop web and mobile web. But with my little knowledge I could not use level2 qgisweb. Would you like to set up a step by step video tutorial on youtube, how to install, how to perform the login integration with the database how to use the admin part? I’ll be very thankfull.
I’m Brazilian, I apologize for my English right now.
Hi,
When you start working with Ext. QGIS Web client you should have some background in Linux servers, database management and PHP. This project also lacks some administration web interface. Current documentation is available at GitHub Wiki here – https://github.com/uprel/gisapp/wiki. I know it would be really good to have video tutorials, but at the moment I can not afford to work so many hours for a free project. I can offer some commercial support if you are interested.
best regards,
Uroš
Hi Uros,
thanks for your great work at this extension. I alreadz got the example hello world to run. Works fine! But i have one question, how can i implement my own qgis project and not the example. Is there a Documentation for this.
Appreciate your work man, keep it up .
Best regards
Look here – https://github.com/uprel/gisapp/wiki Managing Database and Project Configuration.
best regards,
Uroš
Thank You, now i can display my project. Is There a way to display layer from a MySQL Database?
Best regards
Can’t say about MySQL, but if you are a GIS user then best database to work is PostgreSQL with PostGIS, so that is supported. You just need to make sure when you move project to the server that server contains all necessary layer sources and connections to databases.
Hey, gerat project and already working for me. Now i have two questions. Is there a way to change the header level2 Spatial info. system – DEMO in some header i choose. And how can i enable the print function in my qgis projekt?
Best regards and great work!
Alex
Hi, thanks.
1. Logo is related to table clients in your gisapp database. If you have “demo” client as alias it will look for demo.png /gisapp/admin/resources/
2. To enable print you have to add print templates in QGIS project. That will print only contents of QGIS project, so no baselayers. That’s an open issue for now.
best regards,
Uroš
[…] been a while since this post, so I decided to write some update about current status and future of this […]
Hi,
I configured the original QWC and now I want to use the Extended QGIS-Web-Client but I could not install it successfully. Is there a procedure for successful setup?
Thanks.
Did you see Wki pages here – https://github.com/uprel/gisapp/wiki
Thanks!
I noticed a configuration error in my Apache. Now I just have one more problem. I get an error by clicking the “Guest” button for the first time on the login screen. I get a “Unable to login” error message and I can only enter the application by clicking the button a second time. What could it be?
Great job.I can open the project but the map was not loaded I used WMS as basemap but it seems that QWC supported WMTS and really I do not know how to create WMTS and configure it in qgis.
regards
So only WMTS layer is problem? You have two options: 1. Include directly in QGIS and 2. add it as base layer. For number 2 you can contact me on email with details and I Will try to help.
regards,
Uroš
Hello Uroš, I work in the Geomatics department of an engineering company in Switzerland. We are using QWC version1 on an Ubuntu operating system and we would like to use WMTS as a base layer. With your second option (‘add it as base layer’), is it possible to send us some instructions on how we should proceed? Thanks and Regards Daniel
hi,
My recommendation is that you try moving to EQWC and then you will be able to add definitions for external layers to database and use them in your projects in web/mobile client.
Great Job. Great Wiki
I am realy interested on your editor plugin,
is it working on mobile too ?, is it per user enabel ?
on my system the Map Layer Toogle on is not working also printing with label´s
Hi,
Thanks for your interest. Editor works for now only in web client (OL2). Mobile is done with OL3, so it is different client. It could be possible to prepare also that part, what is most important in editing with mobile for you? Users who have permission to use certain project can also edit data. But you control completely what layers and which operations (inser, modify, delete)
About your problems you can contact me on email with some more description.
best regards,
Uroš