How to get the feature type for internet map resource (MapResourceInternet) ? //m_Map is Map object ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo[] maplayerinfo = mapserverinfo.MapLayerInfos;
foreach (IMapFunctionality mapFunc in m_map.GetFunctionalities())
{
// check for the map resource you are looking for
if (mapFunc.Resource.Name = "myResource")
{
IGISResource resource = mapFunc.Resource;
//Create mapresource internet object out of IGISResource
MapResourceInternet ms = (MapResourceInternet)resource;
//extract mapserverinfo
ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo mapserverinfo = ms.MapServerInfo;
//iterate thru maplayerinfos
for (int i = 0; i < maplayerinfo.Length; i++)
{
// check for the layer you are looking for
if (maplayerinfo[i].Name.Equals("Well"))
{
for (int j = 0; j < maplayerinfo[i].FieldAliases.Length; j++)
{
//check for the "shape" field to get the column number
if (maplayerinfo[i].FieldAliases[j].ToString() == "Shape")
{
ESRI.ArcGIS.ADF.ArcGISServer.esriGeometryType gt = maplayerinfo[i].Fields.FieldArray[j].GeometryDef.GeometryType;
//get the geometry type
}
}
}
}
}
}
How to get the feature type for internet map resource (MapResourceInternet) ?
Querying for geometry using IQueryfilter
if you are using map control
ESRI.ArcGIS.ADF.StringCollection fieldColl = new ESRI.ArcGIS.ADF.StringCollection();
fieldColl.Add("Shape");
ESRI.ArcGIS.ADF.Web.QueryFilter qf = new ESRI.ArcGIS.ADF.Web.QueryFilter();
qf.WhereClause = field_name + "='" + field_value+"'";
qf.ReturnADFGeometries = true;
qf.SubFields = fieldColl;
qf.OutputSpatialReference = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfSpatialReference(mapdescription.SpatialReference);
System.Data.DataTable datatable = qfunc.Query(mf.Name, lids[layer_index], qf);
if (datatable == null)
return;
DataRow dr = datatable.Rows[0];
ESRI.ArcGIS.ADF.Web.Geometry.Geometry geom = dr[1] as ESRI.ArcGIS.ADF.Web.Geometry.Geometry; ESRI.ArcGIS.ADF.Web.Geometry.Envelope env = ESRI.ArcGIS.ADF.Web.Geometry.Envelope.GetMinimumEnclosingEnvelope(geom);
If you are accessing the map service using DCOM Proxy
IServerObject so = mapserver.ServerContext.ServerObject;
ESRI.ArcGIS.Carto.IMapServer imapserver = so as ESRI.ArcGIS.Carto.IMapServer;
//qf - queryfilter
ESRI.ArcGIS.Geodatabase.IRecordSet recordset = imapserver.QueryFeatureData(mapdescription.Name, layerid, qf);
IFeatureCursor fCursor = (IFeatureCursor)recordset.get_Cursor(false);
IFeature sFeature;
while ((sFeature = fCursor.NextFeature()) != null)
{ IGeometry geom1 = sFeature.Shape;
}
For conversion between different ESRI datatypes (arcg.adf,web.adf,arcobjects) see
http://edndoc.esri.com/arcobjects/9.2/NET_Server_Doc/developer/ADF/conversion.htm
Embedding ESRI WebADF controls into .Net webparts, user controls and Sharepoint webparts
a. Its very easy if you understand ESRI WEBADF controls client-server communication model and execution sequence.
b. Recently we deployed a ESRI Map control in a sharepoint webpart and I noticed that the order in which you create objects and instantiate them is very important especially for the controls like mapcontrol. for example You have to instantiate the mapresourcemanager object (adding it to the webpart) before you assign it for mapcontrol or add map resource items to it.
c. Yes you cant change the basic functionality of any webadf control like Mapctrl or toc etc. But you can easily implement the functionalities like identify,select features, draw features and what not - in conjunction to the map control in an usercontrol, .Net webpart or sharepoint webpart but just implementing the ICallbackHandler interface.
d. If you look at the javascript generated by the ESRI Map control you will notic that most of the code is reusable for various client operations like clicking on the map, drawing a shape on the map etc. By using
> The ICallbackHandler Ajax model for communication between server and client
> ESRI generated javascript for clientside operations on map
> ESRI ArcObjects , WebADF and ArcGISEngine classes for server side processing
we can implement any ESRI webadf control or ESRI functionality in an user control or webpart easily.
e. But there are some controls like zoomlevel tool etc which cant be deployed outside of esri web template and ESRI is supposed to fix it in SP4 which I havent tested yet.
Feel free to post your experiences or opinions in comments section.
b. Recently we deployed a ESRI Map control in a sharepoint webpart and I noticed that the order in which you create objects and instantiate them is very important especially for the controls like mapcontrol. for example You have to instantiate the mapresourcemanager object (adding it to the webpart) before you assign it for mapcontrol or add map resource items to it.
c. Yes you cant change the basic functionality of any webadf control like Mapctrl or toc etc. But you can easily implement the functionalities like identify,select features, draw features and what not - in conjunction to the map control in an usercontrol, .Net webpart or sharepoint webpart but just implementing the ICallbackHandler interface.
d. If you look at the javascript generated by the ESRI Map control you will notic that most of the code is reusable for various client operations like clicking on the map, drawing a shape on the map etc. By using
> The ICallbackHandler Ajax model for communication between server and client
> ESRI generated javascript for clientside operations on map
> ESRI ArcObjects , WebADF and ArcGISEngine classes for server side processing
we can implement any ESRI webadf control or ESRI functionality in an user control or webpart easily.
e. But there are some controls like zoomlevel tool etc which cant be deployed outside of esri web template and ESRI is supposed to fix it in SP4 which I havent tested yet.
Feel free to post your experiences or opinions in comments section.
Subscribe to:
Posts (Atom)