Heat Map using sql table

2256
11
08-21-2019 04:49 AM
kawishabbas
Occasional Contributor

Hi

Is there any possibility to use SQL Table instead of CSV to visualize points with heat map..???

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=visualization-...

Robert Scheitlin, GISPEgge-Jan PolléKelly Hutchins

Tags (1)
0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus

Kawish,

   You can not expect that someone will do the coding for you all the time by providing a sample that works for your specific case. If you post your attempt to work with your data and where you are stuck then some corrections or guidance can be provided.

Like I said before you need to loop through the json data.

var graphicsArray = respose.data.map(function(result){
  var resultPnts = result.Shape.points.map(function(point){
    return new Point(point.x, point.y, new SpatialReference({wkid: point.srid});
  });
  var atts = {
    "ObjectID": result.OBJECTID,
    "Splitter": result.Splitter,
    "Comment": result.Comment,
    "Name": result.Name,
    "ID": result.ID,
    "Placement": result.Placement,
    "POP": result.POP
  };
  var graArr = resultPnts.map(function(pnt){
    return new Graphic(pnt, new SimpleMarkerSymbol(), atts)
  });
  return graArr;
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 Then use the code from the sample and some code from the FeatureLayer documentation to populate the FeatureLayer:

const fields = [
 new Field({
   name: "ObjectID",
   alias: "ObjectID",
   type: "oid"
 }), new Field({
   name: "Splitter",
   alias: "Splitter",
   type: "string"
 }), new Field ({
   name: "Comment",
   alias: "Comment",
   type: "string"
 }), new Field ({
   name: "Name",
   alias: "Name",
   type: "string"
 }), new Field ({
   name: "ID",
   alias: "ID",
   type: "string"
 }), new Field ({
   name: "Placement",
   alias: "Placement",
   type: "string"
 }), new Field ({
   name: "POP",
   alias: "Population",
   type: "integer"
 })
];
var featureLayer = new FeatureLayer({
  objectIdField: "ObjectID",
  source: graphicsArray,
  fields: fields
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
kawishabbas
Occasional Contributor

Robert

I am very grateful to your help and i am really sorry that you had to suffer so much because of me.

0 Kudos