I am trying to retrieve data from a Service so I can take my application offline. I have this working to some degree but confused on a few things.
Right now I am using the populateFromService Method to get my data and display it in the map.
ServiceFeatureTable QML Type | ArcGIS for Developers
This supposedly creates a local database and stores the data there?????
* I can view the datasets in my map
* I can select and return data from those locations
SO everything is great there......
Problems / Issues:
If I leave the page and then come back to it the data is gone. This requires me to sync back up with the data.
The problem is that if I am off grid I cannot do this.
Questions:
Where is this geodatabase being created?
Is it being deleted once I leave the page?
Is there a way to store it somewhere else?
Can I update the data in this database by re-syncing at another time?
Are there other options for reading and syncing the data from a service into 3 different feature classes/Tables?
Wants:
I would like this to be a permanent geodatabase on the users phone that gets updated via a button.
Is there a different import/sync procedure that is more permanent?
Currently I am doing this:
FeatureLayer <SPAN class="punctuation token">{</SPAN>
id<SPAN class="punctuation token">:</SPAN> featureLayerBoating
ServiceFeatureTable <SPAN class="punctuation token">{</SPAN>
id<SPAN class="punctuation token">:</SPAN> featureTable0
url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"https://vvvv.vvvv.vvvv.gov/arcgis/rest/services/Projects/vvvv/FeatureServer/2"</SPAN>
featureRequestMode<SPAN class="punctuation token">:</SPAN> Enums<SPAN class="punctuation token">.</SPAN>FeatureRequestModeManualCache
onPopulateFromServiceStatusChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>populateFromServiceStatus <SPAN class="operator token">===</SPAN> Enums<SPAN class="punctuation token">.</SPAN>TaskStatusCompleted<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>populateFromServiceResult<SPAN class="punctuation token">.</SPAN>iterator<SPAN class="punctuation token">.</SPAN>hasNext<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">var</SPAN> count <SPAN class="operator token">=</SPAN> populateFromServiceResult<SPAN class="punctuation token">.</SPAN>iterator<SPAN class="punctuation token">.</SPAN>features<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">;</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Retrieved %1 features"</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">arg</SPAN><SPAN class="punctuation token">(</SPAN>count<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
QueryParameters <SPAN class="punctuation token">{</SPAN>
id<SPAN class="punctuation token">:</SPAN> params
whereClause<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"1 = 1"</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="comment token">// SNIP</SPAN>
onClicked<SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>checked <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
featureTable0<SPAN class="punctuation token">.</SPAN><SPAN class="token function">populateFromService</SPAN><SPAN class="punctuation token">(</SPAN>params<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="keyword token">else</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>checked <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"false"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">{</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"error"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="comment token">// SNIP</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>