POST
|
Hi using System; using System.Drawing; using System.Runtime.InteropServices; using ESRI.ArcGIS.ADF.BaseClasses; using ESRI.ArcGIS.ADF.CATIDs; using ESRI.ArcGIS.Framework; using ESRI.ArcGIS.ArcMapUI; using System.Windows.Forms; namespace GIS_FORMS { /// <summary> /// Summary description for GetXY. /// </summary> [Guid("b1e4d6f0-53de-44d3-b679-f29432d1fe35")] [ClassInterface(ClassInterfaceType.None)] [ProgId("GIS_FORMS.GetXY")] public sealed class GetXY : BaseTool { #region COM Registration Function(s) [ComRegisterFunction()] [ComVisible(false)] static void RegisterFunction(Type registerType) { // Required for ArcGIS Component Category Registrar support ArcGISCategoryRegistration(registerType); // // TODO: Add any COM registration code here // } [ComUnregisterFunction()] [ComVisible(false)] static void UnregisterFunction(Type registerType) { // Required for ArcGIS Component Category Registrar support ArcGISCategoryUnregistration(registerType); // // TODO: Add any COM unregistration code here // } #region ArcGIS Component Category Registrar generated code /// <summary> /// Required method for ArcGIS Component Category registration - /// Do not modify the contents of this method with the code editor. /// </summary> private static void ArcGISCategoryRegistration(Type registerType) { string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID); MxCommands.Register(regKey); } /// <summary> /// Required method for ArcGIS Component Category unregistration - /// Do not modify the contents of this method with the code editor. /// </summary> private static void ArcGISCategoryUnregistration(Type registerType) { string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID); MxCommands.Unregister(regKey); } #endregion #endregion private IApplication m_application; public GetXY() { // // TODO: Define values for the public properties // base.m_category = "GIS_FORMS"; //localizable text base.m_caption = "get xy"; //localizable text base.m_message = "get xy"; //localizable text base.m_toolTip = "get xy"; //localizable text base.m_name = "get_xy"; //unique id, non-localizable (e.g. "MyCategory_ArcMapTool") try { // // TODO: change resource name if necessary // string bitmapResourceName = GetType().Name + ".bmp"; base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); base.m_cursor = new System.Windows.Forms.Cursor(GetType(), GetType().Name + ".cur"); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } } #region Overriden Class Methods /// <summary> /// Occurs when this tool is created /// </summary> /// <param name="hook">Instance of the application</param> public override void OnCreate(object hook) { m_application = hook as IApplication; //Disable if it is not ArcMap if (hook is IMxApplication) base.m_enabled = true; else base.m_enabled = false; // TODO: Add other initialization code } /// <summary> /// Occurs when this tool is clicked /// </summary> public override void OnClick() { // TODO: Add GetXY.OnClick implementation } public override void OnMouseDown(int Button, int Shift, int X, int Y) { // TODO: Add GetXY.OnMouseDown implementation MessageBox.Show("X position is " + X.ToString() +"Y position is :" + Y.ToString()); } public override void OnMouseMove(int Button, int Shift, int X, int Y) { // TODO: Add GetXY.OnMouseMove implementation } public override void OnMouseUp(int Button, int Shift, int X, int Y) { // TODO: Add GetXY.OnMouseUp implementation } #endregion } } You are looking for the same or you want to get layer extents ?
... View more
12-16-2010
11:38 PM
|
0
|
0
|
1117
|
POST
|
Hi all: I'm having difficulty trying to programatically access the data source for layers within an mxd. Code follows: DirectoryInfo di = new DirectoryInfo(folder);
FileInfo[] files = di.GetFiles("*.mxd");
Dictionary<string, List<String>> referencedFiles = new Dictionary<string,List<string>>();
foreach (FileInfo fi in files)
{
referencedFiles.Add(fi.FullName, new List<string>());
IMapDocument doc = new MapDocument();
doc.Open(fi.FullName);
doc.SetActiveView(doc.PageLayout as IActiveView);
doc.ActiveView.Activate(0);
IEnumLayer pEnumLayer = doc.ActiveView.FocusMap.Layers;
pEnumLayer.Reset();
ILayer pLayer;
while ((pLayer = pEnumLayer.Next()) != null)
{
IFeatureLayer pFL = pLayer as FeatureLayer;
IFeatureClass pFC = pFL as IFeatureClass; // pFC is coming up null every time for all shapefile layers.
}
} Hi, Try this public static string GetPath(IApplication pApplication) { IMxDocument pMxDoc; pMxDoc = pApplication.Document as IMxDocument; IMap pMap; pMap = pMxDoc.FocusMap; IFeatureLayer pFeatLayer; IDataset pDataset; pFeatLayer = pMap.get_Layer(0) as IFeatureLayer; pDataset = pFeatLayer.FeatureClass as IDataset; string strFilePath = ""; strFilePath = pDataset.Workspace.PathName; return strFilePath; }
... View more
12-16-2010
09:13 PM
|
0
|
0
|
343
|
POST
|
We currently use ZigGIS. We were hoping for native support without the use of ArcSDE and native ArcCatalog read/write management support. I suppose it is a little too much to ask for. We use PgAdmin to manage. ZigGIS for the Read/Write of postgis features in ArcGIS. Actually we find we use ArcGIS less for Analysis work, and more for the pretty map making tools. Do you work all editing using GigGIS ? is GigGIS is free ? Will you compare PostGIS and ArcSDE.when you use in ArcGIS ?
... View more
12-13-2010
06:58 PM
|
0
|
0
|
462
|
POST
|
Hi, Please find below code //Get the type using the ProgID. Type t = Type.GetTypeFromProgID( "esriGeoDatabase.SimplePointPluginWorkspaceFactory"); //Use activator to create an instance of the workspace factory. IWorkspaceFactory workspaceFactory = Activator.CreateInstance(t)as IWorkspaceFactory; //Open the workspace. IFeatureWorkspace featureWorkspace = (IFeatureWorkspace) workspaceFactory.OpenFromFile(@"C:\Data\Data", 0); //Get a feature class from the workspace. IFeatureClass featureClass = featureWorkspace.OpenFeatureClass("points"); //Create a new feature layer and add it to the map. IFeatureLayer featureLayer = new FeatureLayerClass(); featureLayer.Name = featureClass.AliasName; featureLayer.FeatureClass = featureClass; m_hookHelper.FocusMap.AddLayer((ILayer)featureLayer);
... View more
12-13-2010
02:55 AM
|
0
|
0
|
148
|
POST
|
Which is why our lab uses postgis/postgresql for our database. We got tired of dealing with esri's database efforts. The File Geodatabase is a delicate creature. ArcMap will understand PostgreSQL/POSTGIS geometry with out ArcSDE ?
... View more
12-13-2010
12:29 AM
|
0
|
0
|
462
|
POST
|
Hi, Please check below url... http://resources.arcgis.com/content/arcgis-engine/10.0/system-requirements
... View more
12-12-2010
08:03 PM
|
0
|
0
|
132
|
POST
|
Hi, Check below thread ...might help you.. http://forums.esri.com/Thread.asp?c=93&f=992&t=131991&mc=3#msgid381510
... View more
12-12-2010
07:54 PM
|
0
|
0
|
226
|
POST
|
Hello, How to print the fields of table in textbox in form using VBA �?? Arcobject? Please, see the attached image that shows my question Any help is very much appreciated Regards kalid Can you please be clear on the question...You are looking for print table or something ?
... View more
12-12-2010
07:39 PM
|
0
|
0
|
162
|
POST
|
Hello, How to write a code that does the �??frequency�?� for a field in attribute table of a layer using the VBA �?? Arcobjects? Please, see the attached image that shows my question Thank you Regards Kalid Hi, Please look into below thread...this might help you... http://forums.esri.com/Thread.asp?c=93&f=987&t=277434&mc=2#msgid858105
... View more
12-12-2010
07:32 PM
|
0
|
0
|
108
|
POST
|
Dear Venkat, Thank you so much for the answer. It�??s really helpful Sure. The code you have developed is working perfectly. 1. how to develop the code so that we don�??t need: �?� To work in edit session. �?� To have the field �??name�?� in the district layer. 2. How to develop the code considering the following approach: �?� to intersect the two layers (districts and hospitals: both are polygons) �?� And then to make summery in the table of the resultant layer (from the intersection) so that we count all the hospitals in each district. I�??m supposed to print the result in the form and then to be able to export it to a table to excel Please, see the attached file Appreciated Kalid Hi, Whatever the code i have given is the intersect two poly and point layers and count the point within the polygon and add into polygon layer table ...and below is that thread where you can find the code for exporting into excel...Please change the code as per your requirement. http://forums.esri.com/Thread.asp?c=93&f=992&t=227281&mc=6#msgid692161
... View more
12-12-2010
07:21 PM
|
0
|
0
|
483
|
POST
|
Hi, You are looking for the same ? public override void OnMouseDown(int Button, int Shift, int X, int Y) { try { // TODO: Add SelectByShape.OnMouseDown implementation IMxDocument pMxDoc = m_application.Document as IMxDocument; IEnvelope pEnv; IRubberBand pRubberBand; IElement pElem; //creat new rubber envople pRubberBand = new RubberEnvelopeClass(); pEnv = pRubberBand.TrackNew(pMxDoc.ActiveView.ScreenDisplay, null) as IEnvelope; //create new envolpe element pElem = new RectangleElementClass(); pElem.Geometry = pEnv; IFillShapeElement pFillShapeElement; IFillSymbol pFillSymbol; IColor pColor; ILineSymbol pLineSymbol; IGraphicsContainer pGContainer; pFillShapeElement = pElem as IFillShapeElement; //set fill symbol pFillSymbol = pFillShapeElement.Symbol; pColor = pFillSymbol.Color; pColor.Transparency = 0; pFillSymbol.Color = pColor; //set the outline symbol; pLineSymbol = pFillSymbol.Outline; pColor.Transparency = 255; pColor.RGB = 255; pLineSymbol.Width = 12; pFillSymbol.Outline = pLineSymbol; //assing the symbol to teh rectangle pFillShapeElement.Symbol = pFillSymbol; //add rectange to the GC; pGContainer = pMxDoc.ActiveView as IGraphicsContainer; pGContainer.AddElement(pElem, 0); pMxDoc.ActiveView.Refresh(); //use rectangle to search the top layer ISpatialFilter pSpatialFilter = new SpatialFilterClass(); IFeatureCursor pFeatCursor; IFeature pFeature; IFeatureLayer pFeatLayer; int intCount = 0; pSpatialFilter.WhereClause = "FID >2"; pSpatialFilter.Geometry = pEnv; pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains; pFeatLayer = pMxDoc.SelectedLayer as IFeatureLayer; pFeatCursor = pFeatLayer.Search(pSpatialFilter, false); pFeature = pFeatCursor.NextFeature() as IFeature; while(pFeature!=null) { intCount = intCount + 1; pFeature = pFeatCursor.NextFeature(); } MessageBox.Show("There are " + intCount + "Cities over 5000 Recangel Area"); pGContainer.DeleteAllElements(); } catch (Exception exp) { } }
... View more
12-12-2010
07:14 PM
|
0
|
0
|
351
|
POST
|
hi, Application.shutdown is vba code syntax...I dont know Python.... Thanks and Regards, Venkat
... View more
12-10-2010
01:36 AM
|
0
|
0
|
648
|
POST
|
hi, How do you intersect point and polygon...You are looking for Points within the polygon ?if that is true i have already given you the code that perfectly working...please check previous forms Thanks
... View more
12-09-2010
11:42 PM
|
0
|
0
|
180
|
POST
|
hi, Please find the url.. http://resources.arcgis.com/content/kbase?fa=articleShow&d=28109 I hope this helps you... Thanks
... View more
12-09-2010
11:38 PM
|
0
|
0
|
671
|
POST
|
Hi, You r looking for graphic rectangle or feature rectangle ? Thanks and Regards, Venkat
... View more
12-09-2010
09:37 PM
|
0
|
0
|
351
|
Title | Kudos | Posted |
---|---|---|
1 | 10-09-2017 07:44 AM | |
2 | 01-12-2015 10:36 PM | |
1 | 01-15-2015 09:02 AM | |
2 | 09-29-2014 02:29 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|