|
POST
|
I wouldn't necessarily describe it as a bug or a problem. It's pretty common to not use reserved words as a practice and a good habit to get into. In rare cases where I needed to name a field close to a reserved word then I'd just add an underscore "_" in front of the name.
... View more
03-31-2015
05:33 AM
|
0
|
0
|
2138
|
|
POST
|
In your OP you stated that this problem occurred with the PGDB: I closed ArcMap, and opened the table in Access (this is in a personal geodb) I was commenting that since Access is a 32-bit application, perhaps the problems are associated with ArcGIS accessing that application. I don't have a definitive solution or even if that is your problem, it was just a comment to perhaps check into. I would definitely be concerned with implementing PGDB's though and consider the future of that technology.
... View more
03-30-2015
10:48 AM
|
0
|
0
|
2138
|
|
POST
|
Perhaps a 64-bit issue? I'm not 100% sure on this, but maybe research the future of the Personal GDB.
... View more
03-30-2015
06:53 AM
|
0
|
0
|
2138
|
|
POST
|
In your OP you are just issuing an SQL SELECT statement against the table. That will work just fine but that is a separate thing from calling PL/SQL packages with cx_Oracle --- from the link in your second post, read the section titled Part 3.4 – PL/SQL to see how he is doing that. There is also example of setting up a refcursor. I think in any case you will have to transform from the cx_Oracle cursor into something usable for (I'm not sure what you need to do with the results). You could just populate a list and numpy array to go between spatial and non-spatial sets.
... View more
03-30-2015
06:36 AM
|
1
|
1
|
2525
|
|
POST
|
Here's a short example using matplotlib (although there are probably far better examples found with a quick Google search or on Stack Overflow). Sample data: H:\GraphData.csv Month Values 0 1 2.0228 1 2 2.0229 2 3 2.0231 3 4 2.0232 4 5 2.0233 5 6 2.0234 6 7 2.0235 7 8 2.0236 8 9 2.0237 9 10 2.0237 10 11 2.0238 11 12 2.0239 12 13 2.0240 13 14 2.0241 14 15 2.0243 15 16 2.0244 16 17 2.0247 17 18 2.0247 18 19 2.0248 19 20 2.0249 20 21 2.0250 21 22 2.0250 22 23 2.0252 23 24 2.0253 py Code: import pandas as pd
from pandas import *
import matplotlib.pyplot as plt
data = r'H:\GraphData.csv'
df = pd.io.parsers.read_table(data, sep=',')
xs = df.Month
ys = df['Values']
min = df['Month'].min()
max = df['Month'].max()
fig = plt.figure()
ax = "ax" + str(211)
ax = fig.add_subplot(211, axisbg='white')
ax.plot(xs, ys, linestyle='-', marker='', linewidth=1, color='blue', label=str('Graph Test'))
plt.savefig(r'H:\GraphData.png', dpi=600)
plt.close()
del fig
... View more
03-23-2015
12:44 PM
|
1
|
1
|
2418
|
|
POST
|
Yes it is possible. It's probably not as straight-forward as you might be expecting though. For our implementation(s), we employ the matplotlib library to generate our graphs, save as .png and then populate File Geodatabase(s) as attachments to their related FeatureClasses. I couldn't really begin to post up any code examples unless you have something specific in mind. Post up an example of your data.
... View more
03-23-2015
07:35 AM
|
1
|
1
|
2418
|
|
POST
|
This slight change should give you the time interval in seconds: #adjust from miliseconds to seconds
print "The process took %.02f secs. " % (t.interval)
... View more
03-18-2015
08:56 AM
|
0
|
1
|
3547
|
|
POST
|
class Timer:
def __enter__(self):
self.start = time.clock()
return self
def __exit__(self, *args):
self.end = time.clock()
self.interval = self.end - self.start
import arcpy,os,sys,string,datetime,timeit
import arcpy.mapping
from arcpy import env
def mainProcess():
env.workspace = r"C:\Project"
Layer1 = arcpy.mapping.Layer(r"C:\Project\layers\atikot.lyr")
counter = 0
for mxd in arcpy.ListFiles("*.mxd"):
print (mxd)
mapdoc = arcpy.mapping.MapDocument(r"C:\Project\\" + mxd)
df = arcpy.mapping.ListDataFrames(mapdoc, "Layers")[0]
arcpy.mapping.AddLayer(df ,Layer1, "TOP")
print ('AddLayer')
mapdoc.save()
counter = counter + 1
del mxd
t = Timer()
with t:
mainProcess()
print "The process took %.2f Milisecs. " % (t.interval)
... View more
03-18-2015
07:36 AM
|
2
|
2
|
7176
|
|
POST
|
Implement a Timer class to reuse throughout the code base. class Timer:
def __enter__(self):
self.start = time.clock()
return self
def __exit__(self, *args):
self.end = time.clock()
self.interval = self.end - self.start Simple to implement, especially when you wrap up your functions/code blocks into individual def's def dftest():
#some process wrapped up in this def()
#time the process
t = Timer()
with t:
dftest()
print "The process took %.2f Milisecs. " % (t.interval)
... View more
03-18-2015
06:06 AM
|
0
|
4
|
7176
|
|
POST
|
Outside of ESRI stack you can take care of the unwanted characters before converting to your gdb table. This is just an example of reading the .csv and using string manipulation to remove the '>, < or ~ characters from the total_length field, then using the arcpy.da.NumPyArrayToTable method to get it back into ESRI landia. The ztest.csv is just 3 cols and 3 rows for testing consisting of: total_length,IntCol,TextCol
<999.99,999,Some Text
~111.89,123,Some more text
>1.42,321,Even more text import arcpy
import numpy
import pandas as pd
df = pd.read_csv('H:\ztest.csv')
df['total_length'] = df['total_length'].map(lambda x: x.lstrip('<>~'))
dfarr = numpy.array(df.to_records(), numpy.dtype([('total_length', '<f8'),('IntCol', numpy.int32),('TextCol', '|S25')]))
tab = 'in_memory\dfarr_tab'
if arcpy.Exists(tab):
arcpy.Delete_management(tab)
arcpy.da.NumPyArrayToTable(dfarr, tab)
with arcpy.da.SearchCursor(tab, '*') as cursor:
for row in cursor:
print str(row[0]) + " " + str(row[1]) + " " + str(row[2]) + " " + str(row[3])
... View more
03-17-2015
07:29 AM
|
2
|
0
|
1138
|
|
POST
|
Out of curiosity, what indicates that it will fail in a Citrix environment? It will fail on your import comtypes statement(s)
... View more
03-02-2015
10:42 AM
|
0
|
0
|
4468
|
|
POST
|
Have you distributed this across your organization? I can see right away it will fail in a Citrix environment. Too bad because this type of programmatic access is pretty good to have!
... View more
03-02-2015
09:59 AM
|
1
|
2
|
4468
|
|
POST
|
Well... this sure sounds like a database management task. Handling it at the database seems far more reasonable, scalable and maintainable compared to messy scripting that will be subjected to failure over time as system-level changes occur. I'd get with the DBA and work it out.
... View more
02-20-2015
11:59 AM
|
0
|
0
|
1360
|
|
POST
|
Why not just setup a scheduled import package on the RDBMS to just update the table? Seems like the best way to manage tabular data is at the database rather than some external app that needs to be executed and maintained.
... View more
02-20-2015
10:11 AM
|
0
|
2
|
1360
|
|
POST
|
I struggle with this type of stuff because python is so finicky with specifics and I never know what I can get away with
... View more
01-28-2015
10:37 AM
|
0
|
0
|
2313
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|