[mapguide-users] How to Highlight Line Features
padmini godavarthi
godavarthi.padmini at gmail.com
Fri Feb 13 07:05:51 EST 2009
Hi,
I attached primary key as "OBJECTID" in my table
then i want to select the line feature based on this objectid.
My code is as follows
-----------------------------
Dim fetresource1 As MgResourceIdentifier = New
MgResourceIdentifier("Library://WaterNetwork/data/resource.FeatureSource")
Dim nameQuery1 As MgFeatureQueryOptions = New
MgFeatureQueryOptions()
nameQuery1.AddFeatureProperty(val1)
nameQuery1.SetFilter("OBJECTID =20")
Dim layer1 As MgLayer = map.GetLayers().GetItem("waterpipe")
Dim value As String = ""
Dim featureReader1 As MgFeatureReader =
featureService.SelectFeatures(fetresource1, layer1.GetFeatureClassName(),
nameQuery1)
While featureReader1.ReadNext()
Dim propertyType As Integer =
featureReader1.GetPropertyType("OBJECTID")
value = GetFeaturePropertyValue(featureReader1, "OBJECTID")
End While
Dim selection As MgSelection = New MgSelection(map)
selection.AddFeatures(layer1, featureReader1, 0)
Dim selectXML As String = selection.ToXml()
selection.Save(resourceService, "watermap")
Page.ClientScript.RegisterStartupScript(Page.GetType(), "test",
"select('" & selectXML & "')", True)
map.Save(resourceService)
featureReader1.Close()
then after executing this code non of the line was selected.
Has any idea on it?
Thanks and Regards,
Padmini.
Kenneth Skovhede, GEOGRAF A/S wrote:
>
> This is what I found from a quick search:
> http://www.techonthenet.com/oracle/primary_keys.php
>
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
>
> padmini godavarthi skrev:
>> Hi,
>> is selection is done based on primary key of type integer?
>> Then in my table there is no primary key column.How can i achieve thin?
>>
>>
>> Thanks and Regards,
>> Padmini.
>>
>>
>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>
>>> It is not enough that it has unique values, there must be a primary key
>>> defined.
>>> Since you are using Oracle, the key must be defined on the Oracle table.
>>> IIRC, the primary key must also be of type integer.
>>>
>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>
>>>
>>>
>>> padmini godavarthi skrev:
>>>
>>>> Hi,
>>>> In my table STARTVALVE has unique valves .By using that "STARTVALVE"
>>>> property iam trying for selection .
>>>>
>>>>
>>>> Regards,
>>>> Padmini.
>>>>
>>>>
>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>
>>>>
>>>>> You cannot use selection if the table does not have unique primary
>>>>> keys.
>>>>>
>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>
>>>>>
>>>>>
>>>>> padmini godavarthi skrev:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>> In my table iam not having any primary key columns.
>>>>>>
>>>>>> Thanks and Regards,
>>>>>> Padmini
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> I think your data has broken primary keys (eg. empty strings as
>>>>>>> primary
>>>>>>> key).
>>>>>>>
>>>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> padmini godavarthi skrev:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> iam using Mapguide opensource 2.0 (with .net 2.0 +IIS 5.1)
>>>>>>>> Now iam struck up with high lighting line features on the map.
>>>>>>>>
>>>>>>>> my code is as follows:-
>>>>>>>> -------------------------------
>>>>>>>>
>>>>>>>>
>>>>>>>> Dim fetresource1 As MgResourceIdentifier = New
>>>>>>>> MgResourceIdentifier("Library://WaterNetwork/data/resource.FeatureSource")
>>>>>>>> Dim nameQuery1 As MgFeatureQueryOptions = New
>>>>>>>> MgFeatureQueryOptions()
>>>>>>>> Dim val1 As String = "STARTVALVE"
>>>>>>>> nameQuery1.AddFeatureProperty(val1)
>>>>>>>> nameQuery1.SetFilter("STARTVALVE ='124'")
>>>>>>>> Dim layer1 As MgLayer =
>>>>>>>> map.GetLayers().GetItem("waterpipe")
>>>>>>>> layer1.Selectable = True
>>>>>>>> Dim featureReader1 As MgFeatureReader =
>>>>>>>> featureService.SelectFeatures(fetresource1,
>>>>>>>> layer1.GetFeatureClassName(),
>>>>>>>> nameQuery1)
>>>>>>>>
>>>>>>>> Dim selection As MgSelection = New MgSelection(map)
>>>>>>>> selection.AddFeatures(layer1, featureReader1, 0)
>>>>>>>> Dim selectXML As String = selection.ToXml()
>>>>>>>> selection.Save(resourceService, "watermap")
>>>>>>>> Page.ClientScript.RegisterStartupScript(Page.GetType(),
>>>>>>>> "test",
>>>>>>>> "select('" & selectXML & "')", True)
>>>>>>>>
>>>>>>>> map.Save(resourceService)
>>>>>>>>
>>>>>>>> featureReader1.Close()
>>>>>>>> -------------------------------------------------------------------------------------------------
>>>>>>>>
>>>>>>>> function select(val) {
>>>>>>>>
>>>>>>>> var selectionXML = val;
>>>>>>>> parent.parent.SetSelectionXML(selectionXML);
>>>>>>>> alert("Selected");
>>>>>>>> parent.parent.refresh;
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> but the line feature is not highlighting ? but this code works
>>>>>>>> with
>>>>>>>> polygon feature.
>>>>>>>> i found that in xml
>>>>>>>>
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?><FeatureSet
>>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>> xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd"> <Layer
>>>>>>>> id="1f6baf1e-0000-1000-8000-0016e692a356"> <Class
>>>>>>>> id="KingOra:IMCN~GIS_WATERPIPE_DETAILS~SHAPE"> <ID></ID>
>>>>>>>> <ID></ID>
>>>>>>>> </Class> </Layer></FeatureSet>
>>>>>>>>
>>>>>>>> ID doesn't came.is there problem with ID?
>>>>>>>>
>>>>>>>> Can u plz tell me the solution?
>>>>>>>>
>>>>>>>> Thanks and Regards,
>>>>>>>> Padmini
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> mapguide-users mailing list
>>>>>>> mapguide-users at lists.osgeo.org
>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> mapguide-users mailing list
>>>>> mapguide-users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> mapguide-users mailing list
>>> mapguide-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>>
>>>
>>
>>
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>
--
View this message in context: http://n2.nabble.com/How-to-Highlight-Line-Features-tp2307466p2320878.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list