mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
828 stars 254 forks source link

the effect is different in android and ios #1437

Closed zhujianyang closed 2 years ago

zhujianyang commented 3 years ago

In version 2.6.5, I set up baseURL with MaplyRemoteTileSource and quadImage with MaplyQuadImageTilesLayer

In version 3.2, I set up baseURL with MaplyRemoteTileInfoNew and quadImage with MaplyQuadImageLoader. Caching works, but not to the desired effect

The effect of 3.2 is the same as that of 2.6.5

The ios layer has been loaded in Asia, and when you go to Africa, there will be a blurred mask in Africa, and then the African layer will be loaded, and when you go back to Asia, there will be a blurred mask in Asia.

What I want is that when we go back to Asia, there's no ambiguity

Android version 3.2 won't have this effect

version 2.6.5 code: NSString cacheDir = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, true)[0]; MaplyRemoteTileSourcebase = [[MaplyRemoteTileSource alloc]initWithBaseURL:@"http://api.earthonline.com/wmts?SERVICE=WMTS&REQUEST=GetTile&Layer=GoogleEarthImage&TileMatrixSet=wholeworld_crs_3857&TileMatrix={z}&TileRow={y}&TileCol={x}" ext:@"" minZoom:0 maxZoom:6]; NSString thisCacheDir = [cacheDir stringByAppendingPathComponent:@"/img_wmy_app/"]; base.cacheDir = thisCacheDir; MaplyQuadImageTilesLayerbaseLayer = [[MaplyQuadImageTilesLayer alloc]initWithTileSource:base];

MaplyQuadImageTilesLayerbaseLayer = [[MaplyQuadImageTilesLayer alloc]initWithTileSource:base]; MaplyRemoteTileSource tiandi1 = [[MaplyRemoteTileSource alloc] initWithBaseURL:@"http://t0.tianditu.gov.cn/ibo_w/wmts?service=wmts&request=gettile&version=1.0.0&layer=ibo&format=tiles&tilematrixset=w&tk=26d74c176517d23f7b9f41c037d8b927&tilecol={x}&tilerow={y}&tilematrix={z}" ext:@"png" minZoom:0 maxZoom:6]; NSString tiandifirstCacheDir = [cacheDir stringByAppendingString:@"/ibo_wmy_app/"]; tiandi1.cacheDir = tiandifirstCacheDir; MaplyQuadImageTilesLayertiandi1layer = [[MaplyQuadImageTilesLayer alloc]initWithTileSource:tiandi1];

MaplyRemoteTileSource tiandi2 = [[MaplyRemoteTileSource alloc] initWithBaseURL:@"http://t0.tianditu.gov.cn/cia_w/wmts?service=wmts&request=gettile&version=1.0.0&layer=cia&format=tiles&tilematrixset=w&tk=26d74c176517d23f7b9f41c037d8b927&tilecol={x}&tilerow={y}&tilematrix={z}" ext:@"png" minZoom:0 maxZoom:6]; NSString tiandisecondCacheDir = [cacheDir stringByAppendingString:@"/cia_wmy_app/"]; tiandi2.cacheDir = tiandisecondCacheDir; MaplyQuadImageTilesLayer*tiandi2layer = [[MaplyQuadImageTilesLayer alloc]initWithTileSource:tiandi2];

[theViewC addLayer:baseLayer];
[theViewC addLayer:tiandi1layer];
[theViewC addLayer:tiandi2layer];
zhujianyang commented 3 years ago

version 3.2 code: NSString cacheDir = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, true)[0]; MaplyRemoteTileInfoNew tileInfo = [[MaplyRemoteTileInfoNew alloc] initWithBaseURL:@"http://api.earthonline.com/wmts?SERVICE=WMTS&REQUEST=GetTile&Layer=GoogleEarthImage&TileMatrixSet=wholeworld_crs_3857&TileMatrix={z}&TileRow={y}&TileCol={x}" minZoom:0 maxZoom:6]; NSString thisCacheDir = [cacheDir stringByAppendingString:@"/stamentiles/"]; tileInfo.cacheDir = thisCacheDir; MaplySamplingParams sampleParams = [[MaplySamplingParams alloc] init]; sampleParams.coordSys = [[MaplySphericalMercator alloc] initWebStandard]; sampleParams.coverPoles = true; sampleParams.edgeMatching = true; sampleParams.minZoom = 0; sampleParams.maxZoom = 6; sampleParams.singleLevel = YES; imageLoader = [[MaplyQuadImageLoader alloc] initWithParams:sampleParams tileInfo:tileInfo viewC:theViewC]; imageLoader.baseDrawPriority = kMaplyImageLayerDrawPriorityDefault;

MaplyRemoteTileInfoNew tileInfo2 = [[MaplyRemoteTileInfoNew alloc] initWithBaseURL:@"http://t0.tianditu.gov.cn/ibo_w/wmts?service=wmts&request=gettile&version=1.0.0&layer=ibo&format=tiles&tilematrixset=w&tk=26d74c176517d23f7b9f41c037d8b927&tilecol={x}&tilerow={y}&tilematrix={z}" minZoom:0 maxZoom:6]; NSString tileInfo2CacheDir = [cacheDir stringByAppendingString:@"/layer/"]; tileInfo2.cacheDir = tileInfo2CacheDir; secondImageLoader = [[MaplyQuadImageLoader alloc] initWithParams:sampleParams tileInfo:tileInfo2 viewC:theViewC]; secondImageLoader.baseDrawPriority = kMaplyImageLayerDrawPriorityDefault;

MaplyRemoteTileInfoNew tileInfo3 = [[MaplyRemoteTileInfoNew alloc] initWithBaseURL:@"http://t0.tianditu.gov.cn/cia_w/wmts?service=wmts&request=gettile&version=1.0.0&layer=cia&format=tiles&tilematrixset=w&tk=26d74c176517d23f7b9f41c037d8b927&tilecol={x}&tilerow={y}&tilematrix={z}" minZoom:0 maxZoom:6]; NSString tileInfo3CacheDir = [cacheDir stringByAppendingString:@"/country/"]; tileInfo3.cacheDir = tileInfo3CacheDir; threeImageLoader = [[MaplyQuadImageLoader alloc] initWithParams:sampleParams tileInfo:tileInfo3 viewC:theViewC]; threeImageLoader.baseDrawPriority = kMaplyImageLayerDrawPriorityDefault;

android code : val baseMapCacheDirName = "base_map" val baseMapCacheDir = File(activity?.cacheDir, baseMapCacheDirName) baseMapCacheDir.mkdir() var tileInfo = RemoteTileInfoNew("http://api.earthonline.com/wmts?SERVICE=WMTS&REQUEST=GetTile&Layer=GoogleEarthImage&TileMatrixSet=wholeworld_crs_3857&TileMatrix={z}&TileRow={y}&TileCol={x}", 0, 9) tileInfo.cacheDir = baseMapCacheDir

    val borderCacheDirName = "border"
    val borderCacheDir = File(activity?.cacheDir, borderCacheDirName)
    borderCacheDir.mkdir()
    var tileInfo2 = RemoteTileInfoNew("http://t0.tianditu.gov.cn/ibo_w/wmts?service=wmts&request=gettile&version=1.0.0&layer=ibo&format=tiles&tilematrixset=w&tk=26d74c176517d23f7b9f41c037d8b927&tilecol={x}&tilerow={y}&tilematrix={z}", 0, 9)
    tileInfo2.cacheDir = borderCacheDir

    val countryCacheDirName = "country"
    val countryCacheDir = File(activity?.cacheDir, countryCacheDirName)
    countryCacheDir.mkdir()
    var tileInfo3 = RemoteTileInfoNew("http://t0.tianditu.gov.cn/cia_w/wmts?service=wmts&request=gettile&version=1.0.0&layer=cia&format=tiles&tilematrixset=w&tk=26d74c176517d23f7b9f41c037d8b927&tilecol={x}&tilerow={y}&tilematrix={z}", 0, 9)
    tileInfo3.cacheDir = countryCacheDir

    var params = SamplingParams()
    params.coordSystem = SphericalMercatorCoordSystem()
    params.coverPoles = true
    params.edgeMatching = true
    params.singleLevel = true
    params.minZoom = 0
    params.maxZoom = 9
    val loader = QuadImageLoader(params, tileInfo, baseControl)
    val loader2 = QuadImageLoader(params, tileInfo2, baseControl)
    val loader3 = QuadImageLoader(params, tileInfo3, baseControl)

1281631179924_ pic 1311631179959_ pic_hd 1321631179976_ pic_hd

mousebird commented 3 years ago

Are you on support?

zhujianyang commented 3 years ago

yes。 I want to know what caused this effect Why have I loaded Asian data,when i go to africa ,then go back to asian。 Why do I need to refresh the data again

mousebird commented 3 years ago

I take that to mean you're not paying for support. This is a free toolkit and we only have a small amount of time for free support.

My suggestion is to look at the AutoTester app for the appropriate platform and try to duplicate the problem in one of those test layers. GeographyClass or Stamen might work. If the problem occurs in those layers, then we may be able to take a look at it. If it doesn't, then it's something unique to your case.