<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS Javascript - Feature Layer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729677#M67686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like you are creating the feature layer from clientside&amp;nbsp;features.&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#timeInfo" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#timeInfo"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#timeInfo&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;The&amp;nbsp;&lt;EM&gt;timeInfo&lt;/EM&gt;&amp;nbsp;property, along with its&amp;nbsp;&lt;EM&gt;startField&lt;/EM&gt;&amp;nbsp;&lt;STRONG&gt;and&lt;/STRONG&gt;&amp;nbsp;&lt;EM&gt;endField&lt;/EM&gt;&amp;nbsp;properties, must be set at the time of layer initialization if it is being set for a&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html"&gt;GeoJSONLayer&lt;/A&gt;,&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html"&gt;CSVLayer&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html"&gt;FeatureLayer&lt;/A&gt;&amp;nbsp;initialized from&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#creating-a-featurelayer"&gt;client-side features&lt;/A&gt;.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Mar 2020 12:59:35 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2020-03-10T12:59:35Z</dc:date>
    <item>
      <title>ArcGIS Javascript - Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729676#M67685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have built a map with two layers and the third layer is a feature layer which has data points. On initial load the first two layers load and the feature layer is added to the map once a user has selected a dropdown to pull in data from the DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data is pulled and plotted to the map however when a user selects another option from the dropdown data is pulled and displayed on the map but with also the data from the previous selection that the user has selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have set&amp;nbsp;definitionExpression&amp;nbsp;on the feature layer but the map still displays for both the selection. What might be the issue?&lt;/P&gt;&lt;P&gt;*I am using Esri Javascript Library v4.13.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: var(--black-750); border: 0px; font-weight: inherit; font-size: 13px;"&gt;var selectedoption = document.getElementById("site_uuid");
 selectedoption.addEventListener("change", function(){

 var site_uuid = event.target.value;
 $.ajax({
 type : "GET",
 url : '&amp;lt;?= Helper::url_base()?&amp;gt;Site/get_one/'+site_uuid,
 dataType : "json"
 }).done(function(response){


// Set the extent on the view
view.extent = new Extent({
 xmin: response.xmin,
 ymin: response.ymin,
 xmax: response.xmax,
 ymax: response.ymax,
 spatialReference: {
 wkid: 4326 
 }
});

 //site data function defined below 
 data(site_uuid);
});
});

var data = function(site_uuid){


 $.ajax({
 type : "GET",
 url:'&amp;lt;?=Helper::url_base() ?&amp;gt;public/featurelayerdata/'+site_uuid, 
 dataType : "json"
 }).done(function(response){


 const fields = [
 new Field({
 name: "id",
 alias: "ObjectID",
 type: "oid"
 }), new Field ({
 name: "site_name",
 alias: "site_name",
 type: "string"
 }), new Field ({
 name: "site_code",
 alias: "site_code",
 type: "string"
 }),new Field ({
 name: "longitude",
 alias: "longitude",
 type: "string"
 }), new Field ({
 name: "lattitude",
 alias: "lattitude",
 type: "string"
 }), new Field ({
 name: "time",
 alias: "time",
 type: "date"
 })
 ];

 const data = new FeatureLayer({

 source: response,
 definitionExpression:"site_code = '" + site_uuid + "'",
 title: "_", 
 fields: fields,
 popupTemplate: template,
 timeInfo: {
 startField: "time",

 interval: { 
 unit: "years",
 value: 1
 }


 },

 renderer: {
 type: "unique-value", 
 field: "type_data",
 uniqueValueInfos: [{

 value: "Unknown",
 label:"&amp;lt;?=__('Unknown');?&amp;gt;",
 symbol: {
 type: "simple-marker", 
 color: "purple",
 size: 6,
 outline: { 
 width: 0.5,
 color: "white"
 }
 }
 }, {

 value: "Information not recorded",
 label: "&amp;lt;?=__('Information not recorded');?&amp;gt;",
 symbol: {
 type: "simple-marker", 
 color: "orange",
 size: 6,
 outline: { 
 width: 0.5,
 color: "white"
 }
 }
 },
 {
 value: "Other",
 label: "&amp;lt;?=__('Other');?&amp;gt;",
 symbol: {
 type: "simple-marker", 
 color: "blue",
 size: 6,
 outline: { 
 width: 0.5,
 color: "white"
 }
 }
 }],
 legendOptions : {
 title: "&amp;lt;?=__('Legend');?&amp;gt;"
}

 } 

}
);
legend.layerInfos = [{
 layer: data,
 title: "&amp;lt;?=__('Legend');?&amp;gt;"
 }];


 view.ui.add(timeSlider, "manual");

 map.add(data);

 view.whenLayerView(data).then(function(lv) {

 layerView = lv; 

 const fullTimeExtent = data.timeInfo.fullTimeExtent;

 // set up time slider properties
 // timeSlider.fullTimeExtent = fullTimeExtent;
 const start = data.timeInfo.fullTimeExtent.start;
 const end = data.timeInfo.fullTimeExtent.end;

 const yr_start = new Date(start); 
 var yr_year = yr_start.getFullYear();
 var yr_month = yr_start.getMonth();
 var yr_day = yr_start.getDay();
 var start_yr = new Date(yr_year, 0,1);


 const d_start = new Date(start); 
 var year = d_start.getFullYear();
 var month = d_start.getMonth();
 var day = d_start.getDate();
 var next_yr = new Date(year + 1, month, day);

 const d_end = new Date(end); 
 var year = d_end.getFullYear();
 var month = d_end.getMonth();
 var day = d_end.getDay();
 var next_yr_end = new Date(year + 1, month, day);

 timeSlider.fullTimeExtent = {
 start: start_yr,
 end: next_yr_end
 };
 timeSlider.stops = {
 interval: data.timeInfo.interval
 };

 timeSlider.values = [start,next_yr];


 });








});





}
&lt;/SPAN&gt;&lt;SPAN class="" style="color: var(--blue-800); border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:09:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729676#M67685</guid>
      <dc:creator>IanMagero</dc:creator>
      <dc:date>2021-12-12T07:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript - Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729677#M67686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like you are creating the feature layer from clientside&amp;nbsp;features.&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#timeInfo" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#timeInfo"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#timeInfo&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;The&amp;nbsp;&lt;EM&gt;timeInfo&lt;/EM&gt;&amp;nbsp;property, along with its&amp;nbsp;&lt;EM&gt;startField&lt;/EM&gt;&amp;nbsp;&lt;STRONG&gt;and&lt;/STRONG&gt;&amp;nbsp;&lt;EM&gt;endField&lt;/EM&gt;&amp;nbsp;properties, must be set at the time of layer initialization if it is being set for a&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html"&gt;GeoJSONLayer&lt;/A&gt;,&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html"&gt;CSVLayer&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html"&gt;FeatureLayer&lt;/A&gt;&amp;nbsp;initialized from&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#creating-a-featurelayer"&gt;client-side features&lt;/A&gt;.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2020 12:59:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729677#M67686</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-03-10T12:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript - Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729678#M67687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have set the endField property but the problem still persists&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2020 05:29:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-feature-layer/m-p/729678#M67687</guid>
      <dc:creator>IanMagero</dc:creator>
      <dc:date>2020-03-11T05:29:40Z</dc:date>
    </item>
  </channel>
</rss>

