[mapguide-users] Query Features

sathishpsk9 sathishpsk9 at gmail.com
Tue Jan 5 02:06:40 EST 2010


Hi all, I wish all a vey happy new year...

I have to highlight the parcel which are near to a road..
I have a layer which contains parcels and a road network layer which
contains roadways.
I am capturing the road id through mouse click event and passing that road
id to a page where i perform quering ...........But of no luck..

Here is my code for quering .........

 Dim userInfo As New MgUserInformation(sessionId)
        Dim siteConnection As New MgSiteConnection()
        siteConnection.Open(userInfo)
        roadGeo = TextBox1.Text
        'create service objects 
        Dim resourceSrvc As MgResourceService =
TryCast(siteConnection.CreateService(MgServiceType.ResourceService),
MgResourceService)
        Dim featureSrvc As MgFeatureService =
TryCast(siteConnection.CreateService(MgServiceType.FeatureService),
MgFeatureService)
        Dim map As New MgMap()
        map.Open(resourceSrvc, "Map")
        Dim nameQuery As New MgFeatureQueryOptions()
        Dim val As String = "ROAD_GEO_I"     // field of road id there in
property layer
        nameQuery.AddFeatureProperty(val)
        Dim queryval As String = roadGeo    // captured road id captured
through mouse click
        Dim totquery As String = (val & "=" & "'") + queryval & "'"
        nameQuery.SetFilter(totquery)
        Dim layer As MgLayer = map.GetLayers().GetItem("PROPERTY LAYER")
        Dim fetresource As New
MgResourceIdentifier("Library://IMCShapeTrade/PropertiesResource.FeatureSource")
        Dim featureReader As MgFeatureReader =
featureSrvc.SelectFeatures(fetresource, layer.GetFeatureClassName(),
nameQuery)
        Dim featureReader1 As MgFeatureReader =
featureSrvc.SelectFeatures(fetresource, layer.GetFeatureClassName(),
nameQuery)
        Dim i As String = featureReader.GetPropertyName(0)

        'featureReader.ReadNext()
        Dim selection As New MgSelection(map)
        selection.AddFeatures(layer, featureReader1, 0)  // error appears
here . "Specified object not found 
        Dim selectXML As String = selection.ToXml()
        selection.Save(resourceSrvc, "Map")
        'featureReader.Close()
        Page.ClientScript.RegisterStartupScript(Page.GetType(), "test",
"select('" & selectXML & "')", True)

Am i doing anything wrong ?
If i can query through both layers by using joins or other features
(intersects , etc) ? if it can done , please give a example code 
 Please guide in right direction 


Thanks & Regards ,
Satish Kumar
-- 
View this message in context: http://n2.nabble.com/Query-Features-tp4253901p4253901.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list