Tuesday, March 10, 2015

ArcMap tool for Panning and Zooming while editing using C#

Be The First To Comment
Draw features in ArcMap using ArcGIS Addin tool (Arcobject's IRubberband Interface) doesn't provide ways to zoom and pan while editing. In order to implement pan and zoom functionality during edit use IDisplayFeedback Interface. Following is  the code snippets using IDisplayFeedback Interface using C#. Then, you can use ArcMap standard keys to pan (arrows-left, right, top, bottom) and zoom (mouse-scroll or Z & X).
     protected override void OnUpdate()  
     {  
       Enabled = ArcMap.Application != null;  
     }  
     protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
     {  
       DrawGeometryOnMousedown(ArcMap.Document, arg);  
     }  
     protected override void OnMouseMove(MouseEventArgs arg)  
     {  
       DrawGeometryOnMouseMove(ArcMap.Document, arg);  
     }  
     protected override void OnDoubleClick()  
     {  
       FinishGeometryDrawOnDblClick(ArcMap.Document);  
     }  
     protected override void OnRefresh(int hDC)  
     {  
       if (newPolygonFeedback != null)  
       {  
         newPolygonFeedback.Refresh(hDC);  
       }  
     }  
     #region private helpers  
     //Polygon geometry object  
     private INewPolygonFeedback newPolygonFeedback;  
     private void DrawGeometryOnMousedown(IMxDocument doc, ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
     {  
       // Get the ScreenDisplay for the the ActiveView  
       IDisplay display = doc.ActiveView.ScreenDisplay;  
       // Get the current mouse location in Map Units  
       IPoint point = display.DisplayTransformation.ToMapPoint(arg.X, arg.Y);  
       // Check that user is not using an existing feedback  
       if ((newPolygonFeedback == null))  
       {  
         // Create a new Feedback  
         newPolygonFeedback = new NewPolygonFeedback();  
         // Get the Feedback's Symbol by reference (IDisplayFeedback::Symbol)  
         var simpleLineSymbol = newPolygonFeedback.Symbol as ISimpleLineSymbol;  
         // Create a new RGBColor and set it up  
         IRgbColor rgbColor = new RgbColor();  
         rgbColor.Green = 255;  
         rgbColor.Red = 0;  
         rgbColor.Blue = 255;  
         // Set the Color and Style for the Feedback's Symbol  
         if (simpleLineSymbol != null)  
         {  
           simpleLineSymbol.Color = rgbColor;  
           simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;  
         }  
         // Set the new Feedback's DISPLAY property (IDisplayFeedback::DISPLAY)  
         newPolygonFeedback.Display = (IScreenDisplay)display;  
         // Start the Feedback at the current mouse location  
         newPolygonFeedback.Start(point);  
       }  
       else  
       {  
         // Otherwise use the current mouse location to add a vertex to the current feedback  
         newPolygonFeedback.AddPoint(point);  
       }  
     }  
     private void DrawGeometryOnMouseMove(IMxDocument doc, ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
     {  
       // Get the ScreenDisplay for the the ActiveView  
       IMxDocument pMXDoc = doc;  
       IDisplay pDisp = pMXDoc.ActiveView.ScreenDisplay;  
       // Check if the user is currently using the feedback  
       if (newPolygonFeedback != null)  
       {  
         // Get the current mouse location in map units  
         IPoint pPnt = pDisp.DisplayTransformation.ToMapPoint(arg.X, arg.Y);  
         // Move the Feedback to the current mouse location (IDisplayFeedback::MoveTo)  
         newPolygonFeedback.MoveTo(pPnt);  
       }  
     }  
     private void FinishGeometryDrawOnDblClick(IMxDocument doc)  
     {  
       // Check if the user is currently using the feedback  
       if (newPolygonFeedback != null)  
       {  
         // Stop the feedback and set it to Nothing  
         IGeometry geometry = newPolygonFeedback.Stop();  
         newPolygonFeedback = null;  
         //check for valid geometery  
         if (geometry != null)  
         {  
           IScreenDisplay screenDisplay = doc.ActiveView.ScreenDisplay;  
           // Constants  
           screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache);  
           // Explicit Cast  
           IRgbColor rgbColor = new RgbColorClass();  
           rgbColor.Red = 255;  
           rgbColor.Transparency = 75;  
           IColor color = rgbColor; // Implicit Cast  
           ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();  
           simpleFillSymbol.Color = color;  
           //Draw geometry  
           ISymbol symbol = simpleFillSymbol as ISymbol; // Dynamic Cast  
           screenDisplay.SetSymbol(symbol);  
           screenDisplay.DrawPolygon(geometry);  
           screenDisplay.FinishDrawing();  
         }  
       }  
       ArcMap.Document.ActiveView.Refresh();  
     }  
     #endregion private helpers  

Draw features in ArcMap using ArcGIS Addin tool (Arcobject's IRubberband Interface)

Be The First To Comment
 protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
 {  
      //create geometery  
      if (ArcMap.Document != null)  
      {  
           IScreenDisplay screenDisplay = ArcMap.Document.ActiveView.ScreenDisplay;  
           // Constants  
           screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache);  
           // Explicit Cast  
           IRgbColor rgbColor = new RgbColorClass();  
           rgbColor.Red = 255;  
           rgbColor.Transparency = 75;  
           IColor color = rgbColor; // Implicit Cast  
           ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();  
           simpleFillSymbol.Color = color;  
           //Draw geometry  
           ISymbol symbol = simpleFillSymbol as ISymbol; // Dynamic Cast  
           IRubberBand rubberBand = new RubberPolygonClass();  
           IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);  
           //check for valid geometery  
           if (geometry != null)  
           {  
                screenDisplay.SetSymbol(symbol);  
                screenDisplay.DrawPolygon(geometry);  
                screenDisplay.FinishDrawing();  
                //Open addattributes wpf form  
                AddAtrributesView addAtrributesView = new AddAtrributesView(geometry);  
                addAtrributesView.ShowInTaskbar = false;  
                addAtrributesView.ShowDialog();  
                ArcMap.Document.ActivatedView.Refresh();  
           }  
      }       
 }  

Wednesday, February 25, 2015

Conference : Unmanned Aircraft Systems Technical Demonstration and Symposium 2015

Be The First To Comment
The second annual technical UAS symposium sponsored by the American Society for Photogrammetry and Remote Sensing (ASPRS) is scheduled for September 29-30, 2015 in Reno, Nevada. Expanding on the highly successful format and events of last year’s symposium this year’s event will include test flights, UAS data processing, and workshops.

Technical Demonstration and Symposium for Unmanned Aircraft Systems hosted by the American Society for Photogrammetry and Remote Sensing

Call for Speakers and Call for Workshops has also been announced! Details: http://uasreno.org/ 

Purpose: To assemble UAS developers and researchers, along with geospatial service providers and users of geospatial map data, to share information, showcase new technologies and demonstrate UAS systems in action (in flight). 
Mission: To advance knowledge and improve the understanding of UAS technologies and their safe and efficient introduction into our national airspace, government programs and business.

30 cm imagery from Digital Globe

Be The First To Comment
As the global leader in satellite imagery, DigitalGlobe is proud to once again push the boundaries of innovation by being the first company to delivery 30 cm resolution imagery.

This 5x improvement in resolution represents the definition of very-high resolution imagery.
30 cm imagery delivers clearer, richer images that empower better decision making through improved situational awareness. - See more at: Digital Globe 30 cm resolution imagery

Monday, February 2, 2015

Getting into ESRI ArcGIS Add-in Development in .Net and ArcObjects

1 Comment
Recently, I landed into a project for ArcGIS/ArcMap Desktop add-in development using ArcObjects in C#. I am a newbie in both ArcObjects and add-in development. Googling through I got tons of snippets on the ArcMap add-in development, but I was not familiar with tailoring them to make a working application.

Then, I started to look after Youtube and Amazon to see if any good basic books or tutorials that gives me basic concepts on tailoring the  ArcObjects/.Net snippets. On youtube, I came across a video tutorials series on “.Net programming with ArcOjects”, an excellent tutorial on ArcObjects and .Net development with sample Gis data and codes to download  by Hussein Nasser. I watched all 15 episodes on add-in development using VB.Net.

From the Amazon, I bought a book entitled, “Beginning ArcGIS for Desktop Development using .NET ” by Pouria Amirian, with a blind believe on the reviewers, but it turned out the 
The book is wonderful! The author does an excellent job of explaining basic .NET concepts and tying them into ArcObjects.This book was long overdue and it seems like the author really took his time to ensure the content was organized in a logical way and concepts are thoroughly explained.

I would recommend this book and Youtube video to anyone who is interested in learning ArcObjects in .NET. The both author includes .NET code samples as well as the solutions in C#/VB. Lots of useful stuff in there and I think when you finished you will have a good starting point to ArcGIS Desktop development.

Friday, January 23, 2015

Parenting Win-form and WPF form in ArcMap

Be The First To Comment
Parenting of Win-form windows and WPF windows within a ArcMap application using C#.Net code snippets-

Step 1: Create a ArcMapWrapper.cs, wrapper class

        using System;
        using System.Windows.Forms;
        using ESRI.ArcGIS.Framework;

        namespace ArcMapClassLibrary2
        {
               class ArcMapWrapper:IWin32Window
               {
                    private IApplication _arcMapApplication;

                    public ArcMapWrapper( IApplication mApplication)
                    {
                       _arcMapApplication = mApplication;
                    }

                    public IntPtr Handle
                    {
                       get { return new IntPtr(_arcMapApplication.hWnd); }
           
                     }
                 }
           }

Step 2: Access from Win-form

              WinForm fm = new WinForm();                        
              ArcMapWrapper wrapper= new ArcMapWrapper(map_application);  
              fm.ShowInTaskbar = false;        
              fm.Show(wrapper);

              //Try, it behaves like a modal dialog
              //fm.ShowDialog()

Tuesday, January 13, 2015

Create standalone feature class and feature class inside feature dataset on Geodatabase using ArcObjects

Be The First To Comment
 public void StartUp()   
    {   
     try   
     {   
       //create gdb   
      const string path = "D:/SampleDatasets/NewShp";   
      const string fileGDBName = "sample.gdb";   
      const string fileGDBAddress = path + "/" + fileGDBName;   
      const string featureDatasetname="polygonFeatureClasses";   
      const string featureClassname = "MytestPolygons";   
      if (System.IO.Directory.Exists(fileGDBAddress))   
      {   
       Console.WriteLine("already exist");   
       // return;   
      }   
      Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");   
      IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);   
      IWorkspaceName workspaceName = workspaceFactory.Create(path, fileGDBName, null,ArcMap.Application.hWnd);   
      MessageBox.Show("gbd created!");   
      
      //Create feature dataset   
      IFeatureWorkspace fws = workspaceFactory.OpenFromFile(fileGDBAddress, ArcMap.Application.hWnd) as IFeatureWorkspace;   
      
     //check the existance of FeatureDataset   
      IWorkspace2 ws = fws as IWorkspace2;   
      if(ws.get_NameExists(esriDatasetType.esriDTFeatureDataset,featureDatasetname)==true)   
      {   
       MessageBox.Show("Feature dataset is already exists");   
      }  

      #region feature Class inside feature Dataset : Region_1 (Choose either Region_1 or Region_2)  
     
      //Create a spatial refrence/extract spatial refrence from map   
      //Infuture will access through the arcmap   
      ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass();   
      int coordinateSystemID = (int) esriSRGeoCSType.esriSRGeoCS_WGS1984;   
      ISpatialReference spatialReference =spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemID);   
      

Tuesday, December 16, 2014

Free Opportunity to attend the ESRI USER Conference - 2015 User Conference Student Assistantship

Be The First To Comment

Friday, December 5, 2014

Highly popular Lidar vocabularies

Be The First To Comment
A
accuracy The closeness of an estimated value (for example, measured or computed) to a standard or accepted (true) value of a particular quantity. See precision.

absolute accuracy A measure that accounts for all systematic and random errors in a dataset. Absolute accuracy is stated with respect to a defined datum or reference system.

accuracyr (ACCr) The National Standards for Spatial Data Accuracy (NSSDA) (Federal Geographic Data Committee, 1998) reporting standard in the horizontal component that equals the radius of a circle of uncertainty, such that the true or theoretical horizontal location of the point falls within that circle 95 percent of the time. ACCRMSErr=×17308..

accuracyz (ACCz) The NSSDA reporting standard in the vertical component that equals the linear uncertainty value, such that the true or theoretical vertical location of the point falls within that linear uncertainty value 95 percent of the time. ACCRMSEzz=×19600..

horizontal accuracy The horizontal (radial) component of the positional accuracy of a dataset with respect to a horizontal datum, at a specified confidence level. See accuracyr.

local accuracy The uncertainty in the coordinates of points with respect to coordinates of other directly connected, adjacent points at the 95-percent confidence level.

network accuracy The uncertainty in the coordinates of mapped points with respect to the geodetic datum at the 95-percent confidence level.

positional accuracy The accuracy at the 95-percent confidence level of the position of features, including horizontal and vertical positions, with respect to horizontal and vertical datums.

relative accuracy A measure of variation in point-to-point accuracy in a data set. In lidar, this term may also specifically mean the positional agreement between points within a swath, adjacent swaths within a lift, adjacent lifts within a project, or between adjacent projects.

vertical accuracy The measure of the positional accuracy of a data set with respect to a specified vertical datum, at a specified confidence level or percentile. See accuracyz.
aggregate nominal pulse density (ANPD) A variant of nominal pulse density that expresses the total expected or actual density of pulses occurring in a specified unit area resulting from multiple passes of the light detection and ranging (lidar) instrument, or a single pass of a platform with multiple lidar instruments, over the same target area. In all other respects, ANPD is identical to nominal pulse density (NPD). In single coverage collection, ANPD and NPD will be equal. See aggregate nominal pulse spacing, nominal pulse density, nominal pulse spacing.
aggregate nominal pulse spacing (ANPS) A variant of nominal pulse spacing that expresses the typical or average lateral distance between pulses in a lidar dataset resulting from multiple passes of the lidar instrument, or a single pass of a platform with multiple lidar instruments, over the same target area. In all other respects, ANPS is identical to nominal pulse spacing
18 Lidar Base Specification
(NPS). In single coverage collections, ANPS and NPS will be equal. See aggregate nominal pulse density, nominal pulse density, nominal pulse spacing.
artifacts An inaccurate observation, effect, or result, especially one resulting from the technology used in scientific investigation or from experimental error. In bare-earth elevation models, artifacts are detectable surface remnants of buildings, trees, towers, telephone poles or other elevated features; also, detectable artificial anomalies that are introduced to a surface model by way of system specific collection or processing techniques. For example, corn-row effects of profile collection, star and ramp effects from multidirectional contour interpolation, or detectable triangular facets caused when vegetation canopies are removed from lidar data.
attitude The position of a body defined by the angles between the axes of the coordinate system of the body and the axes of an external coordinate system. In photogrammetry, the attitude is the angular orientation of a camera (roll, pitch, yaw), or of the photograph taken with that camera, with respect to some external reference system. With lidar, the attitude is normally defined as the roll, pitch and heading of the instrument at the instant an active pulse is emitted from the sensor.

Tuesday, November 25, 2014

Solution: IntelliJ not recognizing a particular file correctly, instead its stuck as a text file

4 Comments
I had mistakenly save my class as fileName.text file and tried to rename it with fileName .java but the IntelliJ couldn't recognize it and throws the error saying..
After spending long hours on internet, I found a solution and sharing/keeping here for future reference.

Step 1: Click "File"==> "Settings"
Step 2: Expand "Editor" & Click "File Types"
Step 3: You will see all file types on Right. Navigate to the "Text Files" and Click it
Step 4: You should able to see your file name on the bottom of Registered Patterns (lower box)
Step 5: Remove your file from the Registered Patterns. The problem should solved and let you to rename with fileName.java
Step 6: If not, delete the file from the project and create it again with name fileName



 

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me