VDS Technologies

 

MyMap.AddLayer(tbl, "ShapeField") has incorrect extent center

7/22/2014 2:47:57 PM
Total Posts 13

MyMap.AddLayer(tbl, "ShapeField") has incorrect extent center

dim tbl As new DataTable
'CODE TO CREATE FIELDS IN TABLE INCUDING 'ShapeField'

Dim NewLayer As ActualMap.Layer = ActualMap.Layer.Open(ShapeFileName)

'NewLayer extent:
'Bottom.MinValue -1.79769313486232E+308 Bottom.MaxValue 1.79769313486232E+308
'Top.MinValue -1.79769313486232E+308 Top.MaxValue 1.79769313486232E+308
'Left.MinValue -1.79769313486232E+308 Left.MaxValue 1.79769313486232E+308
'Right.MinValue -1.79769313486232E+308 Right.MaxValue 1.79769313486232E+308
'Center.X 1767041.9761231 Center.Y 636510.727557899

With NewLayer.Recordset
  .MoveFirst()
  While Not .EOF
    Dim R As DataRow
    R = tbl.NewRow
    R.Item("ShapeField") = .Shape.ShapeData
    R.Item("somefieldname") = somevalue
    tbl.Rows.Add(R)
    .MoveNext()
  End While
End With
NewLayer.Dispose()
NewLayer = Nothing

 

Dim layer As ActualMap.Layer = MyMap.AddLayer(tbl, "ShapeField")

'layer extent:
'Bottom.MinValue -1.79769313486232E+308 Bottom.MaxValue 1.79769313486232E+308
'Top.MinValue -1.79769313486232E+308 Top.MaxValue 1.79769313486232E+308
'Left.MinValue -1.79769313486232E+308 Left.MaxValue 1.79769313486232E+308
'Right.MinValue -1.79769313486232E+308 Right.MaxValue 1.79769313486232E+308
'Center.X NaN Center.Y NaN

** The layer.extent.Center.X and layer.extent.Center.X both return NaN

 

Is there a way to correct the extent?  It is currently readonly.

 

 

 

 

7/23/2014 1:13:06 AM
MVP
Total Posts 323

Re: MyMap.AddLayer(tbl, "ShapeField") has incorrect extent center

The Layer.Extent is read-only because it is a sum of the extents of all shapes in the layer. To correct the Layer.Extent, the shapes in the layer should be corrected. Currently this is possible for database layers that derived from the SpatialDatabaseLayer abstract class, and for the DynamicLayer class.
If you need to set a default extent of the Map, use the Map.FullExtent property.

7/23/2014 8:33:12 AM
Total Posts 13

Re: MyMap.AddLayer(tbl, "ShapeField") has incorrect extent center

The other layer extent properties appear to be calculated correctly.

Why does the layer.extent.Center.X and layer.extent.Center.X both return NaN?

7/23/2014 8:52:48 AM
MVP
Total Posts 323

Re: MyMap.AddLayer(tbl, "ShapeField") has incorrect extent center

Please provide the real Left/Right/... etc. values of the extent (not Bottom.MinValue, which is the constant field of the Double type).