05-05-2020 06:25 AM
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
05-05-2020 01:01 PM - edited 05-05-2020 01:03 PM
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
05-14-2020 05:39 AM
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
05-15-2020 12:12 AM - edited 05-15-2020 12:14 AM
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
08-24-2020 03:19 AM
Hi Stefano. When will this functionality be released? Thanks, Johnnie
08-24-2020 05:22 AM
hi Johnnie,
it will be released with MAE 2020, there is no official date for the release yet.
Stefano