TransWikia.com

Extract portion of WMS raster layer

Geographic Information Systems Asked by earthstephen on June 6, 2021

Using QGIS on Windows XP based desktop.
I am trying to use USDA orthophoto data from this WMS server:
“http://raster.nationalmap.gov/arcgis/services/Orthoimagery/USGS_EDC_Ortho_NAIP/ImageServer/WMSServer”

I can get the layer into QGIS with no problem but the only layer on the WMS server is of the entire United States. I want to extract from that the area I am interested in (a city). I have a vector layer of that city to use as a clip coverage but GDAL can only clip from a local raster layer. I have probably left out some pertinent information so please just ask if you need more information.

3 Answers

Most of the GIS desktop apps can do this kind of operation. In the "old" geoprocessing library "Sextante"* you can clip a raster with a vector layer with the algorithm called Crop Grid With Polygon Layer.

In QGIS processing framework you can use the GDAL provided algorithm "Clip raster by mask layer"

enter image description here

*As 05/2018 lot has changed since this post was written. In their first version sextante were working with gvSIG and begins to work with QGIS. Now sextante itself lost its name both in QGIS and gvSIG. It's fully integrated into QGIS and renamed as QGIS processing framework. In gvSIG is known as gvSIG Toolbox.

Answered by Francisco Puga on June 6, 2021

You can't clip, edit or save streamed layers from WMS-Servers. What you need is a WFS-Connection to your Orthophotos, where you can temporarily cache data.

The other alternative would be (if you have only one area of interest) that you make a screenshot from QGIS and save your WMS-Ortho Map as png. After that you just have to digitalize your screenshot (search for tutorials on this site and the net).

Answered by Curlew on June 6, 2021

This should work with PYQGIS

wmsLayer_name = 'landsat'
url_with_params = 'url=http://irs.gis-lab.info/layers=landsat&styles=&format=image/jpeg&crs=EPSG:4326'
wmsLayer = QgsRasterLayer(url_with_params,wmsLayer_name,'wms')
clipBbox = QgsRectangle(-102.33797581141405431,21.7442917848168058,-101.99476739437655226,22.00576212354055627)
wmsLayer.setExtent(clipBbox)
QgsProject.instance().addMapLayer(wmsLayer)

And then you could save local (.tiff,.pgk,etc) with QgsRasterFileWriter

Answered by Angel Rene Herrera Calzada on June 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP