[mapguide-users] select the location on map

susan Daniel daniel.susan6 at gmail.com
Fri Apr 17 03:45:11 EDT 2009


thank you Ivan
but  i 'd like to know on which file i want to write this coding??
In ur coding OBJEKT1  is layer name right?then what is this
"Library://PROJEKTI/" + TIMgisUser + "/PODACI/OBJEKTI.FeatureSource");

thanks and regards
susan
On Fri, Apr 17, 2009 at 12:46 PM, Ivan Milicevic <Ivan.Milicevic at supranet.hr
> wrote:

>  Hello Susan,
>
>
>
> Here is C# code for selection, it's pretty same as PHP.
>
>
>
> MgSiteConnection siteConnection = null;
>
>     InitializeWebTier();
>
>
>
>     MgUserInformation userInfo = new MgUserInformation(mgSessionId);
>
>     siteConnection = new MgSiteConnection();
>
>     siteConnection.Open(userInfo);
>
>     MgResourceService resourceService = siteConnection.CreateService(
> MgServiceType.ResourceService) as MgResourceService;
>
>     MgFeatureService featureService = siteConnection.CreateService(
> MgServiceType.FeatureService) as MgFeatureService;
>
>     MgMap map = new MgMap();
>
>     map.Open(resourceService, "1"); //opening map with name „1“
>
>
>
>     MgFeatureQueryOptions queryOptionsObjekti = new MgFeatureQueryOptions
> ();
>
>     MgAgfReaderWriter geometryReaderWriter = new MgAgfReaderWriter();
>
>     MgSelection selection = new MgSelection(map);
>
>
>
>     //Defining layer and feature source
>
>     MgLayer layerObjekti = GetLayerByName(map, "OBJEKTI");
>
>     MgResourceIdentifier featureResIdObjekti = new MgResourceIdentifier(
> "Library://PROJEKTI/" + TIMgisUser + "/PODACI/OBJEKTI.FeatureSource");
>
>
>
>     //Creating feature filter, this is very important step!
>
>     string filter = "ID=" + idO;
>
>
>
>     queryOptionsObjekti.SetFilter(filter);
>
>     MgFeatureReader featureReaderObjekti = featureService.SelectFeatures(
> featureResIdObjekti, "OBJEKTI", queryOptionsObjekti);
>
>     selection.AddFeatures(layerObjekti, featureReaderObjekti, 1);
>
>     selection.Save(resourceService, "1");
>
>
>
>     StringReader stream = new StringReader(selection.ToXml());
>
>     string selectionXml = selection.ToXml();
>
>     featureReaderObjekti.Close();
>
>     map.Save();
>
>
>
>     //Here, you call javascript function and pass the selection var
>
>     Response.Write("<script>select('" + selectionXml + "');</script>");
>
>
>
> //This is javascript function that set's the selection from code and do the
> refresh.
>
> function select(xml)
>
> {
>
> parent.mapFrame.SetSelectionXML(xml);
>
> parent.mapFrame.ExecuteMapAction(10);
>
> }
>
>
>
>
>
> *From:* mapguide-users-bounces at lists.osgeo.org [mailto:
> mapguide-users-bounces at lists.osgeo.org] *On Behalf Of *susan Daniel
> *Sent:* Friday, April 17, 2009 9:11 AM
> *To:* mapguide-users at lists.osgeo.org
> *Subject:* [mapguide-users] select the location on map
>
>
>
> hi all
>         My plat form is mapguide maestro&php.I connect it with mysql.Now i
> want to select the corresponding polygon on the map while clicking on the
> data in database.In order to display the database table in the taskpane,i
> removed the contents of the file "/mapviewerphp/getting started .php" and
> wrote my codings.then how to select the polygon?.Any one know this????Anyone
> having coding to do this???
> please help me
>
>
> thanks&regards
>  susan
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>


-- 
thanks&regards
 susan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090417/c19880ab/attachment.html


More information about the mapguide-users mailing list