Hi i have configurate MGOS 2.0.2 whit .Net and IIS, i try to make application 
but when i try to use the example to find a feature like a parcel whit id i 
have problem i run this code and dont have error but the xml select dont return 
nothing because is null only show the head of xml. I change the call of 
GetGeometry method whit "Geom" in the example is "Data" because i dont have 
"Data" attribute whit geometric i have "Geom" whit geometric attribute. The 
layer is a SDF i build it whit autocad map 2009 and firts its a shape file and 
i convert to SDF to use whit MGOS.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OSGeo.MapGuide;
using System.Collections.Specialized;
using System.Text.RegularExpressions;

public partial class gis_ubicacion_GISFrmInformacionLote : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        NameValueCollection requestParams = Request.HttpMethod == "GET" ? 
Request.QueryString : Request.Form;
        String mgSessionId = requestParams["SESSION"];
        String mgLocale = requestParams["LOCALE"];
        String mgMapName = "mss_map";

        String realPath = Request.ServerVariables["APPL_PHYSICAL_PATH"];
        String configPath = realPath + "..\\webconfig.ini";
        MapGuideApi.MgInitializeWebTier(configPath);
        MgUserInformation userInfo = new MgUserInformation(mgSessionId);

        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfo);
        MgMap map = new MgMap(siteConnection);
        map.Open(mgMapName);

        MgFeatureQueryOptions districtQuery = new MgFeatureQueryOptions();
        districtQuery.SetFilter("IDLOT = '40010101'");
       
        MgLayer layer = map.GetLayers().GetItem("lay_lote") as MgLayer;
        

        MgFeatureReader featureReader = layer.SelectFeatures(districtQuery);
        featureReader.ReadNext();

        MgByteReader districtGeometryData = featureReader.GetGeometry("Geom");
        
        

        MgAgfReaderWriter agfReaderWriter = new MgAgfReaderWriter();
        MgGeometry districtGeometry = 
agfReaderWriter.Read(districtGeometryData);

        MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
        queryOptions.SetFilter("IDLOT = '40010101'");
        
queryOptions.SetSpatialFilter("SHPGEOM",districtGeometry,MgFeatureSpatialOperations.Inside);

        layer = map.GetLayers().GetItem("lay_lote") as MgLayer;
        featureReader = layer.SelectFeatures(queryOptions);

        layer = map.GetLayers().GetItem("lay_lote") as MgLayer;
        MgSelection selection = new MgSelection(map);
        selection.AddFeatures(layer, featureReader, 0);
        String selectionXml = selection.ToXml();

        litSelectionXml.Text = Server.HtmlEncode(selectionXml);

        hfSelectionXml.Value = selectionXml;

    }
}


Pd. Sorry for my english i speek spanish. 

Miguel Vasquez
Especialista GIS
Municipalidad de Santiago de Surco.
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to