Git Product home page Git Product logo

mapcache's People

Contributors

arnissolle avatar camdeardorff avatar dhritzkiv avatar hvbommel avatar kkieffer avatar merlos avatar nickatgit avatar quinncnl avatar vincentneo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mapcache's Issues

Use Round Robin algorithm instead of random distribution

Current implementation requests tiles in a uniform random way. Each tile server has the same probability of being requested, however because of the randomness this can make that a server is hit 5 times in a row whereas the others are idle.

In order to improve this some kind of round robin strategy can be applied. We assume all servers are equally efficient and the requests are divided in sequence. With round robin the requests for a 3 subdomain server (a,b,c) the sequence of requests would be to the servers a, b, c, a, b, c, a, b, c, a, b, c, a, b, c...

Consistent direct access to sizes in MapCache

In 0.6.0 in order to access file and allocated disk sizes:

...
cache: MapCache 
...
print(cache.diskCache.fileSize)
print(cache.calculateDiskSize())

it should be something like

cache.fileSize
cache.diskSize

Add more notifications to region download delegate

Right now when a region is downloaded the delegate is notified whenever a certain percentages are achieved depending on the value of (incrementInPercentageNotification) however there are other notifications that may be interesting:

  • Each time a tile is downloaded
  • Each time there is an error to download a tile
  • Whenever the download starts

When zooming, show previous over zoomed tile until tiles load

Hi @merlos. Thank you for the great library.

I have a couple of use cases where I want to show the previous overzoomed level while waiting for the next level to load.

First use case is to hide the loading of the tiles (prevent the gray boxes whilst the tile is loading).

Second use case is to show an overzoomed tile when a 404 is returned for that zoom level (due to the map server not having a full tile set at that zoom).

Any tips as to how this could be implemented in your code base?

I'd be happy to do the work if you can point me in the correct direction.

Retina tiles are not used as they are with the native renderer

Hi,

I tried to integrate this library in my project. It uses OpenRailwayMap tiles, which are 512x512 retina png tiles (e.g. https://a.tiles.openrailwaymap.org/standard/8/137/85.png). If I use the native MKTileOverlay (first example) it uses the full available resolution on a retina display, resulting in a sharp image with more details. If I use the MapCache overlay (second example), the tiles are blurry and have way less details. I assume something in the zoom height configuration on retina displays is wrong here, but I couldn't figure out what exactly.
Maybe @merlos you can take a look what could be the problem here?

If it helps, I can provide the code I used to achieve both outcomes.

Thanks!

Example 1
Example 2

Some of the Disk Cache tests pass randomly

When running the tests of DiscCacheSpecs, sometimes they give error and other passes.

Initially, this seems a bad implementation of the tests and fail due to asynchronous runs.

Build pipelines sometimes fail to pass tests

Whereas in my dev environment unit testing works in build pipelines in github and in travisCI fail most of the time.

Primarily these are the expectations that do not work most of the time

✗ a_DiskCache__can_find_a_file_that_is_in_the_cache, expected to equal <4096>, got <8192>
✗ a_DiskCache__can_remove_the_file_from_the_cache, expected to eventually equal <4096>, got <8192>
✗ a_DiskCache__can_remove_the_file_from_the_cache, expected to eventually equal <0>, got <4096>

MapCache_Tests.DiskCacheSpecs

a_DiskCache__can_find_a_file_that_is_in_the_cache, expected to equal <4096>, got <8192>

/Users/travis/build/merlos/MapCache/Example/Tests/DiskCache/DiskCacheSpecs.swift:111

              diskCache.setDataSync(data1!, forKey: filename1)
              expect(diskCache.diskSize).to(equal(4096))

a_DiskCache__can_remove_the_file_from_the_cache, expected to eventually equal <4096>, got <8192>

/Users/travis/build/merlos/MapCache/Example/Tests/DiskCache/DiskCacheSpecs.swift:151

         diskCache.setDataSync(data1!, forKey: filename1)
         expect(diskCache.diskSize).toEventually(equal(4096))
          // remove the file

a_DiskCache__can_remove_the_file_from_the_cache, expected to eventually equal <0>, got <4096>
/Users/travis/build/merlos/MapCache/Example/Tests/DiskCache/DiskCacheSpecs.swift:155

              expect(diskCache.diskSize).toEventually(equal(0))

Overzoom feature not working in 0.8.0

I just updated my pod spec to 0.8.0 to try out the new over zoom feature but it doesn't seem to be implemented. Looking at the code I don't see the "CachedTileOverlayZoomRenderer.swift" file in the Pod. Is it possible something didn't make it to the release?

[Serious bug] Constant memory increase until crash when cache reaches capacity

Hi @merlos ,

I encountered a crash with MapCache while testing my app.

Reproduction

  1. Make sure cache is at capacity (e.g. 100MB)
  2. Scroll the map constantly for 10 sec

Then controlCapacity function constantly delete files, which is expected. However, memory usage is growing quickly without pausing, eventually leading to a crash. It's easily reproducible.

Below is a screenshot.

Screenshot 2020-12-28 at 18 13 46

First peak did not lead to crash. It's because there are not enough new tiles flushing out old ones (i.e. did not scroll the map long enough). Second peak crashed.

Can't set cache region if zoom > 19

Setting MapCacheConfig.maximumZ greater than 19 is pretty much pointless as far as TileCoords are involved.

As TileCoords' validate method throws ZoomError.largerThan19, I can't really use the MapCache for higher zoom levels although they are supported by my tile server.

Serious issue in MapCache.swift

In the loadTile function, you are downloading tiles even if they are found in cache. result will be called twice.

You should put the downloading task in the fetChfailure block.

Skewed downloads if the map used for selecting the area does not use maximum lat range (-85.0511, 85.0511)

To reproduce:

  1. Create a controller with a MapView that uses Apple Maps. Use this map to select a region.

  2. Download a region with a MapCache that uses Open Street Maps (OSM) as tile Server.

  3. Create a second controller that displays another MapView but this time using MapCache with OSM as tile server. Use the same MapCache used for downloading the region (ie: same name).

You´ll see that the second map does not display the area selected in the controller of (1), the tiles downloaded were in a different location.

The problem is that whereas Apple Maps uses -90 to 90 as range in the latitude, OSM only uses -85.0511 to 85.0511, so the conversion coordinates to tiles does not work.

In the code, this conversion is done in TileCoords

Related with #5

Add expiration support for tiles

Right now the cache does not have an expiration date. If the tile is in the cache it will always return the same cached tile.

However, maps are not static and evolve with time, so the cache should provide expiration support.

Additionally, it should be possible to create custom expiration strategies.

Provide list of tiles that failed to be downloaded in RegionDownloader

If RegionDownloader fails to download a tile it just increments the counter that keeps track of the number of fail to download files, but that´s it.

There should be a list with the tiles that were not downloaded, so any kind of retry strategy can be done.

Additionally it would be nice to have some kind of retry support.

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.