在Google地图上将网格显示为军事地​​图样式

时间:2018-04-09 19:51:19

标签: java android google-maps

如何为地图制作军用风格的坐标网格? 我尝试使用GroundOverlayTileOverlay,但根据需要无效。

在每个缩放级别,网格必须保持相同的大小 我的网格屏幕:
My Grid screen

我希望网格在整个屏幕上并且只有一定的缩放

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

/* Define the URL pattern for the tile images */
        String s = String.format("https://psv4.userapi.com/c834603/u272826680/docs/d4/caeac8485541/grid.png",
                zoom, x, y);

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

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

    /*
     * Check that the tile server supports the requested x, y and zoom.
     * Complete this stub according to the tile range you support.
     * If you support a limited range of tiles at different zoom levels, then you
     * need to define the supported x, y range at each zoom level.
     */
    private boolean checkTileExists(int x, int y, int zoom) {
        int minZoom = 12;
        int maxZoom = 16;

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

        return true;
    }
};

0 个答案:

没有答案