ThinkGeo.com    |     Documentation    |     Premium Support

What is the best way to draw pointshapes on a web map control in 3.0?

The following is my 2.5 code:

Private Sub AddPoint(ByVal strKey As String, ByVal lngX As Double, ByVal

lngY As Double, ByVal zoomLevel As ZoomLevel, ByVal gcColor As GeoColor)

        'Map1.MapShapes.Clear()

        Dim PointShape As New PointShape(lngX, lngY)

        Dim shape As PointMapShape = New PointMapShape(PointShape)



        shape.ZoomLevelExtentUnit = ZoomLevelExtentUnits.miles

        zoomLevel.GeoStyle = GeoPointStyles.GetSimpleCircleStyle(gcColor,

10, GeoColor.KnownColors.Black)

        shape.CustomZoomLevels.Add(zoomLevel)

        shape.Name = strKey



        shape.Dragable = False

        ' Add the PointMapShape to the map1.

        Map1.MapShapes.Add(shape)

    End Sub



Kevin, 
  
 We use InMemoryFeatureLayer in 3.0 instead of a MapShape in 2.x, here is the code for you, you can also have a look this sample which has a similar function: Samples\GettingStarted\PlotAPointUsingLatAndLong.aspx. 
  
  
Dim gcColor As GeoColor = GeoColor.StandardColors.Red
            Dim shapeLayer As New InMemoryFeatureLayer()
            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, gcColor, GeoColor.StandardColors.Black, 10)
            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
            Map1.DynamicOverlay.Layers.Add("sampleShapeLayer", shapeLayer)
 
            Dim lngX As Double = 10
            Dim lngY As Double = 10
            Dim PointShape As New PointShape(lngX, lngY)
            shapeLayer.InternalFeatures.Add(New Feature(PointShape))
 
   
 Thanks, 
  
 Ben 


Kevin, 
  
   Another option to what Ben mentioned is to take a look at this post in the Developer’s Blog.  It explains why we don’t have Map Shapes exactly the way we had them before.  It also has a class you can use of you want the old functionality.  I think we will be re-introducing them closer to what was in 2.x but it isn’t in the current release.  I think you will find the article and code helpful. 
  
 gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/16/aft/4921/afv/topic/Default.aspx 
  
 David