|
POST
|
I saw this: New Forums are on the Way! | ArcGIS Blog "...As for the current Discussion Forum and its over 100,000 threads, nothing will be lost. It is all being imported into GeoNet, tagged, browsable, indexed, and searchable." I must be doing something wrong because I am not seeing how to browse python topics.
... View more
07-08-2014
06:35 AM
|
0
|
0
|
3234
|
|
POST
|
Hi Ian! I searched my username but none of my old posts show up. Maybe I am doing something wrong? Thanks!
... View more
07-08-2014
06:30 AM
|
0
|
2
|
3295
|
|
POST
|
If I click the "Forums" menu item from the ArcGIS Resources pages it automatically takes me here to GeoNet. I don't see any way to get at all of my old posts!
... View more
07-08-2014
06:28 AM
|
0
|
3
|
3295
|
|
POST
|
Thanks Dan! So, I am guessing that all of the posts are gone from the old forums as I don't see anything in the new Python section.
... View more
07-08-2014
06:10 AM
|
0
|
5
|
3295
|
|
POST
|
Is this GIS Developers section where I'd ask/post about Python related items? I have to admit I am entirely lost on the this new format as it is such a drastic departure from any logical approach to an forum I've been a part of.
... View more
07-08-2014
05:59 AM
|
0
|
32
|
14052
|
|
POST
|
Hello and thank you for replying. Actually, query1 works. However, the other two do not work. I assume it has something to do with the functionality of cursor.execute function, or the syntax of the code (SQL, or Python) I'm attempting to execute. I am in an Oracle 11g environment, if that helps at all. Do those queries actually work in an actual query (outside of your python environment like SQL Developer)? Edit: I don't think your SQL syntax is correct in query2 and query3 and has nothing to do with your cursor. You should go into SQL Developer to re-write and test to make sure it is returning the correct information. Once you have that completed then just copy/paste into your python script.
... View more
06-16-2014
10:14 AM
|
0
|
0
|
3115
|
|
POST
|
Can you wrap the code snippets into brackets? Use the "#" tool in the posting toolset above.
import cx_Oracle
con = cx_Oracle('authentication string')
cur = con.cursor()
IDs = ('A1', 'A2', 'A3', 'A4')
query1 = """SELECT * FROM table WHERE ID IN """ + str(IDs)
Q = cur.execute(query1)
I'd first start by printing query1 to see the full query string that you will be passing in to build the cursor and hopefully you will be able to immediately see the problem. Just as a quick test, you can try this version:
query1 = """SELECT * FROM table WHERE ID IN (""" + str(IDs) + """)"""
... View more
06-16-2014
09:49 AM
|
0
|
0
|
3115
|
|
POST
|
Maybe check to make sure correct permissions are set to allow you to write to the directory: \\skagit\dept\gis\janiceb\Projects\Health\June_2014 Edit: the link also says: "...Other anti-virus programs/applications can also prevent the creation of the feature class". Perhaps it isn't just related to Microsoft Essentials? Not sure.
... View more
06-12-2014
12:26 PM
|
0
|
0
|
3556
|
|
POST
|
env.workspace = r"\\skagit\dept\gis\janiceb\Projects\Health\June_2014\Septic.gdb"
It can't find this path. Give it the drive letter (if it is a mapped drive) or the complete UNC path (make sure "\\skagit" is correct). Suggestion: navigate to this Spetic.gdb in your ArcCatalog tree, then clickin the "Location" box to select the full path. Right-click and choose "copy". Then paste it into your code base. Edit: Or.. http://support.esri.com/en/knowledgebase/techarticles/detail/41280
... View more
06-12-2014
11:48 AM
|
0
|
0
|
3557
|
|
POST
|
I have run this code and received this error log but not sure how to correct it. Thank you for any insight:
[email protected]\web_forms.dbo.v_GISPropertyImport
Just to start, I'd check your SDE Connections to make sure "[email protected]" does in fact exist on the machine you are executing the script. Also, look at the database itself to see if "web_forms.dbo.v_GISPropertyImport" database view does in fact exist.
... View more
06-09-2014
08:54 AM
|
0
|
0
|
2578
|
|
POST
|
Hi James, that is definitely an answer. I do thank for the code you posted, I will give it a try as I continue in with Python. Right now I am just happy it is working, once I get more knowledgeable of the code I will go from I can see what it is doing to knowing what it is doing. Thank you again. Dale, No problem. It's a good idea to look at a diverse set of solutions as you may find need for them in the future. It's perfectly fine to keep withint ESRI stack! But I've had a lot of success incorporating 3rd party libraries into my GIS applications and glad I was exposed to alternative approaches --- I simply thought you might want that too! Take care
... View more
06-05-2014
09:44 AM
|
0
|
0
|
4158
|
|
POST
|
I realize you mentioned that you are just starting, but its also good to be exposed to advanced (maybe) techniques too. Here's an alternative way to write out feature classes and tables to .csv output files using arcpy.da, numpy and pandas libraries. import pandas as pd import numpy as np fc = r'H:\Documents\ArcGIS\Default.gdb\MyFeatureClass' #generate a list of fields flds = [f.name for f in arcpy.ListFields(fc)] #you cannot include Shape/Geometry or Date fields in a NumPyArrray, so remove them from the field list flds.remove('Shape') #this is the geometry field in my FeatureClass flds.remove('START_TEST') #this is a date field in my FeatureClass #convert to a NumPyArray nmpyarr = arcpy.da.TableToNumPyArray(fc, flds) #convert to a Pandas DataFrame dfFC = pd.DataFrame(nmpyarr) #Write the .csv file csv_out = r'H:\Documents\csvOUTPUT.csv' dfFC.to_csv(csv_out)
... View more
06-05-2014
08:49 AM
|
0
|
0
|
4158
|
|
POST
|
See if this helps. I can't remember exactly where I lifted the original code from. Probably a quick google search is where I started.
gdb = r'Database Connections\MyDBConnection.sde'
arcpy.env.workspace = gdb
featclsInDatasets = []
for fds in arcpy.ListDatasets('','feature') + ['']:
for fc in arcpy.ListFeatureClasses('*_OLD','',fds):
featclsInDatasets.append(os.path.join(fds, fc))
#list the featclasses in datasets
for fc in featclsInDatasets:
print fc
#list the featClasses not in datasets
for fcmain in arcpy.ListFeatureClasses('*_OLD'):
print fcmain
edit: ah... I think this is where I originally found the sample: http://gis.stackexchange.com/questions/5893/listing-all-feature-classes-in-file-geodatabase-including-within-feature-datase
... View more
06-04-2014
04:28 AM
|
0
|
0
|
803
|
|
POST
|
Thanks James. This is definitely the better answer, but list comprehensions are probably not very easy to understand for a beginner. Heck, I still struggle with them! OP -- Caleb's answer is exactly how I have it in 99% of my code but I'm starting to write in a more pythonic style. I just thought a different approach would be good to see!
... View more
06-03-2014
10:39 AM
|
0
|
0
|
1756
|
|
POST
|
Even more pythonic:
value1 = "roads"
value2 = "streams"
value3 = "parks"
value4 = "contours"
List = [value1, value2, value3, value4]
for match in [s for s in List if len(s)==5]:
print match
... View more
06-03-2014
10:23 AM
|
0
|
0
|
1756
|
| 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
|