How to configure “Same as Display” as processing extent by default in ModelBuilder?

I’m working on a very simple model for creating a path from a selected point to the closest polyline, in this model I used a Cost Distance and Cost Path tool for creating the more feasible track (considering the slope).

Everything works fine, but because I’m using a Cost Raster from a very large area (whole México country) the processing is very slow, so I set the processing extent as “Same as Display”, the problem comes when I select another point from a different extent, the processing extent have to be configured in the model as “Same as Display” other way it is automatically set as “As Specified Below”

enter image description here

What I want to know is if there is a way to configure the Processing Extent as “Same As Display” and it stay like that as default doesn’t matter where I select the point. I want this model to be published on web but I don’t want to add the processing extent as parameter

Create KML from MXD that contains map service layers like feature layers

How can I create a KML (tools suggestion), provided that I have a map (.mxd) file which layers are service layers of hosted services and not local data coming from a geodatabase.
I know that the map to kml tool works only for local data and not with data coming from services.
Any ideas ?

Improving ArcGIS Results saving and manipulating

The ArcGIS Results Window is an incredibly useful way to keep track of what has been done in a particular map. I use it constantly as a means of documenting the essential parts of a project’s workflow, re-using often accessed geoprocessing tools, and archeology (now, what the heck did we use for the input last time? today’s result doesn’t $%^#$%& match!).

However, it’s also frustrating, because some things which ought to be straightforward just aren’t, and it’s easy to inadvertently lose stuff you want to keep. Does anyone have any solutions for these friction points? Namely:

  • ArcCatalog results are not saved at all, if you don’t consciously save them they’re gone baby.
  • ArcMap results are only kept if you save an .mxd. If I created an .mxd every time I needed to do a few things my document management overhead would go through the roof. (Imagine needing to create a .doc for every email of moderate import.)
  • nasty addition to previous: if your ArcMap session crashes, say goodbye to all your results since last save.
  • Many operations never show up in the Results panel (e.g. Context menu >> Data >> Export). As end users, I suspect there’s little to nothing which can be done about this, but it’s related to keeping track of steps and is a frequent source of irritation. ;-)
  • You can drag and drop from Results panel to a model, but not to anywhere else. I want to also copy to a personal toolbar, another map, a folder, a toolbox, a Word document, a … (Wouldn’t it be great if you could just plunk a significant geoprocessing step straight into the metadata editor?)
  • Some results are Favourites that should are kept indefinitely, e.g. this map project will always need to buffer the selection area of interest by 3km. Currently you can set ArcMap to keep results for a few days, months, or forever. The default of 2 weeks is way too short, and forever will get very very messy and ugly.
  • Results stay with the map, this is good, but they are also confined to that one .mxd. They’re in jail; not so good. It’s rare for a project of any significance to have only 1 or 2 .mxd’s. Sharing the results is laborious. (This is actually just a restatement of a previous point; light from another angle reveals more facets.)

  • there is a “Shared” item in the results list (see bottom of graphic), but it doesn’t seem to do anything. You can’t drag a Current or Previous Session into it and it doesn’t have a context menu.

These result things, the record of steps taken, are important. I want to treat them that way. Not as temporary chaff swept up by the night time cleaning staff on the weekends when I’m not around.

This is a rant, but it’s not just a rant. I’m convinced there are means and methods of utilizing what Esri already provides in an improved manner. Let’s flush them out of the brush, dust ‘em off, and dress up for general consumption.

ArcGIS Results panel

Creating TIN, Surface Difference python script with ArcPy?

I have been trying to develop a master script to go through a series of geoprocessing tools and executing them. I am trying to generate a TIN and contours from a raw xyz file. Below is a very simple script that integrates the various tools. I am having difficulty inserting the correct inputs and outputs for the TIN generation and Surface Difference calculation/generation. Let me know if i am missing an input/output specification or a simple default value. I tried doing this same workflow on Model Builder to then export its python script, however i was unable to execute a successful TIN Output since for some reason only allowed for a Raster Output.

Note: I decided not to insert variables, i went directly to its filename.

import arcpy, exceptions, sys, traceback
from arcpy import env
from datetime import datetime

start_time =
print "The program has began processing", start_time

    #Enables ArcGIS 3D Toolbox
    #Set workspace
    env.workspace = "C:Standalone"
    #Set Spatial Reference using Well-Known ID  NAD 27 State Plane Missouri East FIPS
    sr = arcpy.SpatialReference(26796)
    #XYZ Processing to Point Shapefile
    arcpy.ddd.ASCII3DToFeatureClass("", "XYZ","004d1214_el.shp", "POINT", "1",sr,)
    arcpy.AddMessage("Processing Complete")

    #Add XY Coordinates 
    in_features = "004d1214_el.shp"

    #Create TIN surface out of the generated point shapefile
    arcpy.ddd.CreateTin_3d("tin004d1214_el",sr,"C:Standalone04d1214_el.shp POINT_Z Mass_Points <None>","DELAUNAY")

    #Delineate TIN Area. Verify that maximum edge length is greater than the point spacing.
    arcpy.ddd.DelineateTinDataArea("tin004d1214_el", 10, "ALL")

    #Trigger Surface Difference to yield new elevation, Insert optional directories for TIN output
    inSurface = "tin004d1214_el"
    outTin = "tin004d1214_lrp"
    outPoly = arcpy.CreateUniqueName("004d1214_lrp.shp")
    arcpy.SurfaceDifference_3d(inSurface,inReference,"C:Standalone04d1214_lrp.shp",outTin) #Check for syntax

    #Generate Surface Contours off the Reference Survey surface
    arcpy.SurfaceContour_3d(outTin,"004d1214_contours.shp")  #Check for contour field add

except arcpy.ExecuteError:
    print arcpy.GetMessages()
    # Get the traceback object
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    # Concatenate error information into message string
    pymsg = 'PYTHON ERRORS:nTraceback info:n{0}nError Info:n{1}'
            .format(tbinfo, str(sys.exc_info()[1]))
    msgs = 'ArcPy ERRORS:n {0}n'.format(arcpy.GetMessages(2))
    # Return python error messages for script tool or Python Window

end_time =
print ('Duration: {}'.format(end_time - start_time))

Create a specific number points that are equidistant from each other and a constraining polygon

I want to create voronoi data visualizations per a set of constraining polygons, but to show the distribution of data between categories, I first need points that will serve as the reference for thiessan polygon creation.

Is there a way that I can create a specific number of points (these relate to the categories within my data) equidistant from a constraining polygon?

How to calculate frontages of city parcel data in ArcMap 10.0?

I need to calculate the length of polygon frontages (along streets) from our city’s parcel (i.e. lot) data in order to do an analysis on lot frontages in various zoning districts. How can I do this?

Multibuffer in arcpy is too slow?

I have to make multibuffer to a several shp’s (30 or +) and with this code the it takes 30 minutes or more.

    import arcpy,time,glob,os
def multibuffer (probe,Zona_trab,nombarch3,recortes2):
    bufdef = (Zona_trab,"\bufferRing",time.strftime("%H%M%S"),".shp")
    bufferRings = ''.join(bufdef)
    if probe == 1:
        with open (nombarch3) as p:
            for x in recortes2:
                dtaring = p.readline()
                arquet, valbuf2, datperm= dtaring.split(",")
                a= valbuf2*0.3
                b= valbuf2*0.5
                c= valbuf2
                distances = [a,b,c]
                puntselec1a2 = (Zona_trab,"\puntsele",x,".shp")
                puntsele2 = ''.join(puntselec1a2)
                print puntsele2
                print distances
                arcpy.MultipleRingBuffer_analysis(puntsele2,"capadeRingbuff"+str(x)+".shp", distances, "meters", "", "ALL") 
            arcpy.Merge_management(flist, bufferRings)
            print "error"

The code works, it have no errors, so it will work slow, but safe. My question is:

what would you do for speed up the process?


The first part of the program is done instantly, but this call:

arcpy.MultipleRingBuffer_analysis(puntsele2,"capadeRingbuff"+str(x)+".shp", distances, "meters", "", "ALL") 

Make the stop of several minutes in the script.

With this new info, someone know how to speed up this part? Doing several MultipleRingBuffer at once or something like that? (I think is not posible to make that)

Eliminate in Arcpy

I am attempting to move away from Coverages. One of the tools we have did a great job of eliminating slivers from our datasets based on hard and soft boundaries for elimination rulesets; howver, it is programmed in AML and utilizes coverages.

I am working on coding this to Python and have some theory/process questions that I need answered. I have run eliminate in the polygon world before and have found that I needed to do the eliminate multiple times in order to eliminate all slivers. This is due to the fact that there might be multiple slivers adjacent to each other and the elimination process can only remove one of them at a time. In AML, simply, arcs are removed of the polygon shapes that meet the criteria making this a non-issue. So, in the past, I have just iterated through the same eliminate function using the output as the new input until I did not see a reduction in table row counts.

Here is my theory on how to process my datasets so far:

import arcpy, os, sys
from arcpy import env
print 'Starting....'
env.OverWriteOutput = True
import datetime
import time
ts = time.time()
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
print st

fcName = 'C:\David\Eliminate\El_20150122\TSA_PE_L3.shp'
TheLayer = 'C:\David\Delete\ListTest\TheLayer.shp'
OutputLOC = "C:\David\Delete\ListTest\"
myList = set([row.getValue('F_DEL') for row in arcpy.SearchCursor('C:DavidEliminateEl_20150122TSA_PE_L3.shp', fields='F_DEL')])
FCLayer = "C:\David\Delete\ListTest\FCLayer.lyr"
FCsLayer = "C:\David\Delete\ListTest\FCsLayer.lyr"
TheEX2 = "C:\David\Delete\ListTest\TheEX2.lyr"
TableView = "C:\David\Delete\ListTest\TableView.lyr"
Output = "C:\David\Delete\ListTest\Output.shp"

print 'Deleteing existing layers'

if arcpy.Exists(FCLayer):
if arcpy.Exists(OutputLOC + "Exclude.shp"):
    arcpy.Delete_management(OutputLOC + "Exclude.shp")
if arcpy.Exists(TheLayer):
if arcpy.Exists(TheEX2):
arcpy.MakeFeatureLayer_management(fcName, FCLayer)

print 'Selecting blocks for creating the hard boundary exclusion layer'

arcpy.SelectLayerByAttribute_management(FCLayer, "NEW_SELECTION", " "BLOCKS" <> ''")
arcpy.FeatureClassToFeatureClass_conversion(FCLayer, OutputLOC, "Exclude")
arcpy.SelectLayerByAttribute_management(FCLayer, "CLEAR_SELECTION")
Name4 = OutputLOC + "Exclude.shp"
arcpy.MakeFeatureLayer_management(Name4, TheEX2) # last input into eliminate

print 'Finished creating exclusion layer'
print 'Creating copy of dataset for elimination'

arcpy.FeatureClassToFeatureClass_conversion(fcName, OutputLOC, "TheLayer")
#myList = set([row.getValue('F_DEL') for row in arcpy.SearchCursor("'"+Name2+"'", fields='F_DEL')])

print 'Finished creating layer'
print 'Working on elimination of slivers'

for a in myList:
    #print '"F_DEL"= {}'.format('"'+a+'"')
    Last = 1
    Count = 2

    while Count <> Last:
        print "Count = " + str(Count) + ", and Last = " + str(Last) 

        Count = Last

        if arcpy.Exists(FCsLayer):
        arcpy.MakeFeatureLayer_management(TheLayer, FCsLayer)
        if arcpy.Exists(Output):

        arcpy.SelectLayerByAttribute_management(FCsLayer, "NEW_SELECTION", " "AREAHA" <= 0.1")
        arcpy.SelectLayerByAttribute_management(FCsLayer, "REMOVE_FROM_SELECTION", " "BLOCKS" <> ''")
        arcpy.Eliminate_management(FCsLayer, Output, "AREA", '"F_DEL" = {}'.format("'" + a + "'"), TheEX2)

        arcpy.CopyFeatures_management(Output, TheLayer)

        if arcpy.Exists(TableView):

        Last = arcpy.GetCount_management(TableView)
        ts2 = time.time()
        st2 = datetime.datetime.fromtimestamp(ts2).strftime('%Y-%m-%d %H:%M:%S')
        print st2

So this script is working but it is taking forever and will not get out of the While loop when LAST = COUNT. Are there any ways to improve the processing time of this? This is still working on one group of F_DEL to which there are 11 and then once this test is complete I will be iterating this on 12 different layers (12 layers X 11 hours per layer = 7 days of processing). In coverage world this would process in 2 hours.

enter image description here

Unable to view my local geoserver in that dropdown menu of Open Geosuite 4.5 Version?

I’m using GeoExplorer(Web Map Client) in Open Geo Suite4.5 version. I use to upload the layers from my LocalGeoserver by clicking on Add Layers Button. But now i’m unable to view my local geoserver in that dropdown menu.

How can I troubleshoot this problem?

run the GP tool “create enterprise gdb” from ArcObjects

hello i work with arcobjects and , i try to create entreprise geodatabase in Postgresql using the following code

using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.DataManagementTools;

public void create_ent_geodatabase()
        Geoprocessor gp = new Geoprocessor();
        CreateEnterpriseGeodatabase ceg = new CreateEnterpriseGeodatabase();

        ceg.database_platform = "PostgreSQL";
        ceg.instance_name = "localhost";
        ceg.database_name = "database";
        ceg.database_admin = "postgres";
        ceg.database_admin_password = "password";
        ceg.gdb_admin_name = "sde";
        ceg.gdb_admin_password = "password";
        ceg.authorization_file = @"D:server10.2.ecp";

        gp.Execute(ceg, null);

but the operation failed i get the following message :
Error HRESULT E_FAIL has been returned from a call to a COM component.” at “gp.Execute”

any help will be appreciated!

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam