Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an ArcGIS Dynamic Map services does not preserve styling #8

Open
mhogeweg opened this issue Mar 19, 2015 · 9 comments
Open

Adding an ArcGIS Dynamic Map services does not preserve styling #8

mhogeweg opened this issue Mar 19, 2015 · 9 comments

Comments

@mhogeweg
Copy link

In an ArcGIS Dynamic Map service, the author chooses cartography, scale-dependent rendering of layers, labeling etc. When adding an ArcGIS Dynamic Map service using the plugin, the styling is lost. This may be verified with: http://geoss.esri.com/arcgis/rest/services/WorldBackGroundGrey/MapServer

@sfkeller
Copy link

I don't understand the issue: This plugin does not support styling based client requests. But to my understanding ArcGIS Dynamic Map services always have a default styling attached since the raster map response needs to be generated anyhow. Pls. clarify.

@sfkeller sfkeller self-assigned this Mar 23, 2015
@mhogeweg
Copy link
Author

the example service above is not a raster map service with precooked tiles. it is dynamic in the sense that client applications can show/hide layers, do identify operations, and (depending on how the publisher configured the service) even allow modifying styling. all this handled through basic REST call to the service like this example:

http://geoss.esri.com/arcgis/rest/services/WorldBackGroundGrey/MapServer/export?bbox=-201.94247790675956,-94.83849562389014,194.05752264644622,97.46681437927066

notice I'm not submitting any layer ids or such and the service still draws all of them with the styling I defined in this particular service. as you zoom in you'll notice the major rivers disappear at some point:

compare:
http://geoss.esri.com/arcgis/rest/services/WorldBackGroundGrey/MapServer/export?dpi=96&transparent=true&format=png8&bbox=-3.4050263481304324%2C45.20685937488983%2C17.287878217291983%2C59.837389555911145&bboxSR=4326&imageSR=4326&size=768%2C543&f=image

with:
http://geoss.esri.com/arcgis/rest/services/WorldBackGroundGrey/MapServer/export?dpi=96&transparent=true&format=png8&bbox=0.25934216866311655%2C48.88469983475983%2C10.605794451374333%2C56.19996492527049&bboxSR=4326&imageSR=4326&size=768%2C543&f=image

same request, only different is the bounding extent (and resulting from that the map scale).

@sfkeller
Copy link

I understand that there are no precooked tiles; to me it's like an OGC WMS. But I still can't follow what you expect from the plugin, which styling is "lost" and which of the parameters of the examples above are styling parameters.

@mhogeweg
Copy link
Author

more illustrated example using my local SampleWorldCities service.

this is how it shows in a browser using the ArcGIS JS API (all just making the simple REST calls illustrated above):

sampleworldcities js api

Adding this service to ArcMap gives the same styling:

sampleworldcities arcmap

but adding this service to QGIS results in improper layer order (backward, see #7) and with incorrect styling:

sampleworldcities qgis

@sfkeller
Copy link

I see. What is then the difference to issue #7 ?

@mhogeweg
Copy link
Author

#7 is just about the layer order (they're upside down, in the above, the cities should be on top, not on the bottom). #8 (this issue) is about the styling. I see them as separate issues.

@sfkeller
Copy link

Ok. But where is the styling parameter in the URL examples you gave? What should the plugin do?

@mhogeweg
Copy link
Author

that's the beauty of Dynamic Map Services: you don't have to provide the styling since that is already defined in the service itself.

I was playing with adding a dynamic map service in QGIS myself. This works except for capturing the signal to redraw when the map extent changes. I'll send you the full code, but here's a snippet (note the server is my laptop, so replace that with a public service URL):

    fileName = 'http://hogeweg.esri.com/arcgis/rest/services/SampleWorldCities/MapServer/export?dpi=96&transparent=true&format=png8&bboxSR=4326&imageSR=4326&f=image'
    fileInfo = QFileInfo(fileName)
    baseName = fileInfo.baseName()
    canvasSize = qgis.utils.iface.mapCanvas().size()
    canvasWidth = canvasSize.width()
    canvasHeight = canvasSize.height()
    canvasExtent = qgis.utils.iface.mapCanvas().extent()

    agsbbox = str('&bbox=%d,%d,%d,%d' % (canvasExtent.xMinimum(), canvasExtent.yMinimum(),canvasExtent.xMaximum(),canvasExtent.yMaximum()))
    agssize = str('&size=%s,%s' % (canvasWidth,canvasHeight))
    fileName += agsbbox
    fileName += agssize

    rlayer = qgis.core.QgsRasterLayer(fileName, baseName)
    rlayer.setCrs(qgis.core.QgsCoordinateReferenceSystem(4326, qgis.core.QgsCoordinateReferenceSystem.EpsgCrsId) )
    qgis.core.QgsMapLayerRegistry.instance().addMapLayer(rlayer)

@ajturner
Copy link

This should support both the predefined styling in the service as well as user defined styling at query time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants