阅读:1821回复:2
如何用polygon选择RasterLayer里面的栅格
<P>现在用户在地图上画一个的polygon,如何根据这个polygon把它所intersect的栅格图层的Pattern选出来?就像选择矢量图层那样。</P>
<P>谢谢</P> |
|
1楼#
发布于:2006-07-31 10:45
<TABLE>
<TR> <TD class=postvalue> <P>下面的是用点查询cell </P> <P>The code below shows how to get the X, Y cell sizes and the unit name from the spatial reference. <BR><BR>It works on the selected raster in the Table of Contents. </P></TD></TR> <TR> <TH> </TH> <TD><PRE>Public Sub GetRasterInfo() Dim pMxDoc As IMxDocument Dim pCurrentLayer As ILayer Dim pRasLyr As IRasterLayer Dim pRasProps As IRasterProps Dim pCellSize As IPnt Dim pSpatRef As ISpatialReference Set pMxDoc = Application.Document Set pCurrentLayer = pMxDoc.SelectedLayer Set pRasLyr = pCurrentLayer Set pRasProps = pRasLyr.Raster Set pCellSize = pRasProps.MeanCellSize Set pSpatRef = pRasProps.SpatialReference MsgBox "mean cellsize X : " ; pCellSize.x ; vbCrLf ; _ "mean cellsize Y : " ; pCellSize.y If pSpatRef Is Nothing Then MsgBox "No Spatial Reference" Exit Sub ElseIf TypeOf pSpatRef Is IProjectedCoordinateSystem Then Dim pProjCoordSys As IProjectedCoordinateSystem Dim pLinearUnit As ILinearUnit Set pProjCoordSys = pSpatRef Set pLinearUnit = pProjCoordSys.CoordinateUnit MsgBox pLinearUnit.Name ElseIf TypeOf pSpatRef Is IGeographicCoordinateSystem Then Dim pGeogCoordSys As IGeographicCoordinateSystem Dim pAngularUnit As IAngularUnit Set pGeogCoordSys = pSpatRef Set pAngularUnit = pGeogCoordSys.CoordinateUnit MsgBox pAngularUnit.Name Else MsgBox "Unknown coordinate system" End If End Sub </PRE> </TD></TR></TABLE> |
|
|
2楼#
发布于:2006-08-02 23:15
<P>谢谢楼上的回复。</P>
<P>但是好像和我要的不一样。我想要的不仅仅是被Polygon覆盖住的cells,而且包括那些被盖住一部分的raster polygons。 -》 Intersect</P> |
|