4

I am currently working on a project where QGIS is used for creating and editing vector data and requires a Google or Bing aerial photo layer as a basemap. I can add Google satellite/Bing aerial photos as a base map layer using the OpenLayers plugin but I am looking for any solution that I can use to do this offline using local cached tiles.

  • 3
    This is a duplicate of another SO question (not on the GIS site): stackoverflow.com/questions/6109369/… And also, this very question goes against Google's Terms. Unless you are a Premier member, you're not allowed to cache tiles. – Vadim Oct 1 '13 at 19:11
  • 1
    It's worth noting that caching Google tiles is not against the T&C. What is against the rules is pre-fetching (what the OP is actually asking). (See 10.1.3 Restrictions against Copying or Data Export.) – Dan Feb 5 '15 at 14:29
2

You can use the tilestache-seed.py script of the really good and light TileStache library. You could use TileCache also.

2

You can set up a local apache server, and change the target URLs in the openlayers plugin to http://localhost/path/to/your/tiles...

2

Caching Bing Maps tiles for offline use is against the terms of use of Bing Maps.

1

I found an explanatory doc and c# code here

https://msdn.microsoft.com/en-us/library/bb259689.aspx

written by Bing's software architect, Joe Schwartz.

I see (in 2017) browser requests like https://t1.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/03131020103313233?mkt=en-GB&it=A,G,RL&shading=hill&n=z&og=146&c4w=1

where '03131020103313233' is a quadtree-key ('quadkey'), deciphered as per the above link like this (c) microsoft 2017

/// <summary>
/// Converts a QuadKey into tile XY coordinates.
/// </summary>
/// <param name="quadKey">QuadKey of the tile.</param>
/// <param name="tileX">Output parameter receiving the tile X coordinate.</param>
/// <param name="tileY">Output parameter receiving the tile Y coordinate.</param>
/// <param name="levelOfDetail">Output parameter receiving the level of detail.</param>
public static void QuadKeyToTileXY(string quadKey, out int tileX, out int tileY, out int levelOfDetail)
{
    tileX = tileY = 0;
    levelOfDetail = quadKey.Length;
    for (int i = levelOfDetail; i > 0; i--)
    {
        int mask = 1 << (i - 1);
        switch (quadKey[levelOfDetail - i])
        {
            case '0':
                break;
            case '1':
                tileX |= mask;
                break;
            case '2':
                tileY |= mask;
                break;
            case '3':
                tileX |= mask;
                tileY |= mask;
                break;
            default:
                throw new ArgumentException("Invalid QuadKey digit sequence.");
        }
    }
}
-2

you can downlaod Google maps for offline use with GoogleMapsRipper from http://www.blueblackworks.com

There is Batch downlaod mode - to do massive download, if needed. Not sure how legal is all this, but is doable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.