Perform Identify on IMapServer (ArcGIS Server) using IMapServer.Identify
int iteratorCount;
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay imageDisplay = new ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay();
imageDisplay.ImageWidth = 1020;
imageDisplay.ImageHeight = 768;
imageDisplay.ImageDPI = 75;
ESRI.ArcGIS.ADF.Web.Geometry.Point iPoint = new ESRI.ArcGIS.ADF.Web.Geometry.Point(-95.233,30.3344);
ESRI.ArcGIS.ADF.ArcGISServer.Point agsPoint = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPoint(iPoint);
ESRI.ArcGIS.ADF.ArcGISServer.MapServerIdentifyResult[] identifyResutls = mapserver.Identify(mapdescription, imageDisplay, agsPoint, 0, ESRI.ArcGIS.ADF.ArcGISServer.esriIdentifyOption.esriIdentifyVisibleLayers, layerIDs);
ArrayList arraylist = new ArrayList();
for (iteratorCount = 0; iteratorCount < identifyResutls.Length; iteratorCount++)
{
for (int t = 0; t < identifyResutls[0].Properties.PropertyArray.Length; t++)
{
arraylist.Add(identifyResutls[iteratorCount].Properties.PropertyArray[t].Key.ToString(),identifyResutls[iteratorCount].Properties.PropertyArray[t].Value.ToString());
}
}
Applying buffer with ITopologicalOperator in IMapServer using WebADF in ArcGIS Server
P.S. blogger is not allowing me to post the code as it is. I'm posting the code anyways. Incase if you want fully structured code please post a request in the comments section with your email address and I will send you the code.
int position;
double radius = LatLongVal[0, 0];
ESRI.ArcGIS.ADF.Web.Geometry.Point centerPoint = reproject(LatLongVal[1, 0], LatLongVal[1, 1]);
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection buildPoly = new ESRI.ArcGIS.ADF.Web.Geometry.PointCollection();
int iterateCount = 0;
double X, Y, degree;
ESRI.ArcGIS.esriSystem.IUnitConverter iuc = new ESRI.ArcGIS.esriSystem.UnitConverterClass();
double units = iuc.ConvertUnits(radius, ESRI.ArcGIS.esriSystem.esriUnits.esriMiles, ESRI.ArcGIS.esriSystem.esriUnits.esriMeters);
while (iterateCount < degree =" iterateCount" x =" centerPoint.X" y =" centerPoint.Y" point =" new" polyring =" new" points =" buildPoly;" polyrings =" new" bufferpoly =" new" rings =" polyRings;" value_polygon =" ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPolygon(bufferPoly);" spatialreference =" mapdescription.SpatialReference;" sf =" new" filtergeometry =" (Geometry)value_polygon;" geometryfieldname = "Shape" whereclause = "" searchorder =" esriSearchOrder.esriSearchOrderAttribute;" spatialrel =" esriSpatialRelEnum.esriSpatialRelIntersects;" spatialreldescription = "" qf =" sf;" ifid =" mapserver.QueryFeatureIDs(mapdescription.Name," recordset =" mapserver.QueryFeatureData(mapdescription.Name,">
For ArcObjects implementation of buffer in IMapServer see
http://adityaiiii.blogspot.com/2008/08/applying-buffer-using.html
Applying buffer with ITopologicalOperator in IMapServer using ArcObjects in ArcGIS Server
double radius = 5;
ESRI.ArcGIS.ADF.Web.Geometry.Point centerPoint =
new ESRI.ArcGIS.ADF.Web.Geometry.Point(-96.343,45.545);
IPoint nPoint = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToIPoint
(centerPoint, mapserver.ServerContext);
ITopologicalOperator topologicalOperator = nPoint as ITopologicalOperator;
IGeometry bufferedGeometry = topologicalOperator.Buffer(radius);
IPolygon4 buffer = bufferedGeometry as IPolygon4;
ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilter();
spatialFilter.Geometry = (IGeometry)buffer;
spatialFilter.GeometryField = "Shape";
spatialFilter.WhereClause = "";
spatialFilter.SearchOrder = ESRI.ArcGIS.Geodatabase.esriSearchOrder.esriSearchOrderAttribute;
spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects;
ESRI.ArcGIS.ADF.ArcGISServer.QueryFilter queryFilter = (ESRI.ArcGIS.ADF.ArcGISServer.QueryFilter)ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ComObjectToValueObject(spatialFilter, mapserver.ServerContext, typeof(ESRI.ArcGIS.ADF.ArcGISServer.QueryFilter));
ESRI.ArcGIS.ADF.ArcGISServer.FIDSet fidSet = mapserver.QueryFeatureIDs(mapdescription.Name, layerid, queryFilter);
ESRI.ArcGIS.ADF.ArcGISServer.RecordSet recordset = mapserver.QueryFeatureData(mapdescription.Name, layerid, queryFilter);
For WebADF implementation of buffer in IMapServer see
http://adityaiiii.blogspot.com/2008/08/applying-buffer-with.html
Reverse geocode using GeocodeResourceManager and IGeocodeFunctionality in ArcGIS Server
GeocodeResourceManager geoCodeManager = Map1.FindControl("GeocodeResourceManager1") as GeocodeResourceManager;
GeocodeResourceItem geoCodeResourceItem = geoCodeManager.ResourceItems[0] as GeocodeResourceItem;
if (!geoCodeManager.IsInitialized(geoCodeResourceItem))
geoCodeManager.Initialize();
geoCodeResourceItem.InitializeResource();
if (geoCodeResourceItem.FailedToInitialize) return "nothing";
IGISResource gisResource = geoCodeResourceItem.CreateResource();
if (!gisResource.Initialized)
gisResource.Initialize();
bool supported = gisResource.SupportsFunctionality(typeof(IGeocodeFunctionality));
if (!supported) return "shit";
//Create geocode funtionality
IGeocodeFunctionality geoCodeFunc = (IGeocodeFunctionality)gisResource.CreateFunctionality(typeof(IGeocodeFunctionality), null);
geoCodeFunc.Initialize();
// Set reverse geocode search parameters
Dictionary
props.Add("ReverseDistanceUnits", "Meters");
props.Add("ReverseDistance", "1000");
string xString = m_queryString["minx"];
string yString = m_queryString["miny"];
int x = Convert.ToInt32(xString);
int y = Convert.ToInt32(yString);
ESRI.ArcGIS.ADF.Web.Geometry.Point myPoint = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(x, y,
Map1.GetTransformationParams(TransformationDirection.ToMap));
string addressLine = "";
try
{
List <> addressValueList =
geoCodeFunc.ReverseGeocode(myPoint, false, props);
}
catch (Exception e)
{
addressLine = "Adress not found";
}
Convert Featureclass to coverage in ArcGIS Engine using Geoprocessing toolkit
double myTolerance = 10;
Geoprocessor nGeoP = new Geoprocessor();
//Create a new instance of featureClassToCoverage class ESRI.ArcGIS.ConversionTools.FeatureclassToCoverage featureClassToCoverage = new
ESRI.ArcGIS.ConversionTools.FeatureclassToCoverage
("C:\MyGeoDbase.mdb\\myFeatureclass","E:\\MyNewCoverage");
featureClassToCoverage.cluster_tolerance = myTolerance;
ExecuteGP(nGeoP, featureClassToCoverage, null);
private static void ExecuteGP(Geoprocessor gp, IGPProcess process, ITrackCancel TC)
{
// Execute the tool
try
{
gp.OverwriteOutput = true;
gp.Execute(process, null);
}
catch (ComException ComEx)
{
Console.WriteLine(ComEx.Message);
}
}
Serialize and DeSerialize ArcGIS Json object
Query result and output restrictions in ArcGIS Server
When you are developing web applications using the ArcObjects components provided by the ArcGIS Server API you have to be careful that your application doesn't put a heavy load on the web server that hosts the application and database server that provides the data which may result in denial of service to other clients accessing them. The two highly possible areas that might cause this problem are
i. Serving the output (Web server)
ii. Performing the database queries (Database server)
Using the objects provided by ESRI.ArcGIS.Geodatabase library you can query database by applying a spatial filter,attribute filter with out any limit on the number of the records returned on query execution. Because at this level of ArcObjects API where the actual query is performed on the web server, there is no restriction on the maximum number of records returned by query output cursor. For example you can execture a spatial filter that returns like a million rows and iterating through each one of the above rows can kill your webserver performance. So as a developer you should make sure that you application doesn't run these kind of ad hoc queries and you can do this by setting the limit on number of queyr output records that are processed by application especially in the case where the output feature cursor can have large number of features. In the below example, at any point of time the application process or iterates thru only first 500 rows.
IQueryFilter nQueryFilter = serverContext.CreateObject("esriGeodatabase.QueryFilter");
nQueryFilter.WhereClause = "ObjectID > 1"ICursor nCursor = nFeatureClass.Search(nQueryFilter,True);
IFeature nFeature = nCursor.NextRow();
Int i =0;
While (i<500 nfeature =" nCursor.NextRow();">
In the above case our query executes on web server. But there are some cases where the query executes in the MapServer. For example when you use the QueryFeatureData method in IMapServer the query executes and evaluates in the MapServer and not on the web server. So at this level of ArcObjects API , the maximum number of records that can be evaluated by the MapSever is restricted. This maximum record count is implemented as a MapServer object property calle MaxRecordCount. The MaxRecordCount is set to 500 by default. This can be changed by a GIS Server Administrator by changing the value of MaxRecordCount XML tag in the GIS Server's Configuration file. The IMapServer methods that uses this MaxRecordCount setting are QueryFeatureData,Find and Identify.
The number of feature that can be buffered per layer is restricted by another MapServer object property MaxBufferCount. In MapSever you can dynamically apply buffers around features by setting the SelectionBufferDistanceProperty of ILayerDescription (should be greater than zero). The default value of MaxBufferCount is 100. This can be changed by a GIS Server Administrator by changing the value of MaxBufferCount XML tag in the GIS Server's Configuration file.
In the same way the number of results returned by GeoCodeServer is controlled by the GeocodeServer's MaxResultSize property. This limit is applied to the results returned by the FindAddressCandidates method of GeoCodeServer. The default value of MaxResultSize is 500. This can be changed by a GIS Server Administrator by changing the value of MaxBufferCount XML tag in the GIS Server's Configuration file. The maximum number of input records that can be passed into GeoCodeAddresses method of the the GeoCodeServer is equal to MaxBatchSize value. This can be changed by a GIS Server Administrator by changing the value of MaxBatchSize XML tag in the GIS Server's Configuration file
In the same way the size of the image of the ImageDescription object passed into ExportMapImage is controlled by the MapServer object properties MaxImageWidth and MaxImageHeight. The reason these are restricted with the MapServers built-in limits is large files requires huge amounts of disk space and consumes a huge chunk of resources. By Default these values are set to 2048. This can be changed by a GIS Server Administrator by changing the value of MaxImageWidth and MaxImageHeight XML tags in the GIS Server's Configuration file. In order to set these values in a configuration file
- Goto =>
\Server\user\cfg - Identify the configuration file for the service you are running your query against. If your service name is "parcelconroe" then the name of the configuration files should be in the format
. .cfg , so in this case its parcelconroe.MapServer.cfg - Change the value of the property.
Please post your valuable comments and suggestions.
Cannot add or draw shapes on Virtual Earth map overlaid with tiled layer in ArcGIS Server Virtual Earth Extension in Internet Explorer
If you cannot add or draw shapes on Virtual Earth map overlaid with ArcGIS VE tile layer in ArcGIS Server Virtual Earth Extension in Internet Explorer then you are in the right place.
I've a program that has one part that renders the virtual earth map and add the ArcGIS Tile layer
var map = null;
var agisve_services = null;
var tileUrl ="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services
/Portland/ESRI_LandBase_WebMercator/MapServer";
function OnPageLoad() {
var centerat = new VELatLong(45.50634690108341, -122.67883300781251);
map = new VEMap('mymap');
var mapOptions = new VEMapOptions();
mapOptions.EnableBirdseye = false;
map.LoadMap(centerat, 15, VEMapStyle.Aerial, false, VEMapMode.Mode2D, false, 0,
mapOptions);
map.AttachEvent("onclick",getPoint);
}
function AddMap() {
agisve_services = new ESRI.ArcGIS.VE.ArcGISLayerFactory();
agisve_services.CreateLayer(tileUrl, "Parcels", GetMap);
}
function GetMap(tileSourceSpec, resourceInfo) {
tileSourceSpec.Opacity=0.35;
map.AddTileLayer(tileSourceSpec,true);
$get("resultDiv").style.visibility ="hidden";
}
Another function to draw a polygon
function getPoint(e) {
var clickPnt;
var inputCoords = $get("InputGeometries");
var output = $get("OutputGeometries");
if (e.rightMouseButton) { }
else {
if (e.latLong) {
clickPnt = e.latLong;
}
else {
var clickPixel = new VEPixel(e.mapX,e.mapY);
clickPnt = map.PixelToLatLong(clickPixel);
}
if (clicks.length==0) inputCoords.innerHTML = "";
clicks.push(clickPnt);
if (clickShape!=null) map.DeleteShape(clickShape);
if (clicks.length>1) {
if (shapeType==VEShapeType.Polygon && clicks.length>2)
clickShape = new VEShape(VEShapeType.Polygon, clicks);
else
clickShape = new VEShape(VEShapeType.Polyline, clicks);
clickShape.HideIcon();
} else {
clickShape = new VEShape(VEShapeType.Pushpin, clicks[0]);
}
clickShape.Show();
map.AddShape(clickShape);
}
With the above code in firefox I can successfully add the tile layer to the virtual earth map and draw polygons on my map. But in Internet Explorer (both 6 and 7) Im able to add my tile layer but I cannot draw the polygon. So I replace the two lines above in red color font with the following code that uses Virtual Earth API to add the tile layer instead of using ESRI.ArcGIS.VE.ArcGISLayerFactory. It just worked like a charm. I extracted the tilesource information like bounds, tileUrl by putting a break point in GetMap function.
var bounds = [new VELatLongRectangle(new VELatLong(29.6433,- 96.99),
new VELatLong(-29.99,98.999))];
var tileSourceSpec = new VETileSourceSpecification("Parcels",
"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services
/Portland/ESRI_LandBase_WebMercator/MapServer/vetile/%4.png");
tileSourceSpec.NumServers = 1;
tileSourceSpec.Bounds = bounds;
tileSourceSpec.MinZoomLevel = 10;
tileSourceSpec.MaxZoomLevel = 18;
tileSourceSpec.ZIndex = 2;
tileSourceSpec.Opacity = 0.5;
mapve.AddTileLayer(tileSourceSpec, true);
Please feel free to post your comments and suggestions.
Erase graphics layer in ArcGIS Server map control
IEnumerable gfc = Map1.GetFunctionalities();
foreach (IGISFunctionality gfunc in gfc)
{
if (gfunc is ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality)
{
gResource = (ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource)gfunc.Resource;
break;
}
}
if (gResource == null)
return;
ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer glayer = null;
foreach (System.Data.DataTable dt in gResource.Graphics.Tables)
{
//If it is a Feature Graphics Layer
glayer = (ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer)dt;
glayer.Clear();
// If it is a element graphics layer
// glayer = (ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer)dt;
// glayer.Clear();
}
esriConfig.defaults.io.proxyUrl is not set
If you are trying to run a esri.tasks task (buffer,find,query,identify..) in ArcGIS Server 9.3 javascript API and you get the above error then most probably the cause should be because your query length exceeded 2000 characters. Before you proceed further make sure that the same task runs if you choose a smaller area or smaller number of features (basically smaller in quanitity). If it works then you got yourself a free pass for the IMAX Experience :).
When you perform any one of the esri.tasks then the relevant task information is submitted to the ArcGIS Service as a query string. The standard browser limit for a URL is 2000 characters. So when your task creates a URL request of size greater than 2000 characters , it fails and you get the error 'esriConfig.defaults.io.proxyUrl is not set '.
a. Download the the proxy page at http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp/ProxyPage_NET.zip(contains proxy.ashx and proxy.config)
d. open your proxy.config and add a tag
Also you can add multiple single service service URLs(Fig 1) each for a
different service.
e. Place esriConfig.defaults.io.proxyUrl = "proxy.ashx" in your init() function of
your javascript code.
This should take care of the error "esriConfig.defaults.io.proxyUrl is not set". But if you get the error even after installing the proxy feel free to post a comment and we will look into it.
Server was updated but cannot be started due to: Server object instance creation failed on all SOC machines.
One of the reasons can be you service parameters are incorrect. Check the parameters of your service by -
In 9.2 ArcGIS Server manager -Goto Services => Clcik on service => parameters
In 9.3 ArcGIS Sever manager - Goto Services => Manage services => click on service => parameters
If your problem still persist then you might want to take a look at this
http://adityaiiii.blogspot.com/2008/07/server-object-instance-creation-failed.html
ArcGIS Server 9.3 JavaScript API map not showing up in firefox
Tip of the day: To close an open InfoTemplate programmatically in ArcGIS Server 9.3 JavaScript API
use map.infoWindow.hide() ;
his address is restricted: This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the req
This address is restricted: This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection.
Workaround:
a. Go to about:config in your Firefox browser.
b. Right click on any record, and choose "New -> String"
c. For Name type "network.security.ports.banned.override"
d. For value type , type "1-65535" or whatever port-range you want to allow.
e. Click OK
Error 1 Access to the path 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\testapp\9f3733d7\cf81b8f5\i9gcpugt.res' is denied.
Error 1 Access to the path 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\testapp\9f3733d7\cf81b8f5\i9gcpugt.res' is denied. / Workaround : Delete all the contents of Temporary ASP.NET Files folder.
Grant everyone full control for everyone on the Temporary ASP.Net folder. Yes i know this is not a great idea but it saves you for the time being.
Please post in the comments if you find out exact user/permissions.
Error HRESULT E_FAIL has been returned from a call to a COM component
System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. at ESRI.ArcGIS.Geodatabase.IWorkspaceFactory.OpenFromFile(String fileName, Int32 hWnd)
Make sure
a. You specified full path for the file name
featureWorkSpace = MyWorkSpaceFactory.OpenFromFile("C:\\MyFolder\\MyGeodatabase.gdb", 0)
b. you have required permissions at file/folder level
c. your ArcGIS license didnt expire and its authorized thru software authorization wizard
d. you are using the right constant when creating the new MyWorkSpaceFactory
esriDataSourcesGDB.FileGDBWorkspaceFactory //For file geodatabase
esriDataSourcesGDB.AccessWorkspaceFactory // For .mdb
esriDatasourcesFile.ShapefileWorkspaceFactory // for .shp
d. your code is executing on a server machine that has the actual ArcObjects components installed. The reason this can be an issue because "Client machines (for example, the Web server machine) require only the ADF runtime be installed to run ArcGIS Server applications. The ADF runtime does not install ArcObjects, so these applications do not have the ability to create local ArcObjects. All ArcObjects that your application uses should be created within a server context using the CreateObject method on IServerContext." (Reference : ArcGIS Server Adminstrator and Developer Guide).
It is wrong to use the "new" keyword to locally create the ArcObjects on client machine. You should create them with in a server context using IServerContext.CreateObject. For example
using IWorkspaceFactory myWorkspaceFactory = new FileGDBWorkspaceFactoryClass(); // Wrong
IWorkspaceFactory myWorkspaceFactory = context.CreateObject("esriDataSourcesGDB.FileGDBWorkspaceFactory")
as IWorkspaceFactory; //correct
IFeatureWorkspace gdbWorkSpace = myWorkspaceFactory.OpenFromFile("C:\\MyFolder\\MyGeodatabase.gdb", 0) as IFeatureWorkspace; //Correct
Its a best practice to create the ArcObjects with in the server context even if you have the ArcObjects components installed on your server machine instead of creating these objects locally usinig the "new key word" because ArcObjects created locally cannot interact with objects created remotely within a server context. This might put you in a complex situation down the road especially if you need to use these objects to intereact with ArcObjects running with in the remote server object container(s).
System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040228.
If your developing your application using ArcGIS Engine runtime 9.2 and you get the error System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040228, One of the most popular and prodigal cause would be you forgot to initialize the license. Please add the following two lines of code at the beginning of your application (eg: Main()) and that should take care of it.
ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize();
ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeEngine);
If you dont have ArcGIS Engine 9.2 runtime installed and want to use desktop ArcView license for the development then the code would be
ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize();
ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView);
If you dont have ArcGIS Engine 9.2 runtime installed and want to use desktop ArcEditor license for the development then the code would be
ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize();
ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor);
If you dont have ArcGIS Engine 9.2 runtime installed and want to use desktop ArcInfo license for the development then the code would be
ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize();
ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo);
Programatically encrypt the ArcGIS identity using ESRI.ArcGIS.ADF.Converter
MapResourceItem mapResourceItem = new MapResourceItem();
GISResourceItemDefinition definition = new GISResourceItemDefinition();
mapResourceItem.Name = "MyLayerName";
definition.DataSourceDefinition = "http://MyArcGISServer/ArcGIS/services";
definition.DataSourceType = "ArcGIS Server Internet";
definition.ResourceDefinition = "(default)@" + "MyTestServiceName";
//Create encrypted identity
string username = "MyAgsUser";
string password = "MyAgspassword";
string domain = "MyDomain";
ESRI.ArcGIS.ADF.Identity idObj = new ESRI.ArcGIS.ADF.Identity(username, password, domain);
string Identity= ESRI.ArcGIS.ADF.Converter.FromIdentity(idObj);
definition.Identity = Identity;
definition.DataSourceShared = true;
mapResourceItem.Parent = MapResourceManager1;
mapResourceItem.Definition = definition;
Could not load file or assembly ....or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'ESRI.ArcGIS.Geometry, Version=9.2.4.1420, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' or one of its dependencies. The system cannot find the file specified.
Expand and collapse the nodes in TOC
Perform Buffer in ArcGIS Javascript API using ArcGIS server 9.3 Geometry Service
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
var map, queryTask, query, geomService, bufferParams;
function init() {
map = new esri.Map("map");
map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("http://www.MyArcGISServer.com/ArcGIS/rest/services/TESTMapService/MapServer"));
dojo.connect(map, "onClick", performQuery);
queryTask = new esri.tasks.QueryTask(http://www.MyArcGISServer.com/ArcGIS/rest/services/TESTMapService/MapServer);
query = new esri.tasks.Query();
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
query.returnGeometry = true;
dojo.connect(queryTask, "onComplete", performBuffer);
geomService = new esri.tasks.GeometryService("http://www.MyArcGISServer.com/ArcGIS/rest/services/TestGeometryService/GeometryServer");
bufferParams = new esri.tasks.BufferParameters();
bufferParams.distances = [500];
bufferParams.unit = esri.tasks.BufferParameters.UNIT_METER;
bufferParams.bufferSpatialReference = new esri.SpatialReference({wkid: 102113});
// web mercator
bufferParams.outSpatialReference = new esri.SpatialReference({wkid: 4326});
//wgs 84
dojo.connect(geomService, "onBufferComplete", addBufferFeatures);
}
function performQuery(e) {
query.geometry = e.mapPoint;
queryTask.execute(query);
}
function performBuffer(featureSet) {
map.graphics.clear();
var features = featureSet.features;
for (var i=0; i
{
feature = features[i];
var mapSymbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleMarkerSymbol("solid", new dojo.Color([255,0,0]), 2.5), new dojo.Color([255,255,0,0.25]));
feature.setSymbol(mapSymbol);
map.graphics.add(feature);
}
bufferParams.features = features;
geomService.buffer(bufferParams);
}
function addBufferFeatures(features){
var symbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleMarkerSymbol("solid", new dojo.Color([0,0,255,0.65]), 2.5), new dojo.Color([0,0,255,0.25]));
for (var j=0; j
features[j].setSymbol(symbol);
map.graphics.add(features[j]);
}
}
dojo.addOnLoad(init);
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
var map, queryTask, query, geomService, bufferParams;
function init() {
map = new esri.Map("map");
map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("http://www.MyArcGISServer.com/ArcGIS/rest/services/TESTMapService/MapServer"));
dojo.connect(map, "onClick", performQuery);
queryTask = new esri.tasks.QueryTask(http://www.MyArcGISServer.com/ArcGIS/rest/services/TESTMapService/MapServer);
query = new esri.tasks.Query();
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
query.returnGeometry = true;
dojo.connect(queryTask, "onComplete", performBuffer);
geomService = new esri.tasks.GeometryService("http://www.MyArcGISServer.com/ArcGIS/rest/services/TestGeometryService/GeometryServer");
bufferParams = new esri.tasks.BufferParameters();
bufferParams.distances = [500];
bufferParams.unit = esri.tasks.BufferParameters.UNIT_METER;
bufferParams.bufferSpatialReference = new esri.SpatialReference({wkid: 102113});
// web mercator
bufferParams.outSpatialReference = new esri.SpatialReference({wkid: 4326});
//wgs 84
dojo.connect(geomService, "onBufferComplete", addBufferFeatures);
}
function performQuery(e) {
query.geometry = e.mapPoint;
queryTask.execute(query);
}
function performBuffer(featureSet) {
map.graphics.clear();
var features = featureSet.features;
for (var i=0; i
{
feature = features[i];
var mapSymbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleMarkerSymbol("solid", new dojo.Color([255,0,0]), 2.5), new dojo.Color([255,255,0,0.25]));
feature.setSymbol(mapSymbol);
map.graphics.add(feature);
}
bufferParams.features = features;
geomService.buffer(bufferParams);
}
function addBufferFeatures(features){
var symbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleMarkerSymbol("solid", new dojo.Color([0,0,255,0.65]), 2.5), new dojo.Color([0,0,255,0.25]));
for (var j=0, fLen=features.length; j
features[j].setSymbol(symbol);
map.graphics.add(features[j]);
}
}
dojo.addOnLoad(init);
Executing AddIndex tool to add attribute index in ArcGIS Engine
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.DataManagementTools;
//Create new AddIndex tool
AddIndex addIndex = new AddIndex();
// Assign in_table to the shapefile you want to add attribute index for
addIndex.in_table = "MyShapeFile.shp";
addIndex.fields = "objectid;fid;";
addIndex.ascending = "ASCENDING";
addIndex.unique = "UNIQUE";
//Create new GeoProcessor instance
GeoProcessor cGP = new Geoprocessor();
cGP.SetEnvironmentValue("workspace", @"C:\temp");
cGP.Execute(addIndex, null);
