2

Have been using the usual code in python console to use the world imagery layer as a base map and have been pretty happy with this, from IEQGIS page

qgis.utils.iface.addRasterLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json&pretty+true","raster")

However, just stopped working...error msg below

It has been superseded by a plugin but can't find a way of getting this to work either. Any ideas why this does not work or which URL to put in the REST API?

Error message: Invalid Layer    GDAL provider: Cannot open GDAL dataset http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json&pretty+true: Invalid dataset dimensions : -2147483648 x -2147483648
Raster layer: Provider is not valid (provider: gdal, URI: http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json&pretty+true

Another more recent error:

GDAL provider: Cannot open GDAL dataset server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json: `server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json' does not exist in the file system, and is not recognised as a supported dataset name. 
Raster layer: Provider is not valid (provider: gdal, URI: server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json
  • 1
    Please post error messages as text, not as a screenshot. If you had, you might have noticed the extra characters between "ser" and "vices" – Vince Nov 4 '15 at 16:22
  • That was not the issue but will do as suggested in future – SNA user1969 Nov 4 '15 at 16:59
  • 1
    Please do as @Vince has suggested for this question by using the edit button beneath your question. – PolyGeo Nov 4 '15 at 19:36
  • I have the exact same experience as SNAuser1969, namely that for the past several months I have been successfully adding high resolution (up to 1:1300 scale) arcgis world imagery as my base map using the exact same URL as published here ieqgis.wordpress.com/2014/08/09/… but quite suddenly this has stopped working and I’m getting the exact same error message as SNA ser1969. Since nothing has changed my end clearly something has changed at the server end. I’ve tried all the URLs in this thread to no avail. I’m on QGIS 2.12 win 7 64 bit. I – goatwillow Nov 5 '15 at 13:29
  • From downloads2.esri.com/ArcGISOnline/docs/tou_summary.pdf. "Use with Esri software, and comply with its terms of use. If you do not have Esri software, you must purchase an ArcGIS Online subscription". Is it possible that ESRI have added some server side code to validate client connection? It would be a shame if they enforce this clause. – Mac Maclean Nov 6 '15 at 1:46
2

I found a solution to our problem guys... SNA user1969 - I'm also based in Ireland :)

Everybody who needs high quality maps in qgis should install OpenLayers Plugin. To do this navigate to Main Menu >> Plugins >> Manage and Install Plugins

Click ALL, search for : OpenLayers, select it, install it...

Now click :

Main Menu >> Web >> Open Layers Plugin >> Bing Maps >> Bing Aerial/Bing Aerial with labels

Now you will see BETTER quality aerial images!

  • I do use the web plugins as back ups for the background layer but they have a major issue when you want to export to PDF via Print Composer. Also with the ESRI Raster layer, it has editable properties, whereas there is no properties dialog for Bing/Google OpenLayers plugins. Good to share though. – SNA user1969 Nov 6 '15 at 17:07
1

I don't know anything about QGIS but you are getting the map service back as pretty JSON as per your url. Try removing everything starting at the question mark:

qgis.utils.iface.addRasterLayer("http://server.arcgisonline.com/ArcGIS/rest/ser‌​vices/World_Imagery/MapServer","raster")

I cannot test this, but I would think that removing the query string would do the trick.

  • Ok. Tried that now and previously and get the same resulting Invalid Layer error as above – SNA user1969 Nov 4 '15 at 14:52
  • I just tried to open the link and that url wasn't valid. This is what you should be using http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer. I would try it like that first and if that doesn't work add your query string that was in the original post ("?f=json&pretty=true"). And I think you can actually just use f=pjson to get pretty json. – crmackey Nov 4 '15 at 14:56
  • Your suggestion produces the same result - I tried MapServer/1?f=json but just crashes QGIS – SNA user1969 Nov 4 '15 at 15:17
  • This raster is crucial as a basemap for me - wonder if anyone can suggest how the REST API works instead? – SNA user1969 Nov 4 '15 at 15:47
  • @SNA_user1969 The service is working fine. You have extraneous characters in your URL. – Vince Nov 4 '15 at 16:58
1

I was using the "World Imagery" and I'm having the same problem. For now I'm using this:

qgis.utils.iface.addRasterLayer("http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=json&pretty=true","raster"). 

Does this help you?

1

Putting this here for ease as it took me a while to figure out the exact xlm file since I don't do this that often. Just open your favorite text/xml editor and paste this. Then drag to your layers and you are set! Let me know if it doesn't work.

<GDAL_WMS>
  <Service name="TMS">
    <ServerUrl>http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer/tile/${z}/${y}/${x}</ServerUrl>
  </Service>
  <DataWindow>
    <UpperLeftX>-180.00000000</UpperLeftX>
    <UpperLeftY>90.00000000</UpperLeftY>
    <LowerRightX>180.00000000</LowerRightX>
    <LowerRightY>-90.00000000</LowerRightY>
    <TileLevel>15</TileLevel>
    <TileCountX>2</TileCountX>
    <YOrigin>top</YOrigin>
  </DataWindow>
  <Projection>EPSG:4326</Projection>
  <BlockSizeX>512</BlockSizeX>
  <BlockSizeY>512</BlockSizeY>
  <Cache />
</GDAL_WMS>
0

Ironically my neighbour has come up with a fix - seems there is a bit of a bug. A way round this is as he describes:

"Here is how I managed to get the ArcGIS REST service to work:

gdal_translate --debug on http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer?f=json out.xml -of WMS

This produces the same error you see in QGIS: "ERROR 1: Invalid dataset dimensions : -2147483648 x -2147483648"

The error is being triggered because the layer is so large, there is a bug filed for this in the gdal_translate project. Even though it is erroring, gdal_translate does actually generate the required metadata that QGIS needs to add a Raster layer and allows you to tweak the tile level to a lower value to allow QGIS to display the layer. You need to use a working layer metadata file and, add this via the main menu: Layer -> Add Layer -> Add Raster Layer (Shift + CMD + R)"

So create an .xml file with: http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/${z}/${y}/${x} -20037508.34278700 20037508.34278700 20037508.34278103 -20037508.34278103 22 1 top EPSG:3857 256 256

End point is an editable aerial raster layer - happy times

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.