
new sg.layers.WMSLayer(url, options)
Description
Create a WMSLayer object
Position
WMSLayer.js
Parameters
Parameter
|
Type
|
Description
|
url
|
String
|
Url of a WMS Service
|
options
|
Object
|
WMS Layer settings
set object
Name
|
Type
|
Description
|
resourceInfo
|
Object
|
WMS service info. If resourceInfo is not defined, then it will use proxy to parse WMS service capabilities.
|
visibleLayers
|
Array.<String>
|
Layer name array, which is used to indicate which layer(s) to be displayed.
|
|
Properties
Properties
|
Type
|
Description
|
spatialReference
|
sg.SpatialReference
|
layer coordinate system
|
Methods
Method
|
Type
|
Description
|
getImageUrl(extent, width, height)
|
extent:sg.geometry.Extent
width:Number
height:Number
Returns:Boolean
|
return the dynamic image at the specific layer extent and size
Name
|
Type
|
Description
|
extent
|
sg.geometry.Extent
|
The extent of the image
|
width
|
Number
|
The image width in pixel
|
height
|
Number
|
The image height in pixel
|
|
Example
<script type="text/javascript" src="scripts/WMSLayer.js"></script>
<script type="text/javascript" src="scripts/Request.js"></script>
var WMSLayer = null;
var CreateWMS = function () {
var layer1 = new sg.layers.WMSLayerInfo({
name: 'LUIMAP',
title: 'General map (no labels)'
});
var resourceInfo = {
version: "1.1.1",
layerInfos: [layer1]
};
var WMS = "http://maps.nlsc.gov.tw/S_Maps/wms";
WMSLayer = new sg.layers.WMSLayer(wms, {
resourceInfo: resourceInfo,
visibleLayers: ['LUIMAP']
});
WMSLayer.spatialReference = new sg.SpatialReference({
wkid: 4326
});
WMSLayer.imageFormat = "image/png";
WMSLayer.loadEffect = true;
}
|
|
See live example
©2015 Supergeo Technologies Inc.