pelicanmapping / rocky

3D Geospatial SDK (C++17 / Vulkan / VSG)
MIT License
91 stars 15 forks source link

Fall back to lower LOD levels in assembleImage #41

Closed AnyOldName3 closed 3 months ago

AnyOldName3 commented 3 months ago

When the imagery and map tiles are using a different profile to the tile key, they'll need reprojecting, and if any image is unavailable, it can affect several tiles. That also means there can be tiles which are partially covered by tiles at a particular LOD level.

Without this change, only one LOD level is tried, and if a tile is partially covered, it'll get used, but leave gaps in the map. With this change, those gaps will be filled with lower-quality imagery from other LOD levels.

Before

image

After

image

To reproduce the problem, you can use this map (which was originally a .earth file):

{
    "layers": [
        {
            "name": "ReadyMap 15m Imagery",
            "type": "TMSImage",
            "uri": "http://readymap.org/readymap/tiles/1.0.0/7/"
        },
        {
            "name": "ReadyMap 90m Elevation",
            "type": "TMSElevation",
            "uri": "http://readymap.org/readymap/tiles/1.0.0/116/",
            "vdatum": "egm96"
        },
        {
            "time": "1.5",
            "type": "xi:include",
            "viewpoint": {}
        }
    ],
    "options": {
        "cache": {},
        "profile": {}
    },
    "profile": {
        "extent": {
            "srs": "+proj=utm +zone=30 +datum=WGS84 +units=m +no_defs",
            "xmax": 750000.0,
            "xmin": 650000.0,
            "ymax": 4400000.0,
            "ymin": 4300000.0
        },
        "tx": 1,
        "ty": 1
    }
}
gwaldron commented 3 months ago

Thanks. I'll merge this for now, since it solves the problem.

However it looks like it has the potential to create a LOT of image tiles that are not used. Do you agree? Caching, or a global LUT, are both planned items that would help with this down the road. Another solution would be to load ancestor tiles on-demand then a pixel's data isn't available in any of the sources.

AnyOldName3 commented 3 months ago

Yeah, that sounds about right. All of those suggested improvements would be good things.