Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Matze
Bug noticed: CreateRuntimeMap returns  scalerange  with „Null“ when using Raster or WMS-layers in Map.  Vectorlayer causes no Problems.

In example the JSON returnvalue and the related LayerDefinition

TIF-Gridlayer:

{          
            "FeatureSource": [{
                "ClassName": ["default:default"],
                "Geometry": ["Raster"],
                "ResourceId": ["Library://MobileViewer/Rasterdaten/TIF.FeatureSource"]
            }],
            "LayerDefinition": ["Library://MobileViewer/Rasterdaten/TIF.LayerDefinition"],
            "LegendLabel": ["TIF"],
            "Name": ["TIF"],
            "ObjectId": ["305a0c88-95d6-11e6-8002-0050569cbc24"],
            "ParentId": ["3057aaf6-95d6-11e6-8003-0050569cbc24"],
            "ScaleRange": null,
        }],

TIF.LayerDefinition.xml:

<?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="LayerDefinition-2.4.0.xsd" version="2.4.0">
  <GridLayerDefinition>
    <ResourceId>Library://MobileViewer/Rasterdaten/TIF.FeatureSource</ResourceId>
    <Watermarks />
    <FeatureName>default:default</FeatureName>
    <Geometry>Raster</Geometry>
    <GridScaleRange>
      <MinScale>10000</MinScale>
      <MaxScale>500000</MaxScale>
      <ColorStyle>
        <ColorRule>
          <LegendLabel>
          </LegendLabel>
          <Color>
            <ExplicitColor>000000</ExplicitColor>
          </Color>
        </ColorRule>
        <ColorRule>
          <LegendLabel>
          </LegendLabel>
          <Color>
            <ExplicitColor>FFFFFF</ExplicitColor>
          </Color>
        </ColorRule>
      </ColorStyle>
      <RebuildFactor>1</RebuildFactor>
    </GridScaleRange>
  </GridLayerDefinition>
</LayerDefinition>

Flurstuecke-Vectorlayer:


        "Layer": [{
            "ActuallyVisible": ["true"],
            "DisplayInLegend": ["true"],
            "ExpandInLegend": ["true"],
            "FeatureSource": [{
                "ClassName": ["Default:AX_Flurstueck"],
                "Geometry": ["Geometry"],
                "ResourceId": ["Library://MobileViewer/Flurkarte/Daten/AX_Flurstuecke.FeatureSource"]
            }],
            "LayerDefinition": ["Library://MobileViewer/Flurkarte/Layer/Flurstuecke.LayerDefinition"],
            "LegendLabel": ["Flurstuecke"],
            "Name": ["Flurstuecke"],
            "ObjectId": ["305a0c88-95d6-11e6-8000-0050569cbc24"],
            "ParentId": ["3057aaf6-95d6-11e6-8001-0050569cbc24"],
            "ScaleRange": [{
                "FeatureStyle": [{
                    "Rule": [{
                        "Filter": null,
                        "Icon": ["iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAADpJREFUOI1jYGBg2MrAwPCfTLyVEcogG7AgsRlJ1PufgYGBgYkS20cNGDVg8BhAcWZiYmBg2EaB/m0AZkoT5bViUtAAAAAASUVORK5CYII="],
                        "LegendLabel": null
                    }],
                    "Type": ["3"]
                }],
                "MaxScale": ["1000000000000"],
                "MinScale": ["0"]
            }],
            "Selectable": ["true"],
            "Type": ["1"],
            "Visible": ["true"]
        },

Flurstuecke.LayerDefinition.xml:


<?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="LayerDefinition-2.4.0.xsd" version="2.4.0">
  <VectorLayerDefinition>
    <ResourceId>Library://MobileViewer/Flurkarte/Daten/AX_Flurstuecke.FeatureSource</ResourceId>
    <Watermarks />
    <FeatureName>Default:AX_Flurstueck</FeatureName>
    <FeatureNameType>FeatureClass</FeatureNameType>
    <PropertyMapping>
      <Name>GISID</Name>
      <Value>GISID</Value>
    </PropertyMapping>
    <PropertyMapping>
      <Name>AMTLICHEFL</Name>
      <Value>AMTLICHEFL</Value>
    </PropertyMapping>
    <Geometry>Geometry</Geometry>
    <VectorScaleRange>
      <AreaTypeStyle>
        <AreaRule>
          <LegendLabel>
          </LegendLabel>
          <AreaSymbolization2D>
            <Fill>
              <FillPattern>Solid</FillPattern>
              <ForegroundColor>00FFFFFF</ForegroundColor>
              <BackgroundColor>ffffffff</BackgroundColor>
            </Fill>
            <Stroke>
              <LineStyle>Solid</LineStyle>
              <Thickness>1</Thickness>
              <Color>ff000000</Color>
              <Unit>Points</Unit>
              <SizeContext>MappingUnits</SizeContext>
            </Stroke>
          </AreaSymbolization2D>
        </AreaRule>
      </AreaTypeStyle>
    </VectorScaleRange>
  </VectorLayerDefinition>
</LayerDefinition>



MapGuide Server (Version 3.0.0.8701)
MapGuide Viewer (Version 3.0.0.8701)
Windows Server 2012 R2 Standard 64 Bit
Ajax Viewer with PHP
Tested with Internet Explorer 11 and  Chrome Version 51.0.2704.103 m


Matze
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Flipper
I noticed that in 3.0 With Mapguide REST as well
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Jackie Ng
In reply to this post by Matze
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?

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Flipper
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.
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Jackie Ng
Ajax viewer doesn't use CREATERUNTIMEMAP.

CREATERUNTIMEMAP was modeled on what was in mapguide-rest, which was modeled on LoadMap.php and LoadScaleRanges.php from the Fusion backend.

And like I said, Fusion appers to only be testing for a lack of ScaleRange property on the layer to determine if it is a raster and nothing else.

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Flipper

I swore their was keyword or later type flag that caused me to catch them and just force infinity in my app, will check tomorrow


On Oct 20, 2016 7:32 PM, "Jackie Ng" <[hidden email]> wrote:
Ajax viewer doesn't use CREATERUNTIMEMAP.

CREATERUNTIMEMAP was modeled on what was in mapguide-rest, which was modeled
on LoadMap.php and LoadScaleRanges.php from the Fusion backend.

And like I said, Fusion appers to only be testing for a lack of ScaleRange
property on the layer to determine if it is a raster and nothing else.

- Jackie



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Bug-CreateRuntimeMap-returns-scalerange-with-Null-when-using-Raster-or-WMS-layers-in-Map-tp5291469p5291800.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Hans Milling
In reply to this post by Jackie Ng
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.
Reply | Threaded
Open this post in threaded view
|

Re: Bug: CreateRuntimeMap returns scalerange with „Null“ when using Raster or WMS-layers in Map

Flipper
Thats a great idea Hans. For what its worth I checked layer.FeatureSource.Geometry == "Raster" and just set the scae range to infinity in me endeavor.