[mapguide-users] Programmatically set Map Properties and display information

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Fri May 9 03:09:48 EDT 2008


I find that to be difficult at first.
In the javascript you only have an Xml that contains
<FeatureSet>
  <Layer id="guid>
    <Class id="schema">
       <ID>base64encoded_id</ID>
   </Class>
  </Layer>
</FeatureSet>

The can be multiple layers, multiple class and multiple ID entries.
With this info, you must query the runtime map to find the layer(s) with 
the corresponding Guid.
Then you must query the layer's featuresource to retrive the rows and 
columns corresponding to the given ID's for the schema.
The result is the data for the selected features.

Another way to do it, is used in the standard viewer:
C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www\mapviewernet\

Basically you have the following procedure:
function SetSelection(selText, requery)
{
    var reqParams = "SESSION=" + sessionId + "&MAPNAME=" + 
encodeURIComponent(mapName) + "&SEQ=" + Math.random() + "&SELECTION=" + 
encodeURIComponent(selText) + "&QUERYINFO=" + (requery? "1": "0");
    reqHandler = CreateRequestHandler();
    reqHandler.open("POST", setSelScript, false);
    reqHandler.setRequestHeader("Content-Type", 
"application/x-www-form-urlencoded");
    reqHandler.send(reqParams);
    if(requery)
        return reqHandler.responseXML;
}

The selText is the selection xml, and if requery is set, the return 
value should contain the info you are looking for.

Regards, Kenneth Skovhede, GEOGRAF A/S



Nick Aizen skrev:
>
> Can anyone explain the best way to display the properties or 
> information that refers to the currently selected item in the viewer 
> programmatically?
>
>  
>
>  
>
> Thanks,
>
>  
>
>  
>
> *Nick Aizen*
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080509/da7730d4/attachment.html


More information about the mapguide-users mailing list