MapGuide Server (Version 184.108.40.20601)
MapGuide Viewer (Version 220.127.116.1101)
Windows Server 2012 R2 Standard 64 Bit
Ajax Viewer with PHP
Tested with Internet Explorer 11 and Chrome Version 51.0.2704.103 m
Ok this is something that may need a bit of discussion. This is not only a bug in the CREATERUNTIMEMAP implementation, it's also a bug in the spec (xml schema).
A client application like Fusion tests for the absence of the ScaleRange property in order to determine if it's a non-vector layer. If I fix this "bug", the raster layers will have a scale range, but there will still be no practical way to differentiate between a vector layer and a raster layer. This is because there is nothing in the runtime map schema that tells us whether a layer is a vector/raster/drawing layer.
If I fix the implementation, if you need to test for the layer's type you would have to test for the following:
- Drawing: The FeatureSource is a resource id ending with "DrawingSource"
- Raster: The ScaleRange is not null, but it only has a minscale/maxscale set, the FeatureStyle will be an empty array (the XML schema prevents us from setting this to null)
- Vector: None of the above.
This is the only way I can see this "problem" being fixed without doing a schema revision. Does this sound acceptable?
Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map
What does it do now in fusion and Ajax?, just iterate through the schema and when it finds a Raster go and make a call to the raster layer to get the scale range. I now I was able to catch the fact it was a Raster layer somehow when I used rest, I will have to see what it flagged me.
If you need the information, if a layer in a RuntimeMap is either raster or vector, can't you just go the the layers feature source to get this information?
We do this in our WebGIS to split the runtime maps into several maps. We add all the background raster layers (e.g. WMS) from the RuntimeMap as individual runtime maps (layers) in OpenLayers. This way you can swap the background maps without refreshing the vector map, or update the vector map without reloading the background map. Especially for WMS layers that are not tiled, this gives a great performance boost when people turn vector layers on and off.