Create  Edit  Diff  FrontPage  Index  Search  Changes  History  Source  RSS  wikifarm  Login

MapScript.Ja - layerObj.applySLD Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

!!layerObj.applySLD メソッド
!!!説明
このレイヤーにSLD(Styled Layer Descriptor)を適用する場合のSLDドキュメントと対象レイヤー名の設定。※SLD:ユーザーがスタイルを設定する機能
public int applySLD(
    string sld,
    string stylelayer
);

Public Function applySLD(ByVal sld As String, ByVal stylelayer As String) As Integer

!!!サンプル
!!!!コード
Dim _map As New mapObj("")
Dim _layer As New layerObj(_map)

_layer.name = "World"
_layer.connectiontype = MS_CONNECTION_TYPE.MS_WMS
_layer.connection = "http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/ms/openlayers.map&"
intRet = _layer.metadata.set("wms_name", "oldcity")
intRet = _layer.metadata.set("wms_srs", "EPSG:4326")
intRet = _layer.metadata.set("wms_server_version", "1.1.1")
intRet = _layer.metadata.set("wms_format", "image/png")

_sld = _layer.generateSLD()
_layer.applySLD(_sld, "World")

Debug.WriteLine(_sld)
→<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"></StyledLayerDescriptor>
!!!!マップファイル
""影響なし。この関数は、MapScript からWMSサーバーにリクエストするときに使用するため、マップファイルに書き込まれて制御するのではないため。
  LAYER
    CONNECTION "http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/ms/openlayers.map&"
    CONNECTIONTYPE WMS
      METADATA
        "wms_srs" "EPSG:4326"
        "wms_name" "oldcity"
        "wms_format" "image/png"
        "wms_server_version" "1.1.1"
      END
    NAME "World"
    PROJECTION
      "init=epsg:4326"
    END
    SIZEUNITS PIXELS
    STATUS ON
    TOLERANCEUNITS PIXELS
    UNITS METERS
    CLASS
      METADATA
      END
      STYLE
        ANGLE 360
        COLOR 200 200 200
        OUTLINECOLOR 100 100 100
        SYMBOL 0
      END
    END
  END
!!!参照
[[layerObj メンバ]] | [[(global) 名前空間|http://wiki.fdiary.net/MapScriptJa]]