Public Class HomeController Inherits System.Web.Mvc.Controller ' ' GET: /Home Function Index() As ActionResult Dim map As Map = New Map("Map1", New System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), New System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)) map.MapUnit = GeographyUnit.Meter map.CurrentExtent = New RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962) map.MapBackground = New BackgroundLayer(New GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))) map.CustomOverlays.Add(New GoogleOverlay()) Return View(map) End Function _ Sub SaveMap(ByVal map As Map, ByVal args As GeoCollection(Of Object)) ' TODO End Sub _ Function EditShape(ByVal map As Map, ByVal args As GeoCollection(Of Object)) As String Dim clickPosition As New PointShape(Convert.ToDouble(args(0)), Convert.ToDouble(args(1))) Dim connectionStr = "User ID=sa;Password=xxx!;Data Source=xxx;Initial Catalog=InternalDB;" Dim mssqlFeatureLayer As New MsSql2008FeatureLayer(connectionStr, "TableName", "geodb_oid") ' The "geodb_oid" value is mapping the feature id value. mssqlFeatureLayer.Open() Dim editFeature As Feature Dim closestFeatures As Collection(Of Feature) = mssqlFeatureLayer.FeatureSource.GetFeaturesNearestTo(clickPosition, GeographyUnit.DecimalDegree, 5, New String() {}) ' if we want to edit features within a range, we can pass a rectange shape rather than the click position to serve and then calling method "mssqlFeatureLayer.FeatureSource.GetFeaturesInsideBoundingBox" to get all the editing features If closestFeatures.Count > 0 Then editFeature = closestFeatures(0) End If Dim featureJson As String = MapHelper.ConvertFeaturesToJson(New Collection(Of Feature) From {editFeature}) Return featureJson End Function End Class