Layer creation (WMS/TMS/WMTS/Custom)
- Creating a WMS layer type
var layer1 = new longdo.Layer('bluemarble_terrain', { type: longdo.LayerType.WMS, url: 'https://ms.longdo.com/mapproxy/service', zoomRange: { min: 1, max: 9 }, refresh: 180, opacity: 0.5, weight: 10 });
Example - Creating a TMS layer type
var layer2 = new longdo.Layer('', { type: longdo.LayerType.TMS, url: 'https://ms.longdo.com/mapproxy/tms/1.0.0/bluemarble_terrain/EPSG3857', bound: { minLon: 100.122195, minLat: 14.249463, maxLon: 100.533496, maxLat: 14.480279 } });
noteUsing TMS layer provided by GeoServer, an option zoomOffset: 0 , for the API can retrieve tiles using the same zoom level as Longdo MapExample - Creating a WMTS layer type
var layer3 = new longdo.Layer('bluemarble_terrain', { type: longdo.LayerType.WMTS_REST, url: 'https://ms.longdo.com/mapproxy/wmts', srs: 'GLOBAL_WEBMERCATOR', });
Example - Creating a custom layer type
var layer4 = new longdo.Layer('test', { type: longdo.LayerType.Custom, url: function(projection, tile, zoom, hd) { var resolution = 1 << zoom; return 'https://ms.longdo.com/mmmap/img.php?key=demokeyfortestingonly&c=1&proj=' + projection.longdoName + '&mode=thaichote&res=' + resolution + '&imgid=' + (((tile.v * resolution) + tile.u) * 53 * 73 * 238681) }, zoomRange: { min: 9, max: 16 }, refresh: 180 });
Example- name: Name of layer
- type: Type of layer
- url: Image server URL or function
- projection: Initial projection (Default: EPSG3857)
- tile: Tile
- zoom: Initial zoom
- hd: High density display (0 or 1)
- zoomRange: Zoom range
- refresh: Refresh interval in second
- opacity: Layer opacity (range 0-1)
- weight: Weight, lighter will float, heavier will sink
- bound: Only tile in this bounding box will be shown
- format: MIME type
- WMS : 'image/jpeg'
- TMS and WMTS_REST : 'jpeg'