How to Retrieve the Available Metainformation in the Map
This article discusses the use case of retrieving the metainformation at the given map.
Benefits
Useful to be able to know the available content of a map.
Concepts
The metainformation can be retrieved using the getDataInformation operation.
Given a DataInformationRequest object which specifies which fields shall be returned in DataInformationResponse.
Programming Guide
The sample below uses the REST REST (Representational State Transfer) represents a World Wide Web paradigm, consisting of constraints to the design of components which results in a better performance and maintainability. API to request the available content in a map.
// URL path shared by all used xServer layers var urlPath = xServerUrl + '/services/rest/XRuntime/experimental/dataInformation'; // We use jQuery to send the request. Be sure to reference jQuery for this to work. $.ajax(urlPath).always(function(response) { // The request is expected to return a response of type DataInformationResponse. if (response) { print('ProviderInformation: ' + response.mapDescription.providerInformation); } else { print('Request did not succeed.'); } });The sample below uses the REST API to request the available continents in a map.
// URL path shared by all used xServer layers var urlPath = xServerUrl + '/services/rest/XRuntime/experimental/dataInformation?continents=true'; // We use jQuery to send the request. Be sure to reference jQuery for this to work. $.ajax(urlPath).always(function(response) { // The request is expected to return a response of type DataInformationResponse. if (response) { var s = 'Continents: '; for (var i = 0; i < response.continents.length; i++) { s += response.continents[i].code + ' (' + response.continents[i].countries.length + ' countries)'; if (i != response.continents.length - 1) { s += ', '; } } print(s); } else { print('Request did not succeed.'); } });The sample below uses the REST API to request the profile A profile is a collection of parameters used to configure the request. Full profiles consist of a number of specialized sub-profiles like the VehicleProfile which describes the properties of a vehicle. properties that are used for toll calculation if detailed toll data is installed.
// URL path shared by all used xServer layers var urlPath = xServerUrl + '/services/rest/XRuntime/experimental/dataInformation'; var hasDetailedToll = false; var usedProfileProperties; // We use jQuery to send the request. Be sure to reference jQuery for this to work. $.ajax(urlPath).always(function(response) { if (response) { if (response.mapFeatures.tollFeatures) { if (response.mapFeatures.tollFeatures.detailLevel == 'DETAILED' || response.mapFeatures.tollFeatures.detailLevel == 'MIXED') { hasDetailedToll = true; } if (hasDetailedToll && response.mapFeatures.tollFeatures.profileProperties) { usedProfileProperties = response.mapFeatures.tollFeatures.profileProperties; } } } }); if (hasDetailedToll) { print('The following ' + usedProfileProperties.length + ' profile parameters may influence toll price calculation: ' + usedProfileProperties.toString()); } else { print('For basic toll there is only the static description in the vehicle profile.'); }The sample below uses the REST API to request the profile properties that may influence the routing A route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path. algorithm when PTV_TruckAttributes are enabled.
// URL path shared by all used xServer layers var urlPath = xServerUrl + '/services/rest/XRuntime/experimental/dataInformation'; var hasTA = false; var usedProfileProperties; // We use jQuery to send the request. Be sure to reference jQuery for this to work. $.ajax(urlPath).always(function(response) { if (response) { if (response.mapFeatures.featureLayerThemes) { for (i = 0; i < response.mapFeatures.featureLayerThemes.length; ++i) { theme = response.mapFeatures.featureLayerThemes[i]; if (theme.themeId == 'PTV_TruckAttributes') { hasTA = true; usedProfileProperties = response.mapFeatures.featureLayerThemes[i].profileProperties; } } } } }); if (hasTA) { print('The following ' + usedProfileProperties.length + ' profile parameters may influence routing with truck attributes: ' + usedProfileProperties.toString()); } else { print('The feature layer PTV_TruckAttributes appears not to be installed.'); }