Select to view content in your preferred language

FeatureRequestMode.ManualCache

488
7
Jump to solution
08-13-2024 03:31 PM
AdrianaPaese
Frequent Contributor

Hello,

I would like to be able to estimate the cost of caching the full extent of a Feature Layer hosted in the ArcGIS Location Platform when setting "FeatureRequestMode.ManualCache".

I am assuming that when using "FeatureRequestMode.ManualCache", after the layer is  cached, queries are local.

Since the  "FeatureRequestMode.ManualCache" is different from an offline workflow, when are queries to the server actually happening? When we firstly install the app and access ArcGISMap and its operational layers? When there is a configuration change? When the app recomposes?

And also, are the populateFromService parameters bin the code below correct?

 

Thank you very much in advance,

Adriana

val crimeFeatureTableQueryParams = QueryParameters().apply {
whereClause = ("TODOS_2022_2024 >= 3")
}

val outFieldsCrimeFeatureTable = listOf<String>("TODOS_2022_2024")

private val crimeFeatureTable: ServiceFeatureTable by lazy {
ServiceFeatureTable("https://services3.arcgis.com/GDuXULnKsYkc979b/arcgis/rest/services/crimes_Osasco_dev_site_view/Featu...").apply {

featureRequestMode = FeatureRequestMode.ManualCache
viewModelScope.launch {
populateFromService(
    crimeFeatureTableQueryParams,
    false,
   outFieldsCrimeFeatureTable
)
}
}
}

 

0 Kudos
1 Solution

Accepted Solutions
RamaChintapalli
Esri Contributor

>What about when the user closes the app and open it again in a later time?

When user closes app and opens, its a completely new instance of FeatureLayer and FeatureTable. So when the viewmodel is initiated and populateFromService is called, it fetches them from the service again. 

Rama

View solution in original post

0 Kudos
7 Replies
RamaChintapalli
Esri Contributor

Hi,

As mentioned in the API ref doc here , in this mode the queries to the service are made only when there is an explicit call to the method populateFromService. Rest of the queries happen on the local cache only. Your usage of populateFromService looks fine.

Thanks
Rama

AdrianaPaese
Frequent Contributor

Thank you very much. The populateFromService is in a ViewModel.

I understand that the ViewModel survives configuration changes. What about when the user closes the app and open it again in a later time?

Thank you immensely,

Adriana

0 Kudos
AdrianaPaese
Frequent Contributor

I mean, considering that the method is in a ViewModel (the same where the FeatureLayer and ArcGISMap are declared, when the user closes the app and opens it again will there be an explicit call to the  populateFromService

0 Kudos
RamaChintapalli
Esri Contributor

I have to see your code for that to know if populateFromService is being called or not. If you seeing features on the map after you close and open the map again, that would suggest that the call has been triggered. If not, you should not see any feature layer rendered in ManualCache mode.

0 Kudos
RamaChintapalli
Esri Contributor

>What about when the user closes the app and open it again in a later time?

When user closes app and opens, its a completely new instance of FeatureLayer and FeatureTable. So when the viewmodel is initiated and populateFromService is called, it fetches them from the service again. 

Rama

0 Kudos
AdrianaPaese
Frequent Contributor

Thank you Rama

I have watched your video from the Dev Summit 

ArcGIS Maps SDK for Kotlin: An Introduction

Based on it I am using the Composable MapView function

with the

arcGISMap = mapViewModel.arcGISMap
 
parameter.
 
 
My question: is this declaration of the ArcGISMap in the ViewModel enough to hold the arcGISMap state as the user pans, or zooms or when the app reconfigures?
 I just wanted to understand how the arcGISMap state is being held.
 
Thank you very much,
Adriana
0 Kudos
RamaChintapalli
Esri Contributor

My question: is this declaration of the ArcGISMap in the ViewModel enough to hold the arcGISMap state as the user pans, or zooms or when the app reconfigures?

Any compose state variable can be declared in the compose function itself or hoisted to another viewmodel. Either way the state is managed.

You still need to pass the compose state variable to the Mapview compose function.

Thanks
Rama

0 Kudos