how to highlight select feature when add google map

11/10/2017 9:36:55 PM
Total Posts 3

how to highlight select feature when add google map

When i add google map select feature by search or map_InfoTool not highlight.

this is code.

Dim callout As Callout = map.Callouts.Add()
Dim center As AspMap.Point = rs.Shape.Centroid
callout.X = center.X
callout.Y = center.Y
callout.Text = rs("ID_NO") + Constants.vbLf + rs("NAME")
'map.Markers.Add(New Marker(rs.Shape.Centroid, rs("NAME").ToString()))
callout.Font.Size = 16

'map.Extent = rs.RecordExtent
'map.MapScale = 0.1
map.CenterAt(map.CoordinateSystem.FromWgs84(rs.RecordExtent.Center.X, rs.RecordExtent.Center.Y))
map.ZoomLevel = 16
curCenterX = rs.RecordExtent.Center.X
curCenterY = rs.RecordExtent.Center.Y
curZoomLevel = 16
' highlight the feature
map.MapShapes.Clear()
Dim ms As MapShape = map.MapShapes.Add(rs.Shape)
ms.Symbol.LineColor = Color.Red
ms.Symbol.FillColor = Color.Yellow
ms.Symbol.Size = 2

11/13/2017 9:41:54 AM
MVP
Total Posts 323

Re: how to highlight select feature when add google map

The coordinate of the centroid should be transformed to the map's coordinate system if Google Maps are used or if Map.CoorrdinateSystem has been set to a projectd coordinate system:

Dim center As AspMap.Point = map.CoordinateSystem.FromWgs84(rs.Shape.Centroid);

The code above is correct if the rs.Shape.Centroid is based on WGS 1984.

Otherwise, use the map.CoordinateSystem.Transform method.