Quantcast
Channel: Question and Answer » arcmap
Viewing all 248 articles
Browse latest View live

C# Custom Dockable window: grouping them together

$
0
0

I’m adding in some custom windows for our clients. I want to group my dock windows together on load. The end result would look like they are tabbed (from the bottom).

I have the following code to my button (x 3 ):

ESRI.ArcGIS.Framework.IDockableWindow aaView;
...
if (aaView == null)
            {
                //Get dockable window.
                UID dockWinID = new UIDClass();
                dockWinID.Value = "myView";
                aaView = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);


                if (aaView == null)
                {
                    ErrorBox.DoModal("Launchmyview Error", "", "", "", 1);
                    return;
                }
            }
            aaView.Show(!aaView.IsVisible());

I have the following in the esriaddinx(x3):

 <DockableWindow id="MyView" class="CustomEvents.ImageMetaData+AddinImpl" caption="Raster Metadata">
          <InitialPlacement height="300" width="300" state="unpinned" position="group" neighbor="{E1F29C6D4E6B11D2AE2C080009EC732A}" />
        </DockableWindow>

I know that I can move the windows over eachother manually once the UI is open, but I want to group them programmtically.


Conditional Statements in Arc Map 10 (field Calculator)

$
0
0

I’m attempting to calculate the values of a field based on IF THEN statements in ArcMap 10 (in field calculator) but I haven’t succeeded yet on that.

What I want to add is the following expression:

IF [FIELDNAME1] = [FIELDNAME2] then

[FIELDNMCH] = "no change" else

[FIELDNMCH] = "change"

END IF

The values in the fieldnames are texts.

Any help on that?

Inserting accumulative attribute in dynamic text element based on Date field using ArcGIS for Desktop?

$
0
0

I’ve got a line feature class that contains Date field. I’ve made a layout view in order to display time animation of this feature class. I’ve managed to enable the time option in the layer and to create a Data Frame Time text in correspondence to the elapsed time.

I’m looking to enrich the layout by creating a dynamic text element of the feature class’ accumulated ‘Shape_Length’ field, according to the elapsed datetime – time elapsing > accumulated ‘Shape_Length’ gets bigger.

I’ve tried several ways to do it, but didn’t succeed so far:

  1. I’ve tried inspecting the Data Frame Time element Text syntax — <dyn type="dataFrame" name="Layers" property="time" emptyStr="[off]"/> — but couldn’t figure how to change it to show the ‘Shape_Length’ field.

enter image description here

  1. I’ve try an alternative approach: to create a date based graph. I’ve followed this link, and search quite along time in the Advanced Properties of the graph how to make it a time enabled and also how to make it accumulative. Didn’t work as well.

I think the answer would be in connection to the LayerTime function.

Why aren't my features appearing in ArcGIS.com?

$
0
0

I have an ArcGIS Online web-map that is consuming one feature service published to my ArcGIS Server. I am able to see the the table, and associated rows, but the features do not appear nor am I able to zoom to layer. When I attempt to zoom to the layer, only gray tiles appear.

Things that I have tried; overwriting the service, projecting with WKID 10021 from 4326, re-importing the feature class, re-saving MXD.

What could be the cause of this mysterious behaivor?

The features that I am attempting to use in ArcGIS.com are created via a numpyarraytofeature class script where the spatial references that I have tried are 4326 and 10021, I don’t see this as important as the feature class appears correctly in ArcMap.

ArcGIS Select by Attribute SQL syntax problem

$
0
0

I have a list of aprox 150 unique road names in Excel. I copy and paste (as text option) that list into Word (2013 version). I then “replace” all the end paragraphs (^p) with quotes and commas (‘,’). This gets the list to go from:

Cambie
Blanchard
Cook

to looking like

'Cambie','Blanchard','Cook'

Then within Arc’s Select by Attribute I use this text in the query

Road_Name IN ('Cambie','Blanchard','Cook')

which gives me an SQL error. Any idea why I would be getting the error?

From trial and error I have come to realize that when I paste the text the quotes are a different length than if I had just typed them. See screen shot – the first road name’s quotes (which I pasted) are shorter than the second road name’s quotes (which I typed out in the query box).

enter image description here

When I query the one with the longer quotes by itself it works. Why would my pasted quotes be shorter? Any suggestions as to how I can query the 150 road names without having to re-type every quote?

Change default “My template” directory for Arcmap layout view?

$
0
0

So the default directory for “My templates” for switching the layouts in layout view is C:Usersxxxxappdataraomingesridesktop….. so premade layouts can be accessed quickly. I need these same templates across a couple computers with access to the same network. Is it possible to point this default template folder to another drive, so that they all share the same templates?

Buffering into existing FC (like in Editor menu) in Arcmap 10.3 Model Builder

$
0
0

I would like to buffer features into an existing FC within a GDB, similar to when buffering during an edit session by using the Buffer command in the Editor menu, not the Buffer geoprocess which creates a new FC.

Is there a way to do this in model builder? I can only find the buffering geoprocess tool that makes a new FC. I did consider using this, then selecting the features in the new FC and appending them into the existing FC but that adds a bunch of steps, however so far that seems like the way to get it done.

Ideally I would have a model where:

  1. the user points to a FC to buffer
  2. chooses the type of record in the FC to buffer
  3. chooses which FC to buffer the features into
  4. the model selects by attribute to focus on those records
  5. creates buffers for the records in the existing FC
  6. updates field values in the existing buffer FC for the new records to record what type of record they are from step 2

Any advice on that?

Display coastline

$
0
0

I have a raster converted from shape file(tool point to raster). Can anybody prompt, how to display coastline? I can use contours, but are not focused at condition “elevation = 0″. Is there any simple way?

screen

Colors

colors


How to Save Identify Results

$
0
0

In Arcmap and specifically using a WMS layer that I cannot access the attribute table of, how can I ‘intercept’ or extract the results from using the Identify tool from the toolbar? I would like to piggyback on the identify tool and use the results for my own means. This would be very handy for a WMS layer that I can’t quickly get to the attribute table of. I could identify certain features and then route the feature information into a table for my own use.

With leaflet, I can do something similar by constructing a query against the WMS and using the returned json as feature data.

enter image description here

I hope that I am overlooking something or some tool so basic that already exists for this situation. If so, please let me know.

Added images after Alex’ comment to show that the ‘Select’ option is greyed out. Also the Data > Export is not available for this WMS layer.

enter image description here

Debugging ArcMap Add-In .Net 4.5 : Unable to start ArcMap.exe

$
0
0

I am developping an ArcMap 10.3 Add-In targeting .NET framework 4.5 on Visual Studio 2013. I used ESRI’s wizard to build a simple button add-in and the projects debug properties are configured to start the external program “C:Program Files (x86)ArcGISDesktop10.3binArcMap.exe”.

The add-in ran properly when I started debuggig the Add-In for the first time but I couldn’t get the breakpoints to hit. I followed ESRI recommandation “How to debug” on ESRI online help and modified the ArcMap.exe.config file to enable supported runtime 4.0.30319

<startup>
     <supportedRuntime version="v4.0.30319"/>
      <!-- <supportedRuntime version="v2.0.50727"/> -->
</startup>

The next time I started debuggin the Add-In I get an error message from Visual Studio : “Error while trying to run project: Unable to start program ‘C:Program Files (x86)Desktop10.3binArcMap.exe’.”

Visual Studio 2013 error

This error message comes right after ArcMap’s splash screen. The following screenshot is not from the actual Add-in because the splash screen appears and disappears way too fast and I can’t get screenshot.

ArcMap 10.3 splash screen

I tried different things but without success :

  • build the project using different platforms :”Any CPU” and “x86″
  • changed “ArcCatalog.exe.config” file to use the same supported runtime
  • restarted computer
  • used different supported runtime version: version=”v4.0.30319″, version=”v4.0″, version=”v4.5″

I dont know what to do next to be able to debug the Add-in. I don’t want to develop without this feature!

Any help would be greatly appreciated.

Thanks

Adding PDF (especially GeoPDF) to ArcMap as data?

$
0
0

I receive a lot of PDF maps (vector, image, with georeference and without) and I am having to convert them to an image file before I can add them to ArcMap and georeference.

I can’t see any obvious out-of-the-box utility that would allow me to add and georeference a PDF directly without having to convert to an image file first.

Any ideas?

Drawing line between two selected points in ArcMap using C#? [on hold]

$
0
0

I’m a beginner developer, and I’m trying to draw line between two selected points in ArcMap using c# code.

How can I do this?

Initial state of VB .net checkbox to toggle ArcMap layer visibility

$
0
0

I have a checkbox control as part of an ArcMap add-in with a dockable window in VB .net that turns a particular layer’s visibility on and off in ArcMap. The initial state is set to “unchecked”. But, if I load the tool into ArcMap and use it when that layer is already visible, the checkbox works in reverse (checked when the layer is off and unchecked when the layer is on). Is there any way I can check the visibility of the layer when the tool is first loaded and then set the state of the checkbox?

I tried putting some code in Public Sub New() function for my dockable window, but this crashed ArcMap. Here is what I had (with 3 dots representing other code). My checkbox is named chkBasemap. In this simple example, there are always only 2 layers in my map. I just assume the basemap layer I want to toggle the visibility of is always the second layer. The first layer is a polygon layer.

Imports ESRI.ArcGIS.ArcMapUI
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.CartoUI
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.Framework
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.esriSystem

Public Class DockWinClimateTools

  Public Sub New(ByVal hook As Object)
        InitializeComponent()
        AddItems()
        CheckStates()
        Me.Hook = hook
  End Sub

  Private m_hook As Object
  Public Property Hook() As Object
    Get
      Return m_hook
    End Get
    Set(ByVal value As Object)
      m_hook = value
    End Set
  End Property

  Public Class AddinImpl
    Inherits ESRI.ArcGIS.Desktop.AddIns.DockableWindow

    Private m_windowUI As DockWinClimateTools

    Protected Overrides Function OnCreateChild() As System.IntPtr
      m_windowUI = New DockWinClimateTools(Me.Hook)
      Return m_windowUI.Handle
    End Function

    Protected Overrides Sub Dispose(ByVal Param As Boolean)
      If m_windowUI IsNot Nothing Then
        m_windowUI.Dispose(Param)
      End If
    End Sub
  End Class

  Private Sub chkBasemap_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBasemap.CheckedChanged
      Dim pMxDoc As IMxDocument = My.ArcMap.Application.Document
      Dim pMap As IMap = pMxDoc.FocusMap
      Dim pLayer As ILayer = pMap.Layer(1)

      If pLayer.Visible Then
          pLayer.Visible = False
      Else
          pLayer.Visible = True
      End If

      pMxDoc.ActiveView.ContentsChanged()
      pMxDoc.ActiveView.Refresh()
  End Sub

  Public Sub CheckStates()
        Dim pMxDoc As IMxDocument = My.ArcMap.Application.Document
        Dim pMap As IMap = pMxDoc.FocusMap
        Dim baseLayer As ILayer = pMap.Layer(1)
        If baseLayer.Visible Then
            chkBasemap.Checked = True
        Else
            chkBasemap.Checked = False
        End If
   End Sub
End Class

Near table in ArcMap advanced

$
0
0

I am trying to generate the nearest distance from one set of xy coordinates to another set.

Each of the two datasets has the variables: X, Y, id

I generated a near table to do this (and some other options, but the result is the same).

It calculates the nearest distance but does not give me the id’s, so the distance value is is useless, I need to be able to join attributes from one table to another alongside the distance value.

How do I get correct values for IN_FID and NEAR_FID?

enter image description here

Some output cells show up as noData in ArcMap Block Statistics?

$
0
0

I am using ArcMap 10.2.2, and I need to aggregate categorical data from 30m up to 90m and 900m resolution for species distribution modeling. The algorithms available in resample (nearest neighbor, bilear, etc.) are not appropriate for my purposes, and the Aggregate tool does not have a “majority” option. Thus, I think I have to use the Block Statistics tool. However, I am getting a strange, recurrent error where some cells in the output raster show up as noData. Has anyone else seen this problem? I got the same effects when working with both fgdb rasters and geotiffs. The same apparently random cells show up as noData over multiple runs. The input data does not have any noData cells in the areas where I’m seeing the problem.

As a work around, I can do this in R using the aggregate function in the raster package. Their algorithm is inexplicably slow, though, and it’s more convenient for me to work in Arc if possible. Here are the messages from the results panel, just in case they’re helpful.

Messages

Executing: BlockStatistics NLCD_2011_WV_WGS_1984.tif C:UsersmosteeleDesktopaggregation_testNLCD_2011_WV_90m_ArcMap_version2.tif “Rectangle 3 3 CELL” MAJORITY DATA

Start Time: Thu Jun 25 11:45:37 2015

Succeeded at Thu Jun 25 11:45:40 2015 (Elapsed Time: 2.46 seconds)

Input:
Input

Output (noData in red):

output


Changing Mosaic Dataset Properties in Map Document using ArcPy?

$
0
0

Does anyone know if it is possible in ArcGIS 10.3 for Desktop to access and change mosaic dataset properties within a map document using ArcPy?

I am trying to write text into the symbology description in the boundary layer of a mosaic dataset (not the description field on the layer properties general tab of the mosaic dataset).

marker Symbol alignment along the road

$
0
0

I have created road data and captured bridges as points. during representation i have created bridge marker symbol and was to represent along the respective road.

How to add feature class to MXD with ArcPy (Python)? [duplicate]

ArcMap 'in_memory' trouble?

$
0
0

Being new to ArcMap, and ArcPy I have a problem with a script including several geoprocessing functions.
The number of functions inspired a search for a means to save outputs (subsequent inputs) to memory, leading to the ‘in_memory’ assist provided by ArcMap.

However the following script errors out at the RasterToPolygon_Conversion() and I am unsure why…

import arcpy

arcpy.CheckOutExtension("spatial")
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\Users\Important\testMap.mxd"

DEM_raster_layer = "C:\canyon.tif"
Camera_point_layer = "C:\birdsEye.shp"

# Process: Visibility analysis
arcpy.gp.Visibility_sa(DEM_raster_layer, Camera_point_layer, "in_memory", "",
                      "FREQUENCY", "NODATA", "0.00001201","FLAT_EARTH", "0.13", "", "",
                      "OFFSETA", "", "", "AZIMUTH1", "AZIMUTH2", "VERT1", "VERT2")

# Process: Visibilty boundries cleanup
arcpy.gp.BoundaryClean_sa("in_memory", "in_memory\1", "ASCEND", "TWO_WAY")
arcpy.Delete_management("in_memory")

# Process: Visibility raster to polygon(s)
arcpy.RasterToPolygon_conversion("in_memory\1", "in_memory\2", "NO_SIMPLIFY", "")
arcpy.Delete_management("in_memory\1")

Here is the following error return:

Runtime error Traceback (most recent call last): File “”, line 32, in File “c:arcgisdesktop10.2arcpyarcpyconversion.py”, line 244, in RasterToPolygon raise e ExecuteError: ERROR 000582: Error occurred during execution.

Im guessing there is some syntax or logic mistake in this method?

Using Arcpy to Update Data Source Does Not Update Related Tables

$
0
0

I have a python script that updates the data source of mxd’s from staging to production. Here is an example of the code:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:ProjectMyMap.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
        lyr.findAndReplaceWorkspacePath(r"C:ProjectStagingData.SDE", r"C:ProjectProdData.SDE", False)
mxd.Save()

The script will successfully migrate the data sources of each layer in an mxd. However, any joins or relates defined on the mxd layer will not have their data source updated.

ESRI reported this as a bug in ArcGIS version 10.0 (http://support.esri.com/en/knowledgebase/techarticles/detail/37931) and the bug was supposedly fixed with ArcGIS 10.0 Service Pack 1 (http://downloads2.esri.com/support/documentation/ao_/10.0_SP1_Announcement.pdf)

However, I am still experiencing this problem at ArcGIS 10.2.2 (python 2.7.5, Windows 7). I am testing an mxd that relates spatial tables to an aspatial table in an Oracle database (none of which are registered with SDE). Has anyone been able to successfully update ArcMap data sources including joins and relates using the above arcpy methods? Or is this still a bug?

Viewing all 248 articles
Browse latest View live