Giter VIP home page Giter VIP logo

Comments (18)

nixta avatar nixta commented on May 27, 2024

Hi @ikbalyasar. Thanks for the question.

Just to clarify, are you updating the style, or the map data?

Regardless, if you're working with a downloaded tile cache and resource set, it's up to you to pull a fresh set down.

In the case of the tile cache, we don't support downloading just the updated tiles - you would have to generate and download the cache again.

If you are just interested in an updated style, then you can call AGSExportVectorTilesTask.exportStyleResourceCacheJobWithDownloadDirectory(). The job that's returned will download the current styles. You would then have to re-add the vector tile layer to your map, specifying the tile cache you already had, with the new style resource set.

Does that help?

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

Hi,
I am add on my map.
url : .......rest/services/Hosted/MyMobil/VectorTileServer

myVectorLayer = AGSArcGISVectorTiledLayer(url: url!) 
self.mapView.map?.operationalLayers.add(myVectorLayer!)

I add and display the vector map as above.
After 1 hour, this map data is updated on the server again. The colors of the vector data have changed in the style file. But I still see the old colored data.
For example; I generate the traffic density data as a vector every 5 minutes. It creates different colors in every data I produce according to the traffic data density. But in my application it cannot see the current style file and continues to load from the cache. The data of 2 hours ago appears.

In short, I want to retake the style from the server and get the current style in every pan and zoom event. Like ESRI Dynamic Services.

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

Ok. I see.

This doesn't appear to have anything to do with the Samples app. Seems like a question that should really be asked over at the GeoNet Forum.

I'll close this issue so it doesn't interfere with other samples, but we can continue to discuss here if you like.

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

To clarify:

  • You are using AGSArcGISVectorTiledLayer to display a vector tile service found at .......rest/services/Hosted/MyMobil/VectorTileServer
  • You are updating the vector tile service every 1 hour.

I am not sure what you mean by The colors of the vector data have changed in the style file but I think you are conflating the tile cache with the style definition? That is, you keep the style file the same, but update the tile cache data?

In short, I want to retake the style from the server and get the current style in every pan and zoom event. Like ESRI Dynamic Services.

I think you want to get the latest data, right? Not sure why you would update the style.

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

Hi;
Update style my reason is that each geometry is obvious in the color type style.

I read this style : VectorTileServer/resources/styles/root.json

[https://pasteboard.co/JiSFStK.png]

As you can see in the picture, the line colors need to change as the traffic density changes, but it does not change in the mobile application even though it changes on the server. It keeps the cache in its old style data.
I also want to recolor according to this style file every time, not from the cache.

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

Does each street segment not have a traffic density attribute that is used by the style file to color the data?

Are you saying the content of that root.json file changes every hour?

If so, please can you share two copies of the different root.json files so I can understand?

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

To clarify my confusion: typically the style data would describe something like this:

  • Low density: Green line solid 2pt width
  • Medium density: Orange line solid 2pt width
  • High density: Red line solid 2.5pt width

And then the data in the tiles would have an attribute that says "Low density", "Medium density" or "High density" and the style rule above is applied at render time.

That way you never change the style, just the data (which is provided in the tile cache).

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

Ok. I share my root.json.
@nixta Did you get a look?

Although the "line-color" data changes on a server every 5 minutes, it does not change in the mobile application. It doesn't refresh the style. for example, it remains in the style color 3 hours ago.

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

@nixta hi,
I think .pbf files are cached. Do I have a chance to keep it updated every time?

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

Thanks for your patience, @ikbalyasar. I'm checking with the team and will get back to you.

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

So it looks like you'd have to create and add a new identical layer, and remove the old layer to force the pbfs to be downloaded again. We'll look into providing an API to give more explicit control over this in the future.

You could try calling clone() copy() on the existing layer to create the new one.

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

@nixta Thank you for the answer.

Do you have the opportunity to share sample code?

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

Something like this should work:

if let currentVectorLayer = myVectorLayer,
    let newVectorLayer = currentVectorLayer.copy() as? AGSArcGISVectorTiledLayer,
    let index = self.mapView.map?.operationalLayers.index(of: currentVectorLayer) {
    self.mapView.map?.operationalLayers.insert(newVectorLayer, at: index)
    self.mapView.map?.operationalLayers.remove(currentVectorLayer)
}

In this case I am copying the layer you already have, finding out where that is in the layer order, adding the copy of the layer into the layer order at the appropriate point, and then removing the old layer.

The new layer should request the latest pbfs, regardless of what the old layer was storing.

If for some reason that doesn't work quite as expected, just create the new layer from the URL as you did the original.

Let me know how that works.

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

I suppose this could also work and is more succinct - I've never used the replace method on an array but it should work nicely:

if let currentVectorLayer = myVectorLayer,
    let newVectorLayer = currentVectorLayer.copy() as? AGSArcGISVectorTiledLayer,
    let index = self.mapView.map?.operationalLayers.index(of: currentVectorLayer) {
    self.mapView.map?.operationalLayers.replaceObject(at: index, with: newVectorLayer)
}

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

Hi;
The problem is not actually adding and deleting.
Sample;
I create vectorTile and add my map;

let url = URL (string: Constants.MapUrl.trafficVectorTile.rawValue)
trafficLayer = AGSArcGISVectorTiledLayer (url: url!)
Is self.mapview.map?.operationallayers.add(trafficLayer)

Then when I listen to the network connection;

https: //mylink/VectorTileServer/tile/8/96/149.pbf -2.9Kb
https: //mylink/VectorTileServer/tile/8/96/150.pbf -3.7Kb
https: //mylink/VectorTileServer/tile/8/96/151.pbf -from disk cashe
https: //mylink/VectorTileServer/tile/8/96/152.pbf -from disk cashe

I cannot catch the change because the data it pulled from the cache came before.

My wish is to get the data from the server on every request. I don't want the cache to read.

I share a sample screenshot from the web js page;
https://pasteboard.co/JjO7nfl.png

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

What is that screenshot from?

You cannot control the internal cache of the AGSArcGISVectorTileLayer, so if you want to force fresh tiles to be loaded, you need to create a new instance of the layer which has an empty cache and display that.

If you want to do that every time you zoom or pan the map, that could be messy, but you had said you wanted to do this every 5 minutes.

But if the above screenshot is showing iOS system level caching, you could try this:

myVectorLayer = AGSArcGISVectorTiledLayer(url: url!) 
if let rc = AGSRequestConfiguration.global().copy() as? AGSRequestConfiguration {
    rc.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData
    rc.shouldCacheResponse = false
    myVectorLayer?.requestConfiguration = rc
}
self.mapView.map?.operationalLayers.add(myVectorLayer!)

That won't do anything to clear out the layer's own internal cache, but if your screenshot is showing system-level caching, that should help.

from arcgis-runtime-samples-ios.

ikbalyasar avatar ikbalyasar commented on May 27, 2024

@nixta
Thank you very much.

It worked very well.

I couldn't find this part.

AGSRequestconfiguration.global()

İt's clear cashe this code.
.reloadIgnoringLocalAndRemoteCacheData

Thanks.

from arcgis-runtime-samples-ios.

nixta avatar nixta commented on May 27, 2024

Great to hear!

Note there is the global AGSRequestConfiguration that affects everything in the app, and then you can override per service (which is what we did here). Any class that implements the AGSRemoteResource protocol will allow this.

from arcgis-runtime-samples-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.