8

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.

  • I thinks he is talking about clipping a raster that is streamed from a WMS. Sextante tools will only clip local rasters. – Kapanther Dec 14 '12 at 0:48
2

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.

  • 1
    this does not work for WMS with QGIS 3.10 – sn1ks Dec 4 '19 at 8:50
1

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).

0

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

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.