Getting time series data back to webpage

977
4
11-16-2018 03:49 PM
GrantHaynes
Occasional Contributor

Hi all

 

I'm constructing a web page with Leaflet that will allow a user to click the map to add points and then run process that will extract all the time series data at that point and display it on a graph on the web page. I have the web page roughed out and the point creation task also roughed out. I have it so on point creation a lat and long will be generated to pass back to the geoprocessing service on arcserver. Is there a way I can directly send the extracted data back to the webpage? Do I need to send it somewhere else and then read it from there? 

0 Kudos
4 Replies
JohnGravois
Frequent Contributor

you can find a few live examples that use esri-leaflet-gp to execute gp tasks and display the results in leaflet here:

https://github.com/jgravois/esri-leaflet-gp#demos 

0 Kudos
GrantHaynes
Occasional Contributor

Thanks, I've seen these before, most of them are bringing in the resulting layer. My geoprocessing service generates a long list of values, I need to figure out how to use those values in a graphing operation in my web page, I'm really at a loss I have no clue how to do it.

0 Kudos
JohnGravois
Frequent Contributor

this is switching gears completely, but you can find a JSAPI example that uses chart.js using an array of 'raw' values instead of features here:

Query statistics client-side | ArcGIS API for JavaScript 4.9

> Is there a way I can directly send the extracted data back to the webpage?

if your GP service generates a list of values instead of features you can access them in a callback using esri-leaflet-gp and then wire up a chart of your own. there are lots of charting libs out there. the crux for you will be to adapt the response to match the data model the one you choose expects. 

0 Kudos
GrantHaynes
Occasional Contributor

Thanks, 

I think I'm starting to understand this, here's what I have so far

//execute geoprocessing service each time a lat and long are generated
var gpService = L.esri.GP.service({
useCors:true
});
var gpTask = gpService.createTask();
gpTask.setParam("InputX", Long);
gpTask.setParam("InputY", Lat);
gpTask.setOutputParam("Output");
gpTask.run(DataCallBack);

function DataCallBack(response){
Results = (response.Output);
}