why my mapguide can't work??

1 message Options
Embed this post
Permalink
gabow

why my mapguide can't work??

Reply Threaded More More options
Print post
Permalink
This is my code . Xcoord and ycoord is coordinate byonclick event.
I want to   insert a point to my map named "地標" but it is not any work.
Who can tell me why~~~~???????????
PS .  I have already changed feature sourse property "read-only" to false.

        Dim ycoord As String = Request.Form("x")
        Dim xcoord As String = Request.Form("y")
        'Dim curscale As String = Request.Form("currentscale")
        Dim mgSessionId As String = Session("mySsessionId")
        Dim MapName As String = Session("mapname")

           Dim layer As MgLayer
        Dim userInfo As MgUserInformation = New MgUserInformation(mgSessionId)
        Dim siteConnection As MgSiteConnection = New MgSiteConnection()
        siteConnection.Open(userInfo)
        Dim map As MgMap = New MgMap
        Dim resourceService As MgResourceService = siteConnection.CreateService  (MgServiceType.ResourceService)
        Dim featureService As MgFeatureService = siteConnection.CreateService(MgServiceType.FeatureService)
        map.Open(resourceService, MapName)
        layer = map.GetLayers.GetItem("地標")
        Dim resId As MgResourceIdentifier = New MgResourceIdentifier(layer.GetFeatureSourceId())

           Dim geometryFactory As MgGeometryFactory = New MgGeometryFactory()
        Dim coordinate As MgCoordinate
        Dim point2 As MgGeometry
        Dim point3 As MgByteReader

             Dim pointWKTText As MgWktReaderWriter = New MgWktReaderWriter
        Dim pointAGFReader As MgAgfReaderWriter = New MgAgfReaderWriter
        Dim propertycollection As MgPropertyCollection = New MgPropertyCollection
        Dim pointtype As MgGeometryProperty
        Dim insert As MgInsertFeatures
        Dim cmdcollection As MgFeatureCommandCollection = New MgFeatureCommandCollection

            coordinate = geometryFactory.CreateCoordinateXY(xcoord, ycoord)
        point2 = geometryFactory.CreatePoint(coordinate)
        point3 = pointAGFReader.Write(point2)
        pointtype = New MgGeometryProperty("Geometry", point3)

        propertycollection.Add(pointtype)
        insert = New MgInsertFeatures(layer.FeatureClassName, propertycollection)
        cmdcollection.Add(insert)
        propertycollection = featureService.UpdateFeatures(resId, cmdcollection, False)