1

One of the ways to get data from ArcGIS REST API in image format is this.

https://services.twdb.texas.gov/arcgis/rest/services/Base/BaseLayerQueryService/MapServer/export?bbox=-11360770.018835%2C3942451.651995%2C-11357251.989618%2C3945703.856100&bboxSR=&layers=show%3A8&layerDefs=&size=847%2C783&imageSR=&format=png&transparent=true&dpi=&time=&layerTimeOptions=&dynamicLayers=&gdbVersion=&mapScale=&rotation=&datumTransformations=&layerParameterValues=&mapRangeValues=&layerRangeValues=&f=json

The return is a JSON like this

{
 "href": "https://services.twdb.texas.gov/arcgis/rest/directories/arcgisoutput/Base/BaseLayerQueryService_MapServer/_ags_mape38a2c53b769401a86d7d8f1751fc8a2.png",
 "width": 847,
 "height": 783,
 "extent": {
  "xmin": -11360770.018835019,
  "ymin": 3942451.651995,
  "xmax": -11357251.989617988,
  "ymax": 3945703.8561,
  "spatialReference": {
   "wkid": 102100,
   "latestWkid": 3857
  }
 },
 "scale": 15698.301990971015
}

Is there a way to load this in QGIS?

1
  • This is useful, but I want to provide this as a file to other people so that they can load it in any GIS software. I wonder if this is at all possible. ArcGIS API doesn't support GeoTIFF format or else it won't be an issue. Apr 29 at 21:57
2

I did check the documentation of Arcgis api to export map here (if it can help to find other solution). I have seen you can choose to get different file format including kmz wich would be easily integrated in QGIS.

I have modified the f parameter to get kmz and erased the parameter that have no values set to be easier to read (it will act the same, using the default value).

https://services.twdb.texas.gov/arcgis/rest/services/Base/BaseLayerQueryService/MapServer/export?bbox=-11360770.018835%2C3942451.651995%2C-11357251.989618%2C3945703.856100&layers=show%3A8&layerDefs=&size=847%2C783&format=png&transparent=true&f=kmz

It will download a kmz file with a field icon that contain the link to the png. Open the kmz layer in QGIS and in the sympology choose Raster Image Fill (image 1) and then select the path to the image to be the icon field.

1 : image 1

2 : image 2

Note : if you have many kmz to download you can make a modeler that will download each KMZ based on a layer and a formula to set the url dynamically.

2
  • That's awesome. I tried KMZ format but didn't know about setting the raster image as fill. Apr 30 at 21:53
  • I think you have to check the rendering option where the map is not empty to be sure there is no croping or weird image transformation. May 1 at 11:06

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.