Heat Map on ArcGIS Viewer for Flex

7426
64
03-07-2011 12:04 PM
MESHALALMASHAN
New Contributor
Hi,

   I'm trying to implement a heat map on my ArcGIS viewer using the code posted on the following link:

http://thunderhead.esri.com/readonlyurl/HeatMapNew/srcview/


But still I'm not getting anything running yet as I'm not sure if it's compatible with the Viewer for Flex or not.

Any idea?
Tags (2)
0 Kudos
64 Replies
LloydHeberlie
Occasional Contributor
Another user had posted (on another thread) a question about using queries so I thought I would repost on this thread.

If you are having issues with features being returned in your heat map, you might check the CaSe of the values in your field being used.  The queries are case SenSitive.

Returns 132 records.
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer/0/query?...

Returns 0 records.
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer/0/query?...

See the sample below for an earthquakes query using a LIKE operator on the field Name
The values in the <types></types> markup must match the values in your data (File Geodatabase Featureclass, etc).

Hope this helps,

Lloyd
Esri Flex Team


http://stlouis.esri.com/apps/flexviewer24/index.html?config=heatmap-config-like.xml

<?xml version="1.0" ?>
<configuration>
 <layers>
        <layer>
            <name>Earthquakes HeatMap</name>
            <url>http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer/0</url>
            <outFields>YYYYMMDD,Magnitude,Num_Injured,Num_Deaths,Name</outFields>
   <useamf>true</useamf>
   <defaultquery>1=1</defaultquery>
   <querytemplate>Name LIKE '%REPLACE_STR%'</querytemplate>
   <types>CHILE,TURKEY,CHINA,PHILIPPINES,JAPAN,IRAN,INDIA</types>
   <type_descs>Chile,Turkey,China,Philippines,Japan,Iran,India</type_descs>
        </layer>
 </layers>
 <ui>
  <widget_dimensions>
   <width>378</width>
   <height>206</height>
  </widget_dimensions>
  <icons>
   <main_icon>i_rainbow.png</main_icon><!-- Icon must exist under assets/images in viewer -->
   <main_label>Main Panel</main_label><!-- Title/label for icon across the top widget panel -->
   <settings_icon>i_options.png</settings_icon>
   <settings_label>Settings Panel</settings_label>
  </icons>
  <refresh_label>refreshing layer...</refresh_label>
  <query>
   <comp_label>Earthquakes by geography:</comp_label>
   <heatmapquery_prompt>default selection</heatmapquery_prompt>
   <featurecount_label> features contained</featurecount_label>
  </query>
  <transparency>
   <comp_label>Transparency:</comp_label>
   <defaulttransparency>0.7</defaulttransparency>
  </transparency>
  <symbol>
   <comp_label>Theme:</comp_label>
   <defaulttheme>RAINBOW</defaulttheme><!-- Must be one of RED_WHITE_BLUE, RAINBOW, or THERMAL -->
  </symbol>
 </ui>
</configuration>
0 Kudos
RogerKoelpin
New Contributor
Does this work with proxies?       

<layer>
     <useproxy>true</useproxy>
0 Kudos
LloydHeberlie
Occasional Contributor
Does this work with proxies?       

<layer>
     <useproxy>true</useproxy>



Hi Roger,

After taking another look at the source code, it appears that I did not implement this.
I'll try and make sure this gets into the 3.0 update.
I just don't have time to fix it right now.

Sorry,
0 Kudos
JorgeCrespo
New Contributor
Hi LLoyd
I'm using the compiled widget and it works perfectly. Is there any possibility to include the population variable? I mean, one single point (A) is heater than another point (B) if the value in another field in A is greater than the value in B.
0 Kudos
LloydHeberlie
Occasional Contributor
Hi LLoyd
I'm using the compiled widget and it works perfectly. Is there any possibility to include the population variable? I mean, one single point (A) is heater than another point (B) if the value in another field in A is greater than the value in B.



Giorgio,

Currently the code does not supported the concept of a "weighted attribute" to generate the heat map.  I will add this to the list of features to implement for the next release.  I hope to have this finished before the User's Conference in July (2012).
0 Kudos
JorgeCrespo
New Contributor
Excellent widget anyway.
Thank you for sharing with us. Great work
0 Kudos
JerryBiedenbender
New Contributor
Hello, Excellent widget but i need some help modifying it.

        Instead of greater than or equal to... Can I do a "between". I have over 100 years of data and i would like to display it by 5 or 10 years at a time rather than year by year.


Below is an example of how it looks year by year by but if i keep this up the list will be too big. 
<querytemplate>RSL = REPLACE_STR</querytemplate>
            <types>0,1,2,3,4,5</types>
            <type_descs>Years = 0,Years = 1,Years = 2,Years = 3,Years = 4,Years = 5</type_descs>



Is there code like this...
<type_descs>Years Between (0&5),Years Between (5&10), Years Between (10&15), Years Between (15&20)</type_descs>


Thanks,
Jerry
0 Kudos
JerryBiedenbender
New Contributor
I have to top this sorry.
0 Kudos
JerryBiedenbender
New Contributor
Bringing it to the top.
0 Kudos
LloydHeberlie
Occasional Contributor
Hello, Excellent widget but i need some help modifying it.

        Instead of greater than or equal to... Can I do a "between". I have over 100 years of data and i would like to display it by 5 or 10 years at a time rather than year by year.


Below is an example of how it looks year by year by but if i keep this up the list will be too big. 
<querytemplate>RSL = REPLACE_STR</querytemplate>
            <types>0,1,2,3,4,5</types>
            <type_descs>Years = 0,Years = 1,Years = 2,Years = 3,Years = 4,Years = 5</type_descs>



Is there code like this...
<type_descs>Years Between (0&5),Years Between (5&10), Years Between (10&15), Years Between (15&20)</type_descs>


Thanks,
Jerry


Hi Jerry,

Here are a couple of options depending on how you have your data structured. 
Option 1:
If your field is a date field and you are using at least ArcGIS 10 for Server then you could use the "time" capability of ArcGIS.  The current example allows filtering of the data through enabling "time" on the widget.  This will then give you a time slider where you can adjust the time range and filter the data.
Option 2:
You can configure the widget to filter the between ranges such as (Magnitude >= 6 and Magnitude <= 8).  Here is what your configuration file would look like.

            <querytemplate>REPLACE_STR</querytemplate>
            <types>Magnitude &gt;= 2 and Magnitude &lt;= 4,Magnitude &gt;= 6 and Magnitude &lt;= 8</types>
            <type_descs>Mag 2-4,Mag 6-8</type_descs>


If your field type is not a number and is instead a string, don't forget to put quotes around the values.

View it Live

If you need to change the user interface or want to go much beyond this, then you'll need to compile the source code on your own (which is provided in the download).

Hope this helps,
0 Kudos