For documentation on the current version, please check Knowledge Base.
Example : Search Panorama Coverages
This example assumes you have successfully embedded the component and validated the license.
This example shows you how to retrieve panorama coverages. A panorama coverage is extracted from the actual trajectory taken by the mobile vehicle while the module mapping data was recorded. This trajectory is then simplified and provided as “Coverage”.
Steps to take :
- Wait for the publication to load.
- Search for panorama coverages.
1. Wait for the publication to load.
The example below shows how to wait for a publication to load successfully.
client.addEventListener(orbit.webclient.LoadPublicationEvent.SUCCESS, function(e) { console.log("Publication is loaded."); });
2. Search for panorama coverages.
Searching for panorama coverages requires 2 parameters :
- A bounding box
- A list of publication labels
A boundingbox is defined by these parameters :
- minX : The minimum X value.
- minY : The maximum Y value.
- maxX : The minimum X value.
- maxY : The maximum Y value.
- crs : The CRS code defining the CRS of the bounding box.
A list of publication labels can be provided, but can also be ommitted. When null is provided, coverages are returned for every label.
Keep in mind that a user can enable or disable project labels using a HUD window. Use these functions and event to keep track of the labels in use :
Panorama.getProjectLabels()- Get the list of labels defined by the loaded publication.Panorama.getProjectLabelUse()- Get the 'use' state of a label.PanoramaEvent.ProjectLabelUseChangeevent - Listen to track when the user enables or disables a label.
Coverages are returned in the Publication CRS or in a custom CRS if one was set using the setCRS() function.
client.addEventListener(orbit.webclient.LoadPublicationEvent.SUCCESS, function(e) { client.getPanorama().searchCoverages(null/*all-labels*/,133810,206161,133860,206211,"31370", function (result) { console.log("Found coverages : ", result); }, function(fault) { console.log("Error loading coverages : ", fault); }); });
About Rendering Coverages
The color for a coverage can be retrieved using the Panorama.getProjectLabelColor() function.
Scale limits should be applied to coverages. We recommend to render them between 1/1500 and 1/50000 on a metric scale.
Complete Example
<html title="My Publication"> <head> <script type="text/javascript" src="<server>/api/<version>/webclient_api.js"></script> <script type="text/javascript"> var client; function addClient() { client.addEventListener(orbit.webclient.ClientEvent.GRANTED, function(e) { client.setServer("http://developer.orbitgis.com/service"); client.setCredentials("dev","dev"); client.loadPublication("Sint-Niklaas_31370"); }); client.addEventListener(orbit.webclient.LoadPublicationEvent.SUCCESS, function(e) { client.getPanorama().searchCoverages(null/*all-labels*/,133810,206161,133860,206211,"31370", function (result) { console.log("Found coverages : ", result); }, function(fault) { console.log("Error loading coverages : fault); }); }); }); } </script> </head> <body onload="addClient()"> <div id="clientElement"/> </body> </html>
Result
Please open the JavaScript Console of your browser to see debug messages.