14

The USDA (via the National Map) provides 4-band NAIP ArcGIS "ImageServer" (services) for most states in the US. I am able to successfully connect to the WMS service in QGIS as described here, which loads the imagery into QGIS using the default RGB (1,2,3) bands.

However, I'd like to change the imagery to display the CIR (bands 4,1,2). On the "Style" tab, the Render Type only offers the "Singleband color data" option, not the "Multiband color" option described in step 3.5 for typical rasters here. This appears to be a limitation of the WMS Service.

You can do this from the same service in ArcGIS Desktop using the REST endpoint. An ArcGIS Online webmap example of changing the bands of a service is available using the REST endpoint. Just go to the "..." on the layer, choose "Image Display" and then "User Defined Renderer".

UPDATE:

I've been playing around with the Developer Tools in Chrome and the ArcGIS.com map sample from here, and think I've found a small nugget of info. After I changed the image display settings, I noticed some query parameters set as:

https://gis.apfo.usda.gov/arcgis/rest/services/NAIP/Montana_2015_1m/ImageServer/exportImage?f=image&bandIds=3,0,1&bbox=...

After I changed the band ID's again, I realized that the bandID's in this query parameter are zero-based, instead of 1-based. Therefore &bandIds=3,0,1 are really referring to bands 4,1,2 used to display imagery in CIR format. So I just need to figure out how to configure the query string for QGIS to accept this parameter. Any thoughts?

  • 1
    The instructions you point to talk about downloading the data, rather than accessing the data from a WMS (I know that that means an image is downloaded but...) With a WMS you are getting a pre-rendered image, generally you change the returned image style by supplying your own style as part of an SLD+WMS GetMap, request, but I'm not sure if you can change band order (or which bands) with SLD. Instead you'll need to download the multiband tiff, and apply the changes locally. What you would really want is the images supplied as a WCS... – nmtoken Mar 13 '17 at 16:56
  • Thanks for the input. I know the instructions I pointed to are for working with local data, but I can do what I am after in ArcGIS Desktop using the same image service. This is what I want to replicate in QGIS. I've added an example of changing the bands via the same web service using an ArcGIS.com web map, for clarity sake. – RyanDalton Mar 13 '17 at 17:51
  • Are you using a WMS with ArcGIS or the rest/ soap/ image service? – nmtoken Mar 13 '17 at 17:59
  • @nmtoken, Ah! I see what you are saying. I was using the Imagery service described in the USDA instructions at fsa.usda.gov/Assets/USDA-FSA-Public/usdafiles/APFO/…. I'm thinking that method uses the REST API. When I tried adding the layer as a WMS service, I got the same result as in QGIS. – RyanDalton Mar 13 '17 at 19:35
  • It might be possible through the GDAL ArcGIS REST minidriver gdal.org/frmt_ags_arcgisonline.xml and gdal.org/frmt_wms.html but examples do not cover your RGB / NIR case. – user30184 Mar 22 '17 at 22:06
0

OGC compliant WMS services are images. If a image service is published 4 band the WMS version can only be RGB not RGBI. At this time, QGIS can't load an ESRI Image service (there is no ESRI Image Service plugin).

The image service itself can be change to infrared by going using ArcMap, or Arc Pro. Right click the layer in the table of contents, then go to properties, then go to symboloy, and then change the top band "Red" to Band_4, second band "Green" to Band_2, and then third band "Blue" to Band_1.

There is a QGIS python route but I've have not got it to work I'm using 3.2). I get a GDAL certificate error when I run it. But not sure if it's my local install plus our firewall, or an true GDAL error.

In QGIS under Plugins there is a python console (if you don't have this then you'll need to install it). Copy and paste what I have below in to the python console (it's an example using NAIP Alabama.)

qgis.utils.iface.addRasterLayer("https://gis.apfo.usda.gov/arcgis/rest/services/NAIP/Alabama/ImageServer?f=json&pretty=true","raster")

Note: The url loads outside of QGIS - https://gis.apfo.usda.gov/arcgis/rest/services/NAIP/Alabama/ImageServer?f=json&pretty=true

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.