POST
|
ESRI JavaScript API doesn't support setDefinitionExpression, if you create the StreamLayer w a FeatureCollection object. The setDefinitionExpression is applied server-side and not client-side, so no way of filtering the data. For any future issues w this, you'll have to add a filter of your own in the graphic-add event. This is from ESRI... streamLayer.on("graphic-add", function(evt){ var g = evt.graphic; if(g.attributes.RouteID < 50){ streamLayer.remove(g); } });
... View more
02-11-2016
09:40 AM
|
0
|
0
|
450
|
POST
|
Did you ever get this answered or working? I'm having the same problem and discovered that the DefinitionExpression works fine if the StreamLayer is created with an ESRI service URL, but if the StreamLayer is created using a FeatureCollection object... the setDefinitionExpression does not work and does not filter any of the data streaming thru. The definition expression does seem to be set now though.
... View more
02-10-2016
09:04 PM
|
0
|
0
|
450
|
POST
|
Finally!! Ok, I believe my issue was partially date issues with my dates being MST (new Date()).toLocaleString(); and not matching up with the map's TimeExtent of just new Date(). Plus, I had other features based on a different date field for historic uses that I'll have to figure out how to handle that. And mainly, that I wasn't updating the map's endTime for it's TimeExtent after each new breadcrumb add. I tried that before but didn't have my dates sorted out then. This is needed for sure: featureLayer.applyEdits([graphic], null, null, function (adds){ map.setTimeExtent(new TimeExtent(null, new Date()));}); This example does work in google Chrome on the iPhone, except this portion can be commented out for the timeInfo on the Feature Collection object: "timeExtent": [1277412330365], Geolocation with a temporal renderer | ArcGIS API for JavaScript Hopefully that helps someone else out with real-time data and the Temporal Renderer. Carisa
... View more
07-21-2015
10:05 AM
|
1
|
0
|
411
|
POST
|
Thanks, Tom! My historic version works w the same Feature Collection object, so I feel like it's something to do with the Map TimeExtent and that not working w a Feature Collection object... maybe or just not working w real live data in the present time. Or, some setting is off somewhere. Let me know if you find anything. Thanks!
... View more
07-17-2015
01:47 PM
|
0
|
0
|
411
|
POST
|
From here it states to set the extent start and end time the same for an instant in time. It's the current instant in time. TimeExtent (legacy) | API Reference | ArcGIS API for JavaScript and it states: If the startTime is null or undefined the start time is negative infinity. If the endTime is null or undefined the endTime is positive infinity. To represent an instant in time set the startTime and endTime to the same time value. So, I tried to set the map's time extent to start at the current time and then have an endTime of null and/or undefined, since I do want it open ended and that doesn't help either. If I set the startTime to 7 days prior and endTime 7 days into the future, I'll get the smaller circle symbols... otherwise, if the endTime is not set or is equal to the startTime, I'll get large circle symbols and they don't ever become small as time passes.
... View more
07-16-2015
06:42 PM
|
0
|
2
|
411
|
POST
|
I'm struggling to get the Temporal Renderer to work with real-time data. The renderer seems to work w my UniqueValueRenderer as the ObservationRenderer of the Temporal Renderer, but the Ager doesn't seem to work. I have been able to get the Temporal Renderer w the Ager working with historic data and a time slider, but w the real-time data it is not working. I must have some setting incorrect or something somewhere. I've tried to look on-line but haven't found much and a lot of the ESRI examples for real-time data are not working or there are no hurricanes or earthquakes occurring at this time. I'm using a Feature Collection Object to create my Feature Layer and I'm NOT using a TimeSlider, since this is real-time data. I believe or have read that if the start and endTime extent are set to the same time, then it should be set for a time instant which I have since data is added in real-time. Let me know if you see anything that I don't have set-up correctly. I have looked at the time formats as well for gps_time and all seems to be correct in this format: Thu Jul 16 2015 11:38:54 GMT-0600 (MDT) Thanks! - Carisa Some of the renderer code.. trying to keep it as simple as possible just to get this working for now: var simplerMarker = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,12,new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color("red"), 1), new Color("red")); var observationRend = new UniqueValueRenderer(simplerMarker,"group"); observationRend.addValue("SolidWaste",new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10,new SimpleLineSymbol(SimpleLineSymbol.STYLE_NULL),new Color([255, 153, 0]))); observationRend.addValue("StormSweeper",new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10,new SimpleLineSymbol(SimpleLineSymbol.STYLE_NULL),new Color([9, 112, 84]))); var infos = [ { minAge: 0, maxAge: 15, size: 15}, { minAge: 15, maxAge: 24, size: 11}, { minAge: 24, maxAge: Infinity, size: 6} ]; var observationAger = new TimeClassBreaksAger(infos, TimeClassBreaksAger.UNIT_SECONDS); rendererBC = new TemporalRenderer(observationRend,null,null,observationAger); Then I'll set the map's time extent since I'm not using a Time Slider: var timeExtent = new TimeExtent(); var now = new Date(); timeExtent.startTime = now; timeExtent.endTime = now; map.setTimeExtent(timeExtent); Feature Collection object set-up for the Feature Layer: //Create Feature Layer for Vehicles var featureCollection = { "layerDefinition": null, "featureSet": { "features": [], "geometryType": "esriGeometryPoint" } }; featureCollection.layerDefinition = { "geometryType": "esriGeometryPoint", "objectIdField": "OBJECTID", "timeInfo": { "startTimeField": "gps_date", "endTimeField": null, "trackIdField": "unit_id", "timeReference": "Mountain Standard Time", //do I need to set this? "timeInterval": 15, "timeExtent": ["2015/07/16 00:00:00 UTC", "2015/07/16 00:00:00 UTC"], "timeIntervalUnits": "esriTimeUnitsSeconds", "exportOptions": { "useTime": true, "timeDataCumulative": true, "timeOffset": null, "timeOffsetUnits": null }, }, "fields": [{ "name": "OBJECTID", "alias": "OBJECTID", "type": "esriFieldTypeOID" }, { "name": "unit_id", "alias": "unit_id", "type": "esriFieldTypeString" }, { "name": "gps_date", "alias": "gps_date", "type": "esriFieldTypeDate" }, {....etc. breadcrumbLayer = new FeatureLayer(featureCollection, { id: 'breadcrumb', mode: FeatureLayer.MODE_SNAPSHOT, trackIdField: "unit_id", outFields: ["*"] }); //render a particular time extent - do I need this?? var timeExtent = new TimeExtent(); timeExtent.startTime = new Date("07/16/2015 UTC"); timeExtent.endTime = new Date("07/16/2015 UTC"); breadcrumbLayer.setTimeDefinition(timeExtent);
... View more
07-16-2015
10:43 AM
|
0
|
5
|
3257
|
POST
|
Hi, Heiko! Do you have a better idea on how to extract the 'newest' graphic without looping thru all the graphics and finding the last one? If a user grabs data from the entire day, there can be more than 3k records. This slows down on each time-extent-change if I'm looping thru that many records just to find the latest record for each ID. My feature layer is created based on a feature collection object, so I'm unable to query the data based on the time field. - Carisa
... View more
05-06-2015
07:44 PM
|
2
|
0
|
441
|
POST
|
Thanks, Helko! The map time-extent-change event works yet if I slide the slider in reverse, I wouldn't get the updates to the table until I played the slider again. So, I was able to get it working, yet not sure if it's the most efficient. For the time-extent-change for the TimeSlider, I'm grabbing all the graphics that are visible with my feature layer and putting them into a key object based on my unique field... so the last one added to the object is the 'newest' graphic. Then update those graphic attributes in my table. Thanks for giving me the idea! - Carisa
... View more
12-11-2014
10:08 AM
|
0
|
0
|
441
|
POST
|
Is there a way to capture when the latestObservation graphic is updated by the TemporalRenderer? Using the TemporalRenderer with a FeatureLayer populated by a featureCollectionObject, can I capture the event when the latest graphic is updated on the map? I would like to update a table with that graphic's latest attributes. I can use the "graphic-draw" event, yet this only occurs if that graphic is visible in the current map extent and not all graphics that are being updated at that given time. Plus, the "graphic-draw" event captures my historic graphics as well as the latest graphic. The feature layer's "update-end" fires for each graphic also, yet how do you know which graphic was updated in that event? The "graphic-add" does not help either, since all my graphics are loaded to the map at one time and then displayed via the TemporalRenderer. Any ideas? Thanks!
... View more
12-09-2014
09:14 PM
|
1
|
3
|
3742
|
POST
|
Not sure if this would help with querying your StreamLayer data, but I did get a work around for StreamLayer from ESRI to be able to delete old features with the same TrackId. I'll attach their example.
... View more
05-08-2014
09:55 AM
|
0
|
0
|
291
|
POST
|
If you still haven't found a solution for this, I had the same issue and received a response back from ESRI with a work around until they incorporate the TrackId field to replace old messages coming thru the StreamLayer WebSocket. I'll attach their example.
... View more
05-08-2014
09:51 AM
|
0
|
0
|
153
|
POST
|
Did anyone ever figure anything out with this? I'm wanting to delete old features based on TrackId using the StreamLayer JavaScript API and without the ObjectId, I can not delete the old features. Any ideas?
... View more
05-07-2014
03:32 PM
|
0
|
0
|
291
|
IDEA
|
If you set the Feature Layer refreshInterval to less than a minute, your features flicker on the map. I realize they have to refresh, yet could there be a way to refresh the map using AJAX or something along those lines where the data does not flash at every instance of an update? Or, only update the features that have changed and not all the features in that layer? With the GeoEvent Processor and going more towards "Real-Time" data, customers what to see their features moving on the map almost simultaneously or very close to it. If I update the Feature Layer every 1 second, the data is constantly flashing on the map and doesn't look good. This is the same for the Refresh Interval on your Feature Layer in ArcGIS Online, if set to 0.1 minute and also with the JavaScript API. Here is the code for the JavaScript Web App that I was using: //geoEvent Feature Layer geoEventFeatureLayer = new FeatureLayer(geoEventFeatureService, { mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"], refreshInterval: 0.01667, //in minutes (1 sec) infoTemplate: infoTemplate });
... View more
03-05-2014
01:11 PM
|
13
|
0
|
1431
|
POST
|
Thanks, Artemis... I actually do have a need for the unique value renderer to use the function and base which icon I use on a different attribute field as well, possibly even a third attribute field. The example I gave you doesn't explain what I really want to do. I was trying to determine which image to use based on if the heading of a vehicle was > 180 or not (so the vehicle didn't look upside down on the map) and then also group by a vehicle grouping attribute. I realize I could put this all into a function and then display the results, yet many different variations could occur and could be a bit of a mess. I'll either go that route or change my vehicle image to the top view of the truck, so I can then just use the renderer.setRotationInfo() method instead of my own function. I told ESRI support to change their documentation saying if you use a function with the UniqueValueRenderer, you don't have the option to use the attributeField2 and attributeField3 options. To make things more clear. Thanks for the help! https://developers.arcgis.com/en/javascript/jsapi/uniquevaluerenderer-amd.html
... View more
01-08-2014
01:31 PM
|
0
|
0
|
404
|
POST
|
Let me know if I'm missing something here, but it seems to me that the JavaScript UniqueValueRenderer function option works fine if you just use one attributeField for your function, but if you have one function and another attributeField as an actual attributeField. The function no longer is called. Two attribute fields only work fine as well. I realize the first attributeField is the only one that appears to be open for the use of a function call and that is which field I'm using, yet also using attributeField2 as an attributeField from the Feature Class. Modifying ESRI's example doesn't seem to work either (modified code below to use UniqueValueRenderer & pick three values I know exist from their sample): Note: the code below works if I put in the values of "M163_07" instead of function calculateSquareMiles https://developers.arcgis.com/en/javascript/jssamples/renderer_function.html var map, calculateSquareMiles; require([ "esri/map", "esri/layers/FeatureLayer", "esri/InfoTemplate", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/renderers/UniqueValueRenderer", "esri/dijit/Legend", "dojo/_base/Color", "dojo/number", "dojo/domReady!" ], function( Map, FeatureLayer, InfoTemplate, SimpleFillSymbol, SimpleLineSymbol, UniqueValueRenderer, Legend, Color, number ) { map = new Map("map", { basemap: "gray", center: [-89.849, 40.369], zoom: 6 }); // convert acres to square miles // also used by the feature layer's info template // test for presence to a property named "attributes" to // determine whether or the "value" argument is a graphic or number calculateSquareMiles = function(value) { var acres = (value.hasOwnProperty("attributes")) ? value.attributes.M163_07 : value; return number.format(acres / 640, { places: 2 });; } var symbol = new SimpleFillSymbol("solid", null, null); var renderer = new UniqueValueRenderer(null, calculateSquareMiles, "STATE", null, ":"); //renderer.setMaxInclusive(true); var color1 = new Color([247, 252, 185]); // yellow var color2 = new Color([173, 221, 142]); // light green var color3 = new Color([49, 163, 84]); // green renderer.addValue("4.67:MO",new SimpleFillSymbol( //"2987:MO" "solid", new SimpleLineSymbol("solid", color1, 1), color1 )); renderer.addValue("39.83:MO",new SimpleFillSymbol( //"25491:MO" "solid", new SimpleLineSymbol("solid", color2, 1), color2 )); renderer.addValue("252.41:IA", new SimpleFillSymbol( //"161542:IA" "solid", new SimpleLineSymbol("solid", color3, 1), color3 )); layer.setRenderer(renderer); map.addLayers([layer]);
... View more
12-14-2013
12:20 PM
|
0
|
2
|
2980
|
Title | Kudos | Posted |
---|---|---|
1 | 07-21-2015 10:05 AM | |
13 | 03-05-2014 01:11 PM | |
1 | 12-09-2014 09:14 PM | |
2 | 05-06-2015 07:44 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|