<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>using System;<BR>using System.Data;<BR>using
System.Configuration;<BR>using System.Collections;<BR>using System.Web;<BR>using
System.Web.Security;<BR>using System.Web.UI;<BR>using
System.Web.UI.WebControls;<BR>using System.Web.UI.WebControls.WebParts;<BR>using
System.Web.UI.HtmlControls;<BR>using OSGeo.MapGuide;<BR>using
System.Collections.Specialized;<BR>using
System.Text.RegularExpressions;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>public partial class
gis_ubicacion_GISFrmInformacionLote :
System.Web.UI.Page<BR>{<BR> protected void Page_Load(object
sender, EventArgs e)<BR>
{<BR> NameValueCollection
requestParams = Request.HttpMethod == "GET" ? Request.QueryString :
Request.Form;<BR> String mgSessionId =
requestParams["SESSION"];<BR> String
mgLocale =
requestParams["LOCALE"];<BR> String
mgMapName = "mss_map";</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> String
realPath =
Request.ServerVariables["APPL_PHYSICAL_PATH"];<BR>
String configPath = realPath +
"..\\webconfig.ini";<BR>
MapGuideApi.MgInitializeWebTier(configPath);<BR>
MgUserInformation userInfo = new MgUserInformation(mgSessionId);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
MgSiteConnection siteConnection = new
MgSiteConnection();<BR>
siteConnection.Open(userInfo);<BR>
MgMap map = new
MgMap(siteConnection);<BR>
map.Open(mgMapName);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
MgFeatureQueryOptions districtQuery = new
MgFeatureQueryOptions();<BR><STRONG>
districtQuery.SetFilter("IDLOT = '40010101'");</STRONG></FONT></DIV>
<DIV><FONT face=Arial
size=2> <BR>
<STRONG>MgLayer layer = map.GetLayers().GetItem("lay_lote") as
MgLayer;<BR></STRONG> </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
MgFeatureReader featureReader =
layer.SelectFeatures(districtQuery);<BR>
featureReader.ReadNext();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><STRONG>
MgByteReader districtGeometryData =
featureReader.GetGeometry("Geom");<BR></STRONG> <BR>
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
MgAgfReaderWriter agfReaderWriter = new
MgAgfReaderWriter();<BR> MgGeometry
districtGeometry = agfReaderWriter.Read(districtGeometryData);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><STRONG>
MgFeatureQueryOptions queryOptions = new
MgFeatureQueryOptions();<BR>
queryOptions.SetFilter("IDLOT =
'40010101'");<BR>
queryOptions.SetSpatialFilter("SHPGEOM",districtGeometry,MgFeatureSpatialOperations.Inside);</STRONG></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> layer =
map.GetLayers().GetItem("lay_lote") as
MgLayer;<BR> featureReader =
layer.SelectFeatures(queryOptions);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> layer =
map.GetLayers().GetItem("lay_lote") as
MgLayer;<BR> MgSelection selection =
new MgSelection(map);<BR>
selection.AddFeatures(layer, featureReader,
0);<BR> String selectionXml =
selection.ToXml();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
litSelectionXml.Text = Server.HtmlEncode(selectionXml);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
hfSelectionXml.Value = selectionXml;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> }<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Pd. Sorry for my english i speek spanish.
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Miguel Vasquez</FONT></DIV>
<DIV><FONT face=Arial size=2>Especialista GIS</FONT></DIV>
<DIV><FONT face=Arial size=2>Municipalidad de Santiago de Surco.</FONT></DIV>
<DIV> </DIV></BODY></HTML>