Heat Map using sql table

984
11
08-21-2019 04:49 AM
kawishabbas
New Contributor III

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
Egge-JanPollé1
MVP Regular Contributor

Hi kawish abbas,

Yeah, I suppose you can apply the renderer to any kind of point layer.

Cheers,

Egge-Jan

0 Kudos
kawishabbas
New Contributor III

Egge-Jan Pollé

I have created my own json service using express. How can i use it with arcgis api...??

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

I don't think so. Unless you have the ability to make a layer (of some supported type) out of that tables data. I suppose if the SQL Table is from a Geodatabase or you have a web service that allows the query of the tables data, then you could create client side graphics in a FeatureLayer from that.

0 Kudos
kawishabbas
New Contributor III

Robert Scheitlin, GISP

I have created json service by using express.. Can i use this json service to create heat map..???

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Use esriRequest to call the json service and get your data. Shown in this sample.

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

Then use code from this sample to create FeatureLayer from that data.

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

Once you have a FeatureLayer apply the HeatMap renderer to it. 

kawishabbas
New Contributor III

Thank you Robert i will try this.

0 Kudos
kawishabbas
New Contributor III

Robert..

i have called json service and got data in console. But when i use code from this sample https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-feature... and try to got data with featureCollection, i received "undefined". How can i create featureCollection??

Response from JSON service

{ 
"data": [
  {
      "OBJECTID": 146,
      "Splitter": "64",
      "Comment": "DHA Phase05",
      "Name": "Plaza POP ODB 02",
      "ID": "2100604",
      "Placement": "Aerial",
      "POP": 21006,
      "Shape": {
        "srid": 32642,
        "version": 1,
        "points": [
          {
            "x": 301997.6824000003,
            "y": 2746232.8489999995,
            "z": null,
            "m": null
          }
        ],
        "figures": [
          {
            "attribute": 1,
            "pointOffset": 0
          }
        ],
        "shapes": [
          {
            "parentOffset": -1,
            "figureOffset": 0,
            "type": 1
          }
        ],
        "segments": []
      }
    }
  ]
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Kawish,

   Time to show your code. In the sample I provided it returns a featureCollection. In your case you have a json string that you need to parse and create Graphics for each result in your data array.

0 Kudos
kawishabbas
New Contributor III

Robert

Could you please give me sample code for given json string that how to parse and create feature layer..

{ 
"data": [
  {
      "OBJECTID": 146,
      "Splitter": "64",
      "Comment": "DHA Phase05",
      "Name": "Plaza POP ODB 02",
      "ID": "2100604",
      "Placement": "Aerial",
      "POP": 21006,
      "Shape": {
        "srid": 32642,
        "version": 1,
        "points": [
          {
            "x": 301997.6824000003,
            "y": 2746232.8489999995,
            "z": null,
            "m": null
          }
        ],
        "figures": [
          {
            "attribute": 1,
            "pointOffset": 0
          }
        ],
        "shapes": [
          {
            "parentOffset": -1,
            "figureOffset": 0,
            "type": 1
          }
        ],
        "segments": []
      }
    },
      {
      "OBJECTID": 147,
      "Splitter": "64",
      "Comment": "DHA Phase06",
      "Name": "Badar POP ODB Muhafiz",
      "ID": "2100502",
      "Placement": "Aerial",
      "POP": 21005,
      "Shape": {
        "srid": 32642,
        "version": 1,
        "points": [
          {
            "x": 302831.8328999998,
            "y": 2742953.342599999,
            "z": null,
            "m": null
          }
        ],
        "figures": [
          {
            "attribute": 1,
            "pointOffset": 0
          }
        ],
        "shapes": [
          {
            "parentOffset": -1,
            "figureOffset": 0,
            "type": 1
          }
        ],
        "segments": []
      }
    }
  ]
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos