M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 23
Registered: ‎06-18-2018

Analyzer API documentation

Hi there,

 

Is there any documentation on how to use the Analyzer API?

 

I've successfully created additional stages and features through the browser console using the following code as a template:

let stage = await Analyzer.createStage("AdditionalLayer", { mode: "EnterpriseConnector", vectorset: "MyVectorSet", datasetName: "MyVectorData"});

var theme = Analyzer.createThemeWidget(stage, "Feature");

Analyzer.addWidget(theme);

stage = Analyzer.findStageModel("AdditionalLayer");

var featureLayer = Analyzer.createFeatureLayer(stage);

Analyzer.addWidget(featureLayer);

I want to create another feature layer in my view now, but I want the data to be retrieved from a Query API call instead of specifying a vector dataset (bold text in code snippet). Do you know if this is possible?

 

Thanks in advance for any help.

 

Kind Regards,

Ryan

Highlighted
Staff
Posts: 1,088
Registered: ‎10-18-2015

Re: Analyzer API documentation

[ Edited ]

Hi Ryan,

 

we have not published yet this API since you will get this possibility of out the box in the next release (with a dedicated GUI to configure multiple feature data).

In your case you can use something like:

 

var dataset = "/api/v1/sqlquery/VECTORDATANAME?query=SELECT * FROM TABLENAME&format=csv";

HTH,

Stefano 

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Highlighted
Contributor
Posts: 23
Registered: ‎06-18-2018

Re: Analyzer API documentation

Hi Stefano,

 

Thanks for your response.

 

I have two seperate datasets that I need in the Analyzer view. When one dataset is displaying, the other one musn't be and vice versa. I have attempted the approach of updating the defaut Stage Model which works because the map features and charts adapt to the data retrieved by QueryAPI calls in a simiar way you have described previously. Up to this point all is okay. 

 

However, I need one dataset to render on the map with clustering on, and another with clustering off. So I thought I would need to add an additional feature layer using the code snippet I shared in my original post. But I don't know how to add a feature layer and define its dataset as results from a QueryAPI call - instead of cached vector data imported in the M.App Studio.

 

Therefore, I was hoping there may be some documentation on the configuration of new feature layers etc. Am I right in saying that this will be much easier to achieve in the next MAE release via the GUI?

 

Also, do you know if there's a function I could call which would enable/ disable the clustering of features on the map? If so, I may be able to avoid importing another feature layer which would be brilliant.

 

I hope all of that makes sense. I look forward to hearing back from you.

 

Best Regards,

Ryan 

Highlighted
Staff
Posts: 1,088
Registered: ‎10-18-2015

Re: Analyzer API documentation

[ Edited ]

Hi Ryan,

 

to add the feature layer from the stage to the map you have to use:

 

var feature = Analyzer.createFeatureLayer(stage);
Analyzer.addWidget(feature);
Analyzer.reloadView(); // or click on Apply in the config menu

here you can find a brief documentation of the API.

 

If you just want to switch the type you can do something like:

 

//normally there are 2 features, the first one (index 0) is the main feature, the second one (index 1) is the heatmap
Analyzer.findStageModel()._features[0].type="clusterLayer";  // "primaryFeatureLayer" will paint individual points
Analyzer.reloadView();

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial