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

MapScript.Ja - mapObj.queryByFeatures Diff

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

!!mapObj.queryByFeatures メソッド
!!!説明
他のポリゴンレイヤーから得られた結果に対する問い合わせを実行します。
queryは、対象のポリゴンとintersect(交差)もしくは、contained within(一部が含まれる)するポリゴンを抽出します

public int queryByFeatures(
    int slayer
);

Public Function queryByFeatures(ByVal slayer As Integer) As Integer
!!!サンプル
!!!!コード
Dim _map As New mapObj("")
Dim _layerq As New layerObj(_map)
Dim _classq As New classObj(_layerq)
Dim _styleq As New styleObj(_classq)
Dim _img As imageObj

With _layerq
     .setProjection("init=epsg:4326")
     .status = mapscript.MS_DEFAULT
     .name = "Query"
     .type = MS_LAYER_TYPE.MS_LAYER_POLYGON
     .data = "query_rectangle.shp"
     .template = "template.html"
End With
_styleq.outlinecolor = _outlinecolor
_styleq.color = _color
_layerq.queryByAttributes(_map, "ID", "0", mapscript.MS_MULTIPLE)

_map.queryByFeatures(1)
_img = _map.drawQuery()
""対象とするポリゴンレイヤーに対して事前に選択(query)をしておく必要があります
!!!!マップファイル
  LAYER
    DATA "countries_simpl"
    LABELITEM "NAME"
      METADATA
      END
    NAME "World"
    PROJECTION
      "init=epsg:4326"
    END
    SIZEUNITS PIXELS
    STATUS DEFAULT
    TEMPLATE "template.html"
    TOLERANCEUNITS PIXELS
    TYPE POLYGON
    UNITS METERS
    CLASS
      LABEL
        ANGLE 0.000000
        ANTIALIAS TRUE
        FONT "msgothic"
        MAXSIZE 256
        MINSIZE 4
        SIZE 12
        TYPE TRUETYPE
        BUFFER 0
        COLOR 0 0 0
        ENCODING "SJIS"
        FORCE FALSE
        MINDISTANCE 0
        MINFEATURESIZE -1
        OFFSET 0 0
        PARTIALS TRUE
        POSITION CL
      END
      METADATA
      END
      STYLE
        ANGLE 360
        COLOR 200 200 200
        OUTLINECOLOR 100 100 100
        SYMBOL 0
      END
    END
  END

  LAYER
    DATA "query_rectangle.shp"
      METADATA
      END
    NAME "Query"
    PROJECTION
      "init=epsg:4326"
    END
    SIZEUNITS PIXELS
    STATUS DEFAULT
    TEMPLATE "template.html"
    TOLERANCEUNITS PIXELS
    TYPE POLYGON
    UNITS METERS
    CLASS
      METADATA
      END
      STYLE
        ANGLE 360
        COLOR 200 200 200
        OUTLINECOLOR 100 100 100
        SYMBOL 0
      END
    END
  END
!!!参照

[[mapObj メンバ]] | [[(global) 名前空間|http://wiki.fdiary.net/MapScriptJa]]