[mapguide-users] Selecting object returns wrong primary key

Chris Claydon chris.claydon at autodesk.com
Tue Mar 10 10:28:45 EDT 2009

Just to clarify - your code works for some features, but does not work for some other features on the same layer?

What is the data type of your primary key?

Do you perhaps have features with duplicate IDs?

When you get the wrong ID, are you able to retrieve any properties for that feature at all?

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of marius.360
Sent: Tuesday, March 10, 2009 1:30 AM
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] Selecting object returns wrong primary key

No, these situations do not occur. The objects in question is a line, and it
is not near another object that returns the primary key on the mouseover.
The big problem is that the number the showinfo returns does not even exist
in the table. We use the fillowing code to get the selection string for the

selection = new MgSelection(map, selectionXml);
    layers = selection.GetLayers();
    var queryOptions = new MgFeatureQueryOptions();
    for (var i=0; i < layers.GetCount(); i++) {        
  var layer = layers.GetItem(i)
  var layername = layer.GetName()
  var layerClassName = layer.GetFeatureClassName();
  selectionString = selection.GenerateFilter(layer, layerClassName);

The number returned by the mouse-over is definatly correct for the object in
question, and the one returned by the code above does not even exist in the

Please let me know if you need more info.

Crispin_at_1Spatial wrote:
> Do you have any data that is overlaid - polygons on top of polygons? - or
> it it tessalated or lines or points?
> The default lookup-buffer for the MapGuide hover-over tooltip is pretty
> big (4 pixels + some coord transformation that can result in a wide
> search).
> Are you sure the hover-over is the correct ID as this can pick up other
> nearby IDs?
> marius.360 wrote:
>> I select an object on the map, on the mouse over it gives me the correct
>> primary key, but when I open a capture form where attribute information
>> is displayed, another different ID is sent through, This however, does
>> not happen for all objects, only a couple of them.
>> Can anyone give me suggestions as to why this happen?
>> Thanks

View this message in context: http://n2.nabble.com/Selecting-object-returns-wrong-primary-key-tp2448893p2453681.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

mapguide-users mailing list
mapguide-users at lists.osgeo.org

More information about the mapguide-users mailing list