Quantcast
Channel: Question and Answer » arcgis-10.3
Viewing all 155 articles
Browse latest View live

How do I create full-resolution footprints in an ArcGIS mosaic dataset?

$
0
0

In ArcGIS Desktop 10.3, I want to create full resolution footprints in a mosaic dataset to avoid having black areas in the mosaic. When I create footprints (“Build Footprints” tool) using the default 2000×2000 sampling (the “Request Size” parameter), the mosaic will have black areas along the edges of images:

low-res footprints

enter image description here

These pixels are RGB=0,0,0. To avoid the black, I want the footprints to have pixel-level precision, and I don’t mind waiting for the tool to calculate them. So I set the “Request Size” parameter to -1, which “will compute the footprint at the original resolution”, according to the documentation. The result is indeed a new set of footprints with pixel-level precision. But unfortunately, the footprints don’t actually follow the edge of the image data. The result is pretty perplexing:

high-res footprints

enter image description here

Some 0,0,0 cells are included in the footprint, and some aren’t. And it seems almost random where the line is drawn. These jagged boundaries are all over the mosaic. This could very well be a bug, but it’s also entirely possible that I’m doing something wrong. What might I be missing?

In case it helps, here is the entire command, with all parameters (most were defaults):

arcpy.BuildFootprints_management(in_mosaic_dataset=”mos”, where_clause=”", reset_footprint=”RADIOMETRY”, min_data_value=”1″, max_data_value=”255″, approx_num_vertices=”-1″, shrink_distance=”0″, maintain_edges=”NO_MAINTAIN_EDGES”, skip_derived_images=”SKIP_DERIVED_IMAGES”, update_boundary=”UPDATE_BOUNDARY”, request_size=”-1″, min_region_size=”100″, simplification_method=”NONE”, edge_tolerance=”", max_sliver_size=”20″, min_thinness_ratio=”0.05″)


ArcCatalog won't close/exit normally, toolbars disappear instead or it crashes

$
0
0

I’ve had this problem since v10.2 of ArcGIS Desktop, I recently upgraded to 10.3 and it still exists. The problem is that ArcCatalog cannot be closed normally. If I try to close it using the Windows close button (red X in Windows 7), instead of closing, all my toolbars disappear, including the menu toolbar. If I try to close it using File > Exit or by pressing Alt-F4, it crashes with the message:

ArcGIS for Desktop has encountered a serious application error and is
unable to continue.

On the bright side, at least that closes the program. This problem doesn’t affect ArcMap.

So if I use the Close button in ArcCatalog, I go from this:

enter image description here

To this:

enter image description here

The only way to close the program at that point is to kill the process in Task Manager or crash it using Alt-F4. Has anyone else had this problem and solved it? The only info I could find about it online concerned an issue in ArcGIS that was fixed in v10.1 SP1.

Why can't I modify a python script tool or delete the toolbox it's in?

$
0
0

So I started getting this weird error for what I thought was no apparent reason:

Executing: saveTile
Start Time: Tue Apr 28 20:19:17 2015
Running script saveTile...
Failed script saveTile...

Traceback (most recent call last):
  File "C:Image_ProcessingPython_Scripts_AutomationSave_Tile_Automation.py", line 236, in <module>
    arcpy.createDashboardReport_ipauto(sReports3, sDatetime)
  File "C:Image_ProcessingImage_Processing_Automation.tbx", line 23, in createDashboardReport
    AttributeError: Object: Tool or environment <createDashboardReport_ipauto> not found

Failed to execute (saveTile).
Failed at Tue Apr 28 20:20:29 2015 (Elapsed Time: 1 minutes 12 seconds)

The tool had been working and it all of a sudden stopped working. Then I got looking, and it seems I no longer have access to the tool. When I open its properties, I can’t change the path of the script. I also can’t modify the parameters. And the delete option is grayed out when I right click on the toolbox:

enter image description here

Is there a lock on it somewhere? Has anyone seen this before, or know how to fix it?

Using Python add-in wizard with ArcGIS 10.3 for Desktop?

$
0
0

I’d like to create an add-in for ArcMap (ArcGIS 10.3) using Python. Unfortunately, the wizard does not seem to have been updated for 10.3, which is the only version Esri provides for download at present (AFAIK). I don’t have any other version installed, and never did because I’m starting fresh on a new PC.

Is there a wizard for 10.3?

If not, is there good documentation about what the wizard did for 10.1 and 10.2? If it only creates an XML document supplying the metadata and the name of the Python class to be instantiated on button-push, I’m sure I can replicate that. I just can’t find any detailed information from ESRI; the help documents discuss the wizard as though it is the only option.

Divide grid in smaller cells

$
0
0

My dataset: a shapefile containing squares of 1km size. It’s huge, this is just a sample:
enter image description here

My aim: divide each cell so that the end result would be the same grid with 500m each cell. Something like this:
enter image description here

Since the grid is huge I would need a way to make these squares smaller automatically. Any ideas on how to do it in ArcGIS 10.3?

How to remove layers that are not in visible df extent

$
0
0

I am working on ArcMap 10.3 and I have a map with 50 layers in it.

I am trying to check if layers are in a data frame.

Unlike How to check if layers in a dataframe with Arcpy, I want to define the area to the current data frame.

My code is:

import arcpy,os,sys,string
import arcpy.mapping
from arcpy import env


env.workspace = r"C:Project"
for mxdname in arcpy.ListFiles('*.mxd'):
     print mxdname
     mxd = arcpy.mapping.MapDocument(r"C:Project\" + mxdname)
     df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
     data_frame = df
     for lyr in arcpy.mapping.ListLayers(mxd,"",df):
          if lyr in data_frame == False:
               arcpy.mapping.RemoveLayer(df, lyr)
               print lyr     
     mxd.save()
del  mxd 

and I get:

 >>> 
Project.mxd
>>> 

but no layers have been removed.

Using Python new line (n) with ArcGIS geoprocessing progress dialog? [closed]

$
0
0

I am currently using in my ArcGIS 10.3 toolbox script;

# Get the spatial reference
spatialRef = arcpy.Describe(template).spatialReference.name 

#Loop through shapfiles in folder and reproject
for fc in fcList:
fcspatialRef = arcpy.Describe(fc).spatialReference.name
if fcspatialRef != spatialRef:
    arcpy.Project_management(fc, outFolder + "\" + fc, template) 

# Print shapefile Project results 
arcpy.AddMessage("n" + fc)

# Return any errors   
except:
arcpy.AddMessage(arcpy.GetMessages())   

Is there a way to seperate these results in the geoprocessing dialog window by a line spacing because it looks cluttered?

arcpy.AddMessage("n" + fc)   

kind of works but gets;

Running script Project…

abc.shp

xyz.shp

123.shp

How can I make the list like this please?;

![enter image description here][1]


Error 000192 in Make VRP with Python scripting in ArcGIS 10.3

$
0
0

I’ve written a piece of python code in ArcGIS 10.3 for applying VRP. pretty similar to sample code in Esri resource website.

But, it gives an error: ERROR 000192: Invalid value for Time Impedance

I figured out that time attribute which has been identified in network dataset is double whereas timeAttribute in VRpsolve classe in arcpy should be string. So, when I define a constant attribute for time in my network dataset, this code works. But, I can not define a string cost value for time.

There was a similar question [here][1], but the answer doesn’t fit to my problem as I’m using version 10.3

Meanwhile, when I’m using Network Analyst toolbox with the same layers, it works. So, problem is in my python code

    import arcpy
    from arcpy import env

    try:
        arcpy.CheckOutExtension("Network")
        env.workspace = "C:\Drivers\Eli\ArcGIS\VRP\"
        env.overwriteOutput = True
        inNetworkDataset = "C:\Drivers\Eli\ArcGIS\VRP\Road_BNE_ND.nd\Road_BNE_ND"
        outNALayerName = "results_MakeVRP"
        impedanceAttribute = "Travel_Tim"
        distanceAttribute = "Length"
        timeUntis = "Minutes"
        distanceUntis = "Meters"
        inOrdersClass= "orders.shp"
        inDepotClass = "POB.shp"
        inOrders = "orders"
        inDepots = "POB"
        inRoutes = "route"
        outLayerFile = "C:/Drivers/Eli/ArcGIS/VRP/" + outNALayerName + ".lyr"
        outNALayer = arcpy.na.MakeVehicleRoutingProblemLayer(inNetworkDataset, outNALayerName,
                                                             impedanceAttribute,
                                                             distanceAttribute, timeUntis,
                                                             distanceUntis, "", 1,
                                                             UTurn_policy = "NO_UTURNS",
                                                             output_path_shape = "STRAIGHT_LINES")

        outNALayer = outNALayer.getOutput(0) 
        subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
        ordersLayerName = subLayerNames["Orders"]
        depotsLayerName = subLayerNames["Depots"]
        routesLayerName = subLayerNames["Routes"]
        candidateFields = arcpy.ListFields(inOrders)
        orderFieldMappings = arcpy.na.NAClassFieldMappings(outNALayer, ordersLayerName,
                                                           False, candidateFields)
        orderFieldMappings["TimeWindowStart1"].defaultValue = "9 AM"
        orderFieldMappings["TimeWindowEnd1"].defaultValue = "5 PM"
        orderFieldMappings["DeliveryQuantities"].mappedFieldName = "Demand"
        orderFieldMappings["MaxViolationTime1"].defaultValue = 0
        arcpy.na.AddLocations(outNALayer, ordersLayerName, inOrders, orderFieldMappings,"")

        depotFieldMappings = arcpy.na.NAClassFieldMappings(outNALayer, depotsLayerName)
        depotFieldMappings["Name"].mappedFieldName = "Name"
        depotFieldMappings["TimeWindowStart1"].defaultValue = "8 AM"
        depotFieldMappings["TimeWindowEnd1"].defaultValue = "5 PM"
        arcpy.na.AddLocations(outNALayer, depotsLayerName, inDepots, depotFieldMappings, "")

        arcpy.na.AddLocations(outNALayer, routesLayerName, inRoutes, "", "")

        arcpy.na.Solve(outNALayer)

        arcpy.management.SaveToLayerFile(outNALayer,outLayerFile,"RELATIVE")

        print "Script completed successfully"

    except Exception as e:
        # If an error occurred, print line number and error message
        import traceback, sys
        tb = sys.exc_info()[2]
        print "An error occured on line %i" % tb.tb_lineno
        print str(e)

Error 999999 “The table already exists”“No spatial reference exists” when using “import arcserver”

$
0
0

I’m hoping someone can help me understand why I’m getting this error. I have a python script tool that throws this error when it is run through the task scheduler:

Traceback (most recent call last):
  File "C:Image_ProcessingPython_Scripts_Automation_CACreate_Report_Automation.py", line 474, in <module>
    arcpy.RasterCatalogToRasterDataset_management(pathRasterCatalog, scratchGDB + "/raster1", where_clause="Name = '" + sSingleImage + "'")
  File "c:program filesarcgisserverarcpyarcpymanagement.py", line 13319, in RasterCatalogToRasterDataset
    raise e
ExecuteError: ERROR 999999: Error executing function.
The table already exists.
No spatial reference exists.
Failed to execute (RasterCatalogToRasterDataset).

However, when I run it through arcmap, it runs fine. The only difference between the two instances is when I run it through the task scheduler, I use import arcserver, and when I run it through arcmap, I have to comment out that line. At first I thought it was something to do with the raster catalog, but then I started getting the exact same error when I added an arcpy.Clip_management() tool to the code, which doesn’t use the raster catalog. And I’ve checked the spatial references on all of the suspect data, and it does exist. So I’m at a loss. Is it something to do with the scratch GDB?

Unable to connect to “Database Connections/.sde” from python

$
0
0

I just upgraded to 10.3.1 and now I am having issues running my administrative tasks set with Python scripts.

I am unable to use the string “Database Connections/some.sde”, i.e:

arcpy.ListUsers("Database Connections/some.sde) Returns the following error:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
userList = arcpy.ListUsers("Database Connections/some.sde")
File "C:Program FilesArcGISServerArcPyarcpy__init__.py", line 1058, in ListUsers
return utils.listofnamedtuples(gp.listUsers(sde_workspace), 'user')
File "C:Program FilesArcGISServerArcPyarcpygeoprocessing_base.py", line 504, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
TypeError: Could not open SDE workspace.

I can use the full path string for some tasks like ListUsers, AcceptConnections,etc., but not others like reconcile and post, e.g.:

“C:Users%username%AppDataRoamingESRIDesktop10.3ArcCatalogsome.sde”

Fails without throwing error at: arcpy.ReconcileVersions_management("C:Users%username%AppDataRoamingESRIDesktop10.3ArcCatalogsome.sde","ALL_VERSIONS","DBO.QC","DBO.Chris;DBO.Joe","LOCK_ACQUIRED","NO_ABORT","BY_OBJECT","FAVOR_EDIT_VERSION","POST","KEEP_VERSION","#")

The full script is here, which worked great prior to 10.3 upgrade: reconcile and post script

In ArcCatalog I have created these database connections, they work fine, I can browse in Catolog, and the .sde files exist in my AppData/Roaming/ESRI subdirectory. I have tried copying all my old connection strings from the 10.2 into my roaming profile. Is there some environmental variable that needs to be repaired? Do I need to re-install Server and Desktop on this machine?

Question: How can I repair my “Database Connections” to run Python scripts

How to rotate a simple 3d Bar graph in ArcMap 10.3

$
0
0

I want to show a series of data on one chart in ArcGIS. Is there an option to rotate a simple 3d graph on ArcMap? I attach a 2 values example without rotation.enter image description here

How to use hadoop tools in ArcMap 10.3?

$
0
0

I have downloaded hadoop tools for ArcMap and installed. In the ArcToolboxe window the hadoop tools are displayed.
In the hadoop toolbox the “Copy from HDFS” tool is asking for an HDFS server hostname, TCP port number, username and remote file. I’m having hard time getting these right. Please tell about the values to be typed in the host name, username and port number.
I’m using “Cloudera VMWare” for analyzing the data using hive queries.enter image description here

import arcpy failed Python 2.7 with ArcGIS 10.3 64-bit Background geoprocessing RuntimeError: NotInitialized

$
0
0

I want to run a python script that uses arcpy. It was running earlier on a 32-bit machine without problems. On a 64-bit machine I get a MemoryError. The 64-bit backgroundgeoprocessing of ArcGIS 10.3 should solve this problem. If I type import arcpy to the IDLE which is 64-bit too I get the following error message:

Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    import arcpy
  File "C:Program Files (x86)ArcGISDesktop10.3arcpyarcpy__init__.py", line 21, in <module>
    from arcpy.geoprocessing import gp
  File "C:Program Files (x86)ArcGISDesktop10.3arcpyarcpygeoprocessing__init__.py", line 14, in <module>
    from _base import *
  File "C:Program Files (x86)ArcGISDesktop10.3arcpyarcpygeoprocessing_base.py", line 598, in <module>
    env = GPEnvironments(gp)
  File "C:Program Files (x86)ArcGISDesktop10.3arcpyarcpygeoprocessing_base.py", line 595, in GPEnvironments
    return GPEnvironment(geoprocessor)
  File "C:Program Files (x86)ArcGISDesktop10.3arcpyarcpygeoprocessing_base.py", line 551, in __init__
    self._refresh()
  File "C:Program Files (x86)ArcGISDesktop10.3arcpyarcpygeoprocessing_base.py", line 553, in _refresh
    envset = (set(env for env in self._gp.listEnvironments()))
RuntimeError: NotInitialized

To make sure I installed everything correctly:
ArcGIS 10.3 (Advanced Concurrent License);
ArcGIS 10.3 64-bit backgroundgeoproessing patch;
Python 2.7.9 x64

I also adapted the system paths fron …bin to bin64 and from Python27ArcGIS10.3 to ArcGISx6410.3

“From PDF” toolset not available in 10.3

$
0
0

I’m running ArcMap 10.3 and there is no “From PDF” toolset available in my conversion tools list. Also, trying to use the ArcPy PDFToTIFF_conversion method fails.

"From PDF" missing

Specifically ArcMap is version 10.3.0.4284

Python is version 2.7.8 (downloaded & installed from my esri portal)

I think my version upgrades on this machine have gone from 10.1 > 10.2.2 > 10.3. I do not have ArcGIS Pro installed, just ArcMap 10.3 Basic.

Am I missing something, does anyone have any idea on what to check or look for?

Edit: found the install folder and it looks like I might be running 10.3 prerelease. I am going to reinstall 10.3 and see what happens.

enter image description here

ArcMap fails to add rasters to mosaic dataset?

$
0
0

I couldn’t figure out why ArcMap 10.3 fails to add rasters to the mosaic dataset. The following messages are displayed in the results

Image server is not supported with the current license
Server object instance creation failed on machine
Error: 80040213: configuration rastercommander.Imageserver cannot be started
Error: 8004206f: could not initialize the mosaic dataset's parallel processing engine
Error: 8004204b: Cannot synchronize mosaic dataset items associated with the specified raster type instance.

enter image description here


Portal for ArcGIS WMTS layers are optimised & un-cacheable

$
0
0

When a WMTS in Portal for ArcGIS 10.3.1 is opened (via Portal) in an mxd, the WMTS layer properties are not standard. The; Source, Layers, and Advanced tabs are missing. When the portal WMTS layer used as an input into arcpy.ExportMapServerCache_server() it fails without any errors.

I’ve discovered that if you copy and paste the layer into the same data frame, the layer regains all of it’s normal properties. I think the portal extracted layer is actually put in a hidden optimized base map layer.

I need to use ArcPy to cache this service locally as a part of a greater user workflow. However beofre I proceed I need a method to handle this “optimized portal WMTS layer”.. Has anyone experienced this and then figured out a way around it?

enter image description here

Zonal statistics (and other tools) will not output all records in ArcGIS for Desktop? [closed]

$
0
0

Using ArcGIS 10.3 for Desktop, whenever I use zonal statistics, only about 90-95% of the records actually show up in the results. The remainders are blank though, if I navigate to that polygon, there is data present.

I’ve tried doing this in and out of geodatabase environments, with different shapefiles and rasters as my inputs, and still the same thing. It just seems to ‘max out’ in some way and not return all of the records. Often, the number of records returned on the same calculation is different. The same things happens if I use the Spatial Analyst 2 toolset, or an independent toolset I downloaded meant to calculate zonal statistics for overlapping polygons.

Anyone have any ideas?

Import symbology to specific unique value in ArcMap?

$
0
0

I am working with arcview 10.3. I trying to change the symbology of unique value “43″ in layer “Total” to the same symbology as in layer “a2-land”.

enter image description here

but in the layer properties when i choose import button i can’t find option to do it

enter image description here

and as a result the whole “Total” layer’s symbology turn to the same as layer “a2″. The problem is that all other unique value in layer “Total” disappear and i do want that other values: 574,431,155, will remain the same as before:

enter image description here

thanks for any help

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?

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

Viewing all 155 articles
Browse latest View live