Qgis-server...Bringing a map image into the browser on Ubuntu 16.04 LTS
http://www.paulshapley.com/2016/07/how-to-install-qgis-server-on-ubuntu.html
NO?...here are some issues to check back in the QGIS project file before we move on.
- Check the 'Project Properties' under the 'Project' menu, go to the 'OWS server' tab. Below is an example of of how I've set up mine.
and here is the bottom bit you cannot see in the above image...
Ensure under 'Save Paths' in the 'General' Tab it is set to 'relative'. Note that the layers you are going to select for the WMS service are ticked under 'Published' in the WFS capabilities table. |
Moving on to setting up your 'Add layer(s) from WM(T)S Server' button on the 'Manage Layers Toolbar'
Since we are using one layer from a PostGIS database open you 'Project.qgs' file (in Gedit or similar text editor and ensure you add your PostGIS connection details similar to below under <datasource>. I understand you can leave out the password as it is already stored in the 'pgpass.conf' file. I've left this in for demo purposes.
amend the <datasource> line to reflect your PostGIS database connection details. |
When your done...check again using the same URL as before:
http://localhost/cgi-bin/project/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
If ever you need to share your WMS Service with another QGIS user you can use the url (below) and you will get a list of all the layers from that project.
http://127.0.0.1/cgi-bin/projects/my_project/qgis_mapserv.fcgi?SERVICE=WFS&REQUEST=GetCapabilities
How do we display a map image from our QGIS Desktop project file?
Before we do go back in your QGIS project check you can add your newly created WMS layers back into QGIS as with any other WMS from a different source.
When you hit the 'connect' button you should see a list of layers you created earlier, if not go back and check from the beginning of this post. |
Select a layer and click 'Add' and the layer(s) should appear in your layer panel as normal qgis layers.
Lastly, r/c on your largest area wms layer and go to 'Properties' and make a note of the bounding box co-ordinates.
The layer extent is from left to right 262377,179121,297597,215872 |
We can now use these co-ordinates in the 'GetMap' part in the url:-
http://localhost/cgi-bin/project/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&SRS=EPSG:27700&REQUEST=GetMap&map=/usr/lib/cgi-bin/project/southuk.qgs&BBOX=262377,179121,297597,2158721&WIDTH=550&HEIGHT=500&LAYERS=coast_polyline,b_road_polyline&STYLES=,,&FORMAT=image/png
http://localhost/cgi-bin/project/qgis_mapserv.fcgi? this part of the url locates the qgis-server executable on the apache2 host server.
SERVICE=WMS&VERSION=1.3.0&SRS=EPSG:27700& this part calls the WMS service, it's version and the target spatial reference system.
REQUEST=GetMap&map=/usr/lib/cgi-bin/project/southuk.qgs& this part is the request to get the 'map' from the qgis project file.
BBOX=262377,179121,297597,2158721&WIDTH=550&HEIGHT=500& this part sets the size of the retrieved image boundary and the 'WIDTH' and 'HEIGHT' of the image area in the browser.
LAYERS=coast_polyline,b_road_polyline&STYLES=,,&FORMAT=image/png the final part is the description and display of the layers of the WMS. Note there is no 'STYLES' specified because it in specified the .qgs file. Finally, the output format is a png image.
The final output is a png image in the browser window. |
and a closer look shows it is identical to the qgis project. |
We could also add many more parameters and requests into the url in order to enhance the visual appearance for example.
REQUEST=GetFeatureInfo...this request retrieves the underlying attributes and geometry values and pixel location.
GetLegendGraphic...this looks for the view legend information.
bgcolor...sets the background map colour.
Hi Paul, Thanks for this tutorial.
ReplyDeleteNice work. Thanks!
ReplyDeleteChuyên vé máy bay Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ bao nhiêu
ve may bay my ve vietnam
vé máy bay giá rẻ từ Canada về Việt Nam
mua ve may bay tu han quoc ve viet nam
"It’s the ideal a chance to make a number of plans for the longer term and it’s time for you to be at liberty. We have learn this publish of course, if I could..I wish to counsel you few interesting issues or advice. Perhaps you can write next articles regarding this short article.
ReplyDeleteI wish to read more things approximately it!"
��야동 ��
"What’s up, ☑오피☑ of course this piece of writing is truly good and I have learned lot of things from it about blogging. thanks."
ReplyDelete"It’s amazing ↘마사지↙, your posts are really impressive, I hope to see more of this wonderful article from you"
ReplyDeleteWhat an excellent you are. Your presentation was so good. 💥건전마사지💥
ReplyDeleteSmm Panel
ReplyDeleteSMM PANEL
iş ilanları
instagram takipçi satın al
hirdavatciburada.com
Https://www.beyazesyateknikservisi.com.tr/
servis
tiktok jeton hilesi
kadıköy daikin klima servisi
ReplyDeletependik toshiba klima servisi
tuzla daikin klima servisi
kadıköy lg klima servisi
beykoz alarko carrier klima servisi
üsküdar alarko carrier klima servisi
tuzla arçelik klima servisi
çekmeköy samsung klima servisi
ataşehir samsung klima servisi