|
POST
|
Hi Sol, and thanks for the hint! That has to be sufficient. I rather go every time through the whole file structure than crashing my processes. The models, scripts can't be scheduled to run later... they run several days anyway. Working on national datasets and big cohort data comes with its own challenges. 😉 Bests, Thomas
... View more
06-11-2014
05:08 AM
|
0
|
0
|
478
|
|
POST
|
Hi, is there any way to avoid getting a error 210 when running one instance of ArcMap or ArcCatalog, doing some geo-processing and starting another instance of ArcMap or ArcCatalog? It is very frustrating when your software is opening the Add Data dialog or a Save Data dialog while some model or Python script is working in that folder/database. The result seems obvious... the model or the script crash, unable to write any longer to the location! Bests Thomas
... View more
06-11-2014
04:52 AM
|
0
|
1
|
842
|
|
POST
|
Hi, I want to do a routing for an incinerator and have different companies in the supply chain. Of course the amount of waste offered by a single company is exceeding the capacity of the truck. The result of that is that non of the locations with pickup quantities above the truck load is considered for the routing. In reality, it would be necessary that in a fleet of vehicles the waste supplied by one point is shared, or a single vehicle is routed until all the waste is picked up. I there a way to do this? Bests, Thomas
... View more
12-09-2013
04:58 AM
|
0
|
1
|
635
|
|
POST
|
Thanks Jake, that worked. Does the company know why that can happen? Will ArcGIS 10.2 overcome the problem? Cheers Tom
... View more
08-20-2013
06:14 AM
|
0
|
0
|
1661
|
|
POST
|
Hi Mark, yes, I can load them into ArcMap and also open them. yes, I can access their properties using arcpy.Describe() t1 = "path/to/fgdb/and/table"
desc = arcpy.Describe(t1)
print desc.DataType results in u'Table' arcpy.Exists(t1) comes back with True yes, I also did try to access them from a stand-alone script I also did try to get the tables via arcpy.da.Walk, but there was nothing to append to a previous created list. Tom
... View more
08-20-2013
05:42 AM
|
0
|
0
|
1661
|
|
POST
|
Hi, I am working with ArcGIS 10.1 SP1 and I try to list tables from within a file geodatabase. I set the workspace to the specific geodatabase and write: lstTables = arcpy.ListTables() len(lstTables) The result of this is an empty list. I can reproduce this using external scripts, and when using the Python window within ArcMap or ArcCatalog. I can see all the tables in ArcCatalog and I can have a preview of them... However, to list them is impossible. it is also impossible to copy them into another FGDB. The attempt to copy the tables ends in crashing ArcMap or ArcCatalog. When I try to list all the feature classes in the same FGDB then I have no problem and I get the correct result. Any solution for this problem? Bests Tom
... View more
08-20-2013
05:13 AM
|
0
|
5
|
1939
|
|
POST
|
Hi Vince, it would be nice if I could keep everything in scratch but either I didn't figure it yet out, or it is not possible. One example: I have 2500 points, a road network and 2400 polygons... I want to know what is the shortest route from each of the 2500 points to every polygon. So, I create all the intersection points (70.000) for the road network with the polygons and use the network analyst to do the routing for every point, using an OD Cost Matrix. That includes an iteration over the 2500 points. Since there are always a couple of intersection-points per polygon I have to figure out what the shortest route is. For that I am using the 'Statistics_analysis' function... So far I did not find a possibility to get to that point without writing the result at one point out of memory. Would be really glad if there is a way. Cheers Thomas
... View more
08-12-2013
06:56 AM
|
0
|
0
|
692
|
|
POST
|
Hi everybody, while working with Python scripts or with ModelBuilder, at some point I usually end up that I have to write some data to my HDD instead of keeping it in memory. The result might be that I create a couple thousand featureclasses where every single one might hold tens of thousands features. Since those featureclasses still represent only temporary products they need to be deleted in a later step. When I try this in a script I would use 'ListFeatureClasses' with some wildcard and a for-loop to delete the items. That will finally not work, for whatever reason and the script will crash. If I try the same thing in ArcCatalog by selecting the featureclasses and go for the delete button then ArcCatalog will simply get unresponsive and finally the system tells me that the application stopped working. The only way I found so far is to use the Python window from within ArcCatalog or ArcMap, list all the classes of interest, do the for-loop and delete the files listed. --> That's terrible slow!!! I have three questions: How can it be that the same code works in the Python window, but not in an external script? Is there a way to speed up the process of deleting the files? Since ArcSDE is invoked in ArcGIS Desktop, is there a way to use SQL to access the FGDB and delete the data that way? Bests Thomas
... View more
08-12-2013
06:12 AM
|
0
|
3
|
1120
|
|
POST
|
Hi, I have some speed issues with the datasets I am using to find the shortest route. I have a road network, the points of origin and the destination points in one file geodatabase. Points of origin I have 2500 and destination points I have a bit more than 74.000! The script I wrote works but process is really slow and during the process my hard drive is getting filled up with some temporary data. In the following there is the script I'm using to process the data and it would be great if some of you could have a look at it and point out how to speed up process. import arcpy, gc
arcpy.env.workspace = 'D:/Projects/gis/processed/Network/Distance.gdb/'
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension('Network')
network = 'DM/DMnetwork_ND'
origin = 'data/Start_N2500'
destination = arcpy.MakeFeatureLayer_management('data/rIntersect_0Tolerance', 'in_memory')
fail = []
okay = []
OD_Cost_Matrix = arcpy.MakeODCostMatrixLayer_na(network, 'OD Cost Matrix', 'Length', '' , '', '',
'ALLOW_UTURNS', '', 'NO_HIERARCHY', '', 'STRAIGHT_LINES', '')
arcpy.na.AddLocations(OD_Cost_Matrix, 'Destinations', destination, 'Name Areas #', '5000 Meters', '',
'DMnetwork SHAPE;DMnetwork_ND_Junctions NONE', 'MATCH_TO_CLOSEST', 'APPEND',
'NO_SNAP', '5 Meters', 'INCLUDE', 'DMnetwork #;DMnetwork_ND_Junctions #')
arcpy.Delete_management(destination)
for row in arcpy.da.SearchCursor(origin, ['Respondent']):
expr = 'Respondent = ' + str(int(row[0]))
arcpy.na.AddLocations(OD_Cost_Matrix, 'Origins', origin, 'Name Respondent #', '5000 Meters', '',
'DMnetwork SHAPE;DMnetwork_ND_Junctions NONE', 'MATCH_TO_CLOSEST', 'CLEAR',
'NO_SNAP', '5 Meters', 'INCLUDE', 'DMnetwork #;DMnetwork_ND_Junctions #')
try:
arcpy.Solve_na(OD_Cost_Matrix, 'SKIP', 'TERMINATE', '')
output = 'Min_Output_' + str(int(row[0]))
tmpLyr = arcpy.MakeFeatureLayer_management('OD Cost Matrix/Lines', str(int(row[0])), '', '', 'ObjectID ObjectID HIDDEN NONE;Shape Shape HIDDEN NONE;Name Name VISIBLE NONE;OriginID OriginID VISIBLE NONE;DestinationID DestinationID VISIBLE NONE;DestinationRank DestinationRank HIDDEN NONE;Total_Length Total_Length VISIBLE NONE')
arcpy.Statistics_analysis(tmpLyr, output, 'Total_Length MIN', 'OriginID;DestinationID')
arcpy.Delete_management(tmpLyr)
okay.append(output)
print str(int(row[0])) + ' processed'
except:
fail.append(int(row[0]))
arcpy.Merge_management(okay, 'finaloutput')
arcpy.Delete_management(origin)
arcpy.Delete_management(tmpLyr)
for item in okay:
arcpy.Delete_management(item)
gc.collect() As I mentioned my hard drive is getting flooded and it all happens in 'C:\Users\TomGeo\AppData\Local\Temp'. I'm talking about more than 100GB that are written to the directory and I wonder why such a data amount is created. Thanks in advance for your comments! Bests Thomas
... View more
07-22-2013
11:58 PM
|
0
|
0
|
2211
|
|
POST
|
Dear all, I'm trying to install Geoportal on a Linux machine following manual. It is written at page six " Create the user like you created the geoportal user, but do not make it a member of the wheel or sudo group." However, when trying to set up Geoportal user and Geoportal schema in PostgreSQL (page 10) then I'm asked to give the password for postgres... [sudo] password for postgres . The password I assigned to the user postgres when creating it as written at page six will not work at this point and I'm a bit confused about the "[sudo]" when being asked for the password. Do I have to make postgres member of the sudo group or how do I overcome that problem? Also, can you confirm that I have to change some lines in grants_linuxpg.sh and create_schema_linuxpg.sh since they otherwise come back with some error about and unexpected "("? I'm working with Linux Mint 14 (Debian related in the context to the manual linked above). Cheers Thomas
... View more
04-22-2013
05:37 AM
|
0
|
0
|
1757
|
|
POST
|
Hi Chris, thanks for the download link and pointing out to look at the Python window! I was aware that win32com is an extra module to install and so I did. What I was not aware of, was the fact that the Python interpreter used is the 32bit and I am normally using arcpy in the 64bit version. Installing the 32bit version helped a great deal and then it was only that the mxd didn't have a description that kept me from succeeding. Works now and I'm looking forward to some nice Python tools! 🙂 Cheers Thomas
... View more
03-13-2013
11:44 PM
|
0
|
0
|
1542
|
|
POST
|
Yes, I did 'compile' it into an extension, installed it and did run it in ArcMap 10.1. As I wrote earlier, I'm getting the extension to chose, the toolbar to activate and the button of the tool to click. Also the change of cursor works and drawing the rectangle. It just looks like handing over the extend of the drawn rectangle doesn't work. The method to create the map package as such is simple and I can't see where it should go wrong there. Thomas
... View more
03-13-2013
02:19 PM
|
0
|
0
|
1542
|
|
POST
|
Hi everybody, I was just watching the introduction to Desktop Add-Ins using Python and was trying to create the exact same add-in shown in the video. I can't find any flaws in the code I have written and the Add-In was created and installed without any problem. The toolbar is there and the button with the icon on it as well. When I click the button the cursor is changing to the cursor type specified in the code and I can draw a rectangle on the map canvas. However, there is nothing shown that the system is busy creating the map package and there is non produced. Needless to say that Outlook does not open a new email... The code to define the function you can find below and it would be nice if you can tell why it does not work. On the account of not working... There is an import of module 'pythonaddins' and I get it marked as an unresolved import (that's in Eclipse/PyDev). Also when I use the Python shell, importing that particular module results in 'ImportError: No module named pythonaddins' Cheers Thomas import arcpy import pythonaddins class CreateMPKExt(object): """Implementation for CreateMapPackage_addin.mpkext (Extension)""" def __init__(self): # For performance considerations, please remove all unused methods in this class. self.enabled = True def activeViewChanged(self): try: if arcpy.mapping.MapDocument('Current').activeView == 'PAGE_LAYOUT': mpktool.enabled = False else: mpktool.enabled = True except NameError: pass class CreateMPKTool(object): """Implementation for CreateMapPackage_addin.mpktool (Tool)""" def __init__(self): self.enabled = True self.shape = "Rectangle" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks. self.cursor = 3 def onRectangle(self, rectangle_geometry): import os, win32com.client #Get reference to current map document and set paths to Document and output package mxd = arcpy.mapping.MapDocument('Current') mxdPath = mxd.filePath print "MXD Path: {0}".format(mxdPath) mxdName = os.path.basename(mxdPath)[0:-4] mxdDir = os.path.dirname(mxdPath) pkgPath = os.path.join(mxdDir, mxdName + ".mpk") print "Package Path {0}".format(pkgPath) #Check to see if package already exists and delete, then create map package if os.path.exists(pkgPath): os.remove(pkgPath) print "Succesfully deleted existing package: {0}".format(pkgPath) arcpy.PackageMap_management(mxdPath, pkgPath, extent=rectangle_geometry) #Open new email in Outlook and attach the Map Package outlook = win32com.client.Dispatch("Outlook.Application") email = outlook.CreateItem(0) email.Subject = "Map Package Area of Interest" email.Attachments.Add(pkgPath) email.Display()
... View more
03-13-2013
10:17 AM
|
1
|
5
|
4185
|
|
POST
|
The print loop comes back empty as well... The weird thing is that one day there are no problems with it and the other one I have the stuff going on that currently happens. I restarted the machine, took care of unused objects etc. The script works and some time the machine has ha bad day and isn't cooperating. :confused: It's installed on a Windows Server 2008 R2, has plenty of RAM and memory on the HDD... However, I created a new File Geodatabase, created the Feature Datasests and copied all the Feature Classes into the new GDB... now it works!?! Thomas
... View more
10-11-2012
02:36 AM
|
0
|
0
|
1366
|
|
POST
|
Dear all, I have a problem that comes and go's. Currently is is again immanent and I wonder what's causing it. Working with ArcGIS 10 and using straight the IDLE from Python... >>> import arcpy
>>> from arcpy import env
>>> env.workspace = r"Path\\to\\database.gdb"
>>> lstFDS = arcpy.ListDatasets("*", "FEATURES") # returns list of three items - correct
>>> lstPOLY = arcpy.ListFeatureClasses("*", "POLYGON", lstFDS[2])
>>> lstPOLY
[] The dataset requested is holding almost 200 feature classes, all of them loaded with polygons. I see all of them in ArcCatalog, but not in Python! Anybody an idea? I already had a took care of remaining objects and invoked the garbage collector by hand but nothing. Cheers Thomas
... View more
10-11-2012
01:44 AM
|
0
|
2
|
2836
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-24-2022 01:23 AM | |
| 1 | 09-15-2021 01:21 AM | |
| 1 | 08-30-2022 04:31 AM | |
| 2 | 04-24-2024 04:23 AM | |
| 3 | 12-12-2023 07:49 AM |
| Online Status |
Offline
|
| Date Last Visited |
a month ago
|