Save google map for offline use

I am doing a project on a google map. My requirement is to keep the google map online and use it offline. In Ios, they used the GMSTileURLConstructor. In the same, is there a possibility of saving the card. If yes, can you provide me with any ideas or link.

    -(void)ViewOfflineMap
    {
          GMSTileURLConstructor urls = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {
               NSString *strMap=[NSString      stringWithFormat:@"http://mt0.google.com/vt/x=%ld&y=%ld&z=%ld",(long)x,(long)y,(long)zoom];
               return [NSURL URLWithString:strMap];
          };

    GMSURLTileLayer *layer=[GMSURLTileLayer tileLayerWithURLConstructor:urls];
    layer.zIndex=100;
    layer.map=mapView_;
    }

      

Thanks in advance.

+3


source to share


3 answers


I have one solution. We can save the map as tiles using the UrlTileProvider. It stores tiles of maps based on zoom level and x and y axis area on your screen.



TileProvider tileProvider = new UrlTileProvider(256, 256) {
    @Override
    public URL getTileUrl(int x, int y, int zoom) {

        String s = String.format(
                "http://my.image.server/images/%d%d%d.png", zoom, x, y);

        if (!checkTileExists(x, y, zoom)) {
            return null;
        }

        try {
            return new URL(s);
        } catch (MalformedURLException e) {
            throw new AssertionError(e);
        }
    }

    private boolean checkTileExists(int x, int y, int zoom) {
        int minZoom = 12;
        int maxZoom = 16;

        if ((zoom < minZoom || zoom > maxZoom)) {
            return false;
        }

        return true;

    }
};

tileOverlay = map.addTileOverlay(new TileOverlayOptions()
        .tileProvider(tileProvider));

      

+2


source


Google Maps already does this, what you see will be cached



0


source


From the Google Maps Terms of Service :

8.1 Definitions.

(b) " Content " means any content provided through the Service (whether created by Google or its third party licensors), including map and location data, photographs, traffic data, location data (including company listings) or any other content.

10.1.3 Restrictions on Exporting or Copying Data.

(b) No preloading, caching or storing content . You shouldn't prefetch, cache, or save any Content, except you can store: ...

... limited amounts of content to improve performance ...

To answer your question: no, you cannot save Google Maps data for offline use.

0


source







All Articles