Chinese TileLayer.Provider

This topic contains 3 replies, has 3 voices, and was last updated by  Stiofan O’Connor 5 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #488816

    Paul Ist
    Free User
    Post count: 2

    Hi!
    How can I add a new Tile Provider to the map?
    OSM doesn’t provide a very detailed map for the region where I live in China. I found some interesting examples for Chinese Providers here and I was wondering what would be the best way to implement it: https://github.com/htoooth/Leaflet.ChineseTmsProviders

    
    L.TileLayer.ChinaProvider = L.TileLayer.extend({
    
        initialize: function(type, options) { // (type, Object)
            var providers = L.TileLayer.ChinaProvider.providers;
    
            var parts = type.split('.');
    
            var providerName = parts[0];
            var mapName = parts[1];
            var mapType = parts[2];
    
            var url = providers[providerName][mapName][mapType];
            options.subdomains = providers[providerName].Subdomains;
            options.key = options.key || providers[providerName].key;
            L.TileLayer.prototype.initialize.call(this, url, options);
        }
    });
    
    L.TileLayer.ChinaProvider.providers = {
        TianDiTu: {
            Normal: {
                Map: "http://t{s}.tianditu.com/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}",
                Annotion: "http://t{s}.tianditu.com/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}"
            },
            Satellite: {
                Map: "http://t{s}.tianditu.com/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk={key}",
                Annotion: "http://t{s}.tianditu.com/DataServer?T=cia_w&X={x}&Y={y}&L={z}&tk={key}"
            },
            Terrain: {
                Map: "http://t{s}.tianditu.com/DataServer?T=ter_w&X={x}&Y={y}&L={z}&tk={key}",
                Annotion: "http://t{s}.tianditu.com/DataServer?T=cta_w&X={x}&Y={y}&L={z}&tk={key}"
            },
            Subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
            key: "174705aebfe31b79b3587279e211cb9a"
        },
    
        GaoDe: {
            Normal: {
                Map: 'http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}'
            },
            Satellite: {
                Map: 'http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
                Annotion: 'http://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}'
            },
            Subdomains: ["1", "2", "3", "4"]
        },
    
        Google: {
            Normal: {
                Map: "http://www.google.cn/maps/vt?lyrs=m@189&gl=cn&x={x}&y={y}&z={z}"
            },
            Satellite: {
                Map: "http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}"
            },
            Subdomains: []
        },
    
        Geoq: {
            Normal: {
                Map: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}",
                PurplishBlue: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",
                Gray: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}",
                Warm: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}",
            },
            Theme: {
                Hydro: "http://thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}"
            },
            Subdomains: []
        },
    
        OSM: {
            Normal: {
                Map: "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
            },
            Subdomains: ['a', 'b', 'c']
        }
    
    };
    
    L.tileLayer.chinaProvider = function(type, options) {
        return new L.TileLayer.ChinaProvider(type, options);
    };
    
    #489214

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Paul,

    Thanks for the post, i have added a task for this to be looked at, we will update you here once we have had a look.

    Thanks,

    Stiofan

    #489422

    Kiran
    Moderator
    Post count: 7069

    Hi Paul,

    This has been implemented and it will be in next release of Map Styles plugin.

    Kiran

    #489445

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    This has been released now and is an option in this addon https://wpgeodirectory.com/downloads/custom-google-maps/

    Thanks,

    Stiofan

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount