Page 1 of 1

Specify the language in FeatureLayers

Posted: Thu Sep 24, 2015 6:43 am
by infpro_mi
Hello,

we would like to get the TruckAttributes and TrafficIncidents in a specific language.

Therefore, we have set the language property of the common element in the XMapProfile.
But the ToolTips of the Traffic Incidents and Truck Attributes are not returned in the specified language! :(

We are using the following code to add a Truck attribute layer:

Code: Select all

var truckAttributesLayer = new XMapLayer("TruckAttributes", xmapMetaInfo.Url, xmapMetaInfo.User, xmapMetaInfo.Password) {
  CustomCallerContextProperties = new xserver.CallerContextProperty[] {
    new xserver.CallerContextProperty {
      key = "ProfileXMLSnippet",
      value = "<?xml version='1.0' encoding='us-ascii'?><Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Common language='it' majorVersion='1' minorVersion='0' /><FeatureLayer majorVersion='1' minorVersion='0'><GlobalSettings enableTimeDependency='true' /><Themes><Theme id='PTV_TrafficIncidents' priorityLevel='0' /><Theme id='PTV_TruckAttributes' enabled='true' priorityLevel='0' /><Theme id='PTV_RestrictionZones' enabled='true' priorityLevel='0' /><Theme id='PTV_SpeedPatterns' enabled='true' priorityLevel='0' /></Themes></FeatureLayer></Profile>"
    }
  },
  CustomXMapLayers = new xserver.Layer[] {
    new xserver.FeatureLayer {
      name = "PTV_TruckAttributes",
      visible = true,
      objectInfos = xserver.ObjectInfoType.REFERENCEPOINT
    }
  }
};
And we have used the following code to add a Traffic Incident layer in the language of Italy:

Code: Select all

var trafficLayer = new XMapLayer("Traffic", xmapMetaInfo.Url, xmapMetaInfo.User, xmapMetaInfo.Password) {
  CustomCallerContextProperties = new xserver.CallerContextProperty[] {
    new xserver.CallerContextProperty {
      key = "ProfileXMLSnippet",
      value = "<?xml version='1.0' encoding='us-ascii'?><Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Common language='it' majorVersion='1' minorVersion='0' /><FeatureLayer majorVersion='1' minorVersion='0'><GlobalSettings enableTimeDependency='true' /><Themes><Theme id='PTV_TrafficIncidents' enabled='true' priorityLevel='0' /><Theme id='PTV_TruckAttributes' priorityLevel='0' /><Theme id='PTV_RestrictionZones' priorityLevel='0' /><Theme id='PTV_SpeedPatterns' priorityLevel='0' /></Themes></FeatureLayer></Profile>"
    }
  },
  CustomXMapLayers = new xserver.Layer[] {
    new xserver.SMOLayer() {
      name = "traffic.ptv-traffic",
      objectInfos = xserver.ObjectInfoType.REFERENCEPOINT,
      visible = true
    }
  },
  MaxRequestSize = xmapMetaInfo.MaxRequestSize
};
I believe the ToolTips of the TruckAttributes layer should be translated by the MapLocalizer.GetString(MapStringId id)(, which does not work in our case. Because the Ptv.XServer.Controls.Map.dll consists the english language in Ptv.XServer.Controls.Map.Resources.Strings.resources.

And the Traffic messages are returned in the wrong language by the xMap Server.

Best regards,
Martin

Re: Specify the language in FeatureLayers

Posted: Mon Sep 28, 2015 12:47 pm
by Bernd Welter
Hello Martin,

I forwarded your question to DEV, hopefully my colleagues provide a sample or at least a hint to the proper DOC as soon as possible.

Best regards
Bernd

Re: Specify the language in FeatureLayers

Posted: Mon Sep 28, 2015 3:00 pm
by Bernd Welter
Yeah, meanwhile we identified the cause for the issue:
The process described by Martin refers to two non-equal containers:
  • The XML Snippet parametrizes a FeatureLayer-based resource and translates it into ITALIAN - but does not request the text messages, this is why they do not appear in the response.
  • The XMap Layer is of type SMO LAYER and is responsible for the visualization of text messages (see ObjectInfos) - but does not translate them into a NON default language. This is why they appear in the wrong language
The solution for this is:
Use one and the same container based on FEATURE LAYER to display the VIs and to request the messages in the proper language.
XML sample request image
XML sample request image
Best regards Bernd Welter

Code: Select all

<?xml version="1.0"?>
<Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <renderMap xmlns="http://types.xmap.xserver.ptvag.com">
      <MapSection_1 scale="1000" scrollHorizontal="0" scrollVertical="0" zoom="0">
        <center xmlns="http://xmap.xserver.ptvag.com">
          <kml xsi:nil="true" xmlns="http://common.xserver.ptvag.com" />
          <point x="681142" y="6369874" xmlns="http://common.xserver.ptvag.com" />
        </center>
      </MapSection_1>
      <MapParams_2 showScale="true" useMiles="false" />
      <ImageInfo_3 format="GIF" height="400" imageParameter="" width="400" />
      <ArrayOfLayer_4>
        <Layer xsi:type="FeatureLayer" name="PTV_TrafficIncidents" visible="true" objectInfos="REFERENCEPOINT" xmlns="http://xmap.xserver.ptvag.com" />
      </ArrayOfLayer_4>
      <boolean_5>true</boolean_5>
      <CallerContext_6>
        <wrappedProperties xmlns="http://baseservices.service.jabba.ptvag.com">
          <CallerContextProperty key="CoordFormat" value="PTV_MERCATOR" />
          <CallerContextProperty />
          <CallerContextProperty key="ProfileXMLSnippet" value="<?xml version='1.0' encoding='us-ascii'?><Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Common language='it' majorVersion='1' minorVersion='0' /><FeatureLayer majorVersion='1' minorVersion='0'><GlobalSettings enableTimeDependency='true' /><Themes><Theme id='PTV_TrafficIncidents' enabled='true' priorityLevel='0' /><Theme id='PTV_TruckAttributes' priorityLevel='0' /><Theme id='PTV_RestrictionZones' priorityLevel='0' /><Theme id='PTV_SpeedPatterns' priorityLevel='0' /></Themes></FeatureLayer></Profile>" />
        </wrappedProperties>
      </CallerContext_6>
    </renderMap>
  </Body>
</Envelope>