|
POST
|
Hi Curtis --- I did post over in that thread! Unfortunately, I am not privy to installs and such -- juts a Citrix account with what they give me to work with is all I have and really can't contribute much to help in that thread.
... View more
08-27-2014
08:52 AM
|
0
|
0
|
1570
|
|
POST
|
Assuming you are talking about a GDB table, this is an alternative using pandas library (this spits out a .csv table but it could also be run thru a TableToTable conversion just as well to keep it all withing the gdb). "fc" is a string field and the output adds a count field.
import arcpy
import pandas as pd
def createSummaryGDB(ingdb):
tab = ingdb + "\\arlist"
flds = [f.name for f in arcpy.ListFields(tab)]
tabarray = arcpy.da.TableToNumPyArray(tab, flds)
df = pd.DataFrame(tabarray)
df_grouped = df.groupby(['fc']).count()
df_grouped.to_csv(r'H:\Documents\arlist_grouped.csv')
createSummaryGDB(r'H:\Documents\ArcGIS\Default.gdb')
... View more
08-26-2014
01:05 PM
|
0
|
2
|
1570
|
|
POST
|
Alternative option is to use the Pandas library to read in the .csv, go thru the unique rows and export each one to it's own .csv file. In this example it just names each of the unique .csv files using the first column specified ('fc') import pandas as pd import numpy as np
import pandas as pd
def exportCSVbyRow(csvfile):
src = csvfile
tab = pd.io.parsers.read_table(str(src), sep=',')
uniquerows = np.unique(tab['fc'])
for key in uniquerows:
print key
exprow = tab[tab['fc'] == key]
exprow.to_csv(r'H:\Documents\\' + str(key) + '.csv')
exportCSVbyRow(r'H:\Documents\arlist.csv')
... View more
08-26-2014
10:53 AM
|
0
|
0
|
1367
|
|
POST
|
This will list all of the feature classes. Puts any FeatureDataset name first, then FC name: FDatasetName\FeatureClassName
def listFcsInGDB(gdb):
''' list all Feature Classes in a geodatabase, including inside Feature Datasets '''
arcpy.env.workspace = gdb
print 'Processing ', arcpy.env.workspace
fcs = []
for fds in arcpy.ListDatasets('','feature') + ['']:
for fc in arcpy.ListFeatureClasses('','',fds):
fcs.append(os.path.join(fds, fc))
return fcs
gdb = r'H:\Documents\ArcGIS\Default.gdb'
fcs = listFcsInGDB(gdb)
for fc in fcs:
print fc
... View more
08-26-2014
08:53 AM
|
3
|
0
|
2728
|
|
POST
|
I developed this application for Sarasota a few years ago (it's still in production): Storm Water Revenue Management System | ArcNews It's inline with what you want to do but it uses SQL Server database as the attribute data repository and the "GIS code" is really there to just perform some specific spatial tasks. The bulk of the application is what you'd consider a traditional client/server windows forms application, developed in .NET and utililzed standard CRUD operations entirely with StoredProcedures on the database --- there is zero (0) SQL in the application tier. The main takeaway here is that, okay it's distributed via ArcGIS as a COM Component Toolbar, but the vast majority of this app is just an n-Tier application like any other. This is great because it is completely agnostic to databases or front-end distribution. Thers' a database, Data Access layer, a business layer and a presentation layer --- all of this can be moved and maintained as individual components rather than rebuilding an entire app over and over. For example, if at any point in the future the powers at be decide to move to an Oracle database then it's not a big deal to connect the applicaiton tier to that database because it is agnostic to any single db. I just need to alter the DAL tier and connect it up to the new Oracle db.
... View more
08-26-2014
08:40 AM
|
0
|
0
|
3053
|
|
POST
|
What's wrong with maintaining tables in a File Geodatabase? You could implement pyodbc to integrate your Access db, but I think there will always be concerns with drivers and connection strings and ways to manage them over the life of your products. There's valid reasons to be agnostic to any database, including MS Access. Why so reliant on Access?
... View more
08-25-2014
06:58 AM
|
0
|
2
|
3053
|
|
POST
|
Personal GDB's are on their way out from what I can tell, replaced by the FileGeodatabase. Something to consider before spending a bunch of energy on this. From what I can tell, you want to have more UI elements integrated into the map environment. Your best option will be to develop ArcObjects COM components or an Add-In version of such. The latter has more limitations, especially if your attribute datasource(s) are non-spatial RDBMS tables, views, stored proc's, etc.. in which case you'd want to build a more robust complied COM component and installed on users' workstations. This of course means the typical maintenance and install requirements too. I have no idea where they moved the ArcObjects forum section in this place. I guess you are supposed to know what to search for rather than just LOGICALLY go to that forum section.
... View more
08-22-2014
10:14 AM
|
0
|
5
|
3053
|
|
POST
|
I am not really sure what an "ArcGIS Project" is. You will have to define that because it's really ambiguous. Why not just setup a File Geodatabase with your Feature Classes and then create the appropriate Relationship Class (one-to-many) between them. Sounds like a lot of work to replicate existing ArcGIS components that perfectly meet your needs.
... View more
08-21-2014
08:44 AM
|
0
|
0
|
3053
|
|
POST
|
You may have mentioned doing this in your OP but don't pull directly from Excel (into your gdb or map or whatever). Save it out to a comma-delimited .csv or .txt and take a look at the values there (in TextPad/Notepad). Then save from there again and then do your import. Maybe I am missing the obvious, but it sounds like a tiny little difference is occuring somewhere when going between file types.
... View more
08-13-2014
11:40 AM
|
0
|
0
|
4469
|
|
POST
|
Joins are case sensitive I believe. Maybe double-check the values for that?
... View more
08-13-2014
11:34 AM
|
0
|
0
|
4469
|
|
POST
|
A straight join in ArcGIS will be a 1-to-1 relationship. You will need to create a relate, or a Relationship class in your GDB, to setup a 1-to-many rel type.
... View more
08-13-2014
11:26 AM
|
0
|
0
|
4469
|
|
POST
|
As Xander points out, I am a "user" of Pandas library! I actually work in a Citrix environment where all software, python libs, etc... are managed services that I use and I am not familiar with installs and the like. Sorry OP! Hopefully someone with a better handle on that error can contribute. (Thanks for the mention Xander) Edit: quick search found this (I'm not an expert in these matters, but also may be important to check your version against your version of NumPy)... python - ValueError: numpy.dtype has the wrong size, try recompiling - Stack Overflow
... View more
08-12-2014
11:40 AM
|
0
|
2
|
4744
|
|
POST
|
My logic: if the ESRI system engineers decided to integrate the Default.gdb into the core of ArcGIS 10.x, then it might be a good idea to follow suit.
... View more
08-08-2014
12:53 PM
|
0
|
1
|
725
|
|
POST
|
I just whipped this together, and it doesn't fully meet your requirments but it does the first half of your task. You will need to get the rest implemented (from converting to anno onwards). Also, I ran into little problems that mostly got solved by NOT using .shp files and just setup File Geodatabases --- which is not a bad plan anyway. Especially dealing with rasters for some reason, processing them outside of .gdb's is kwirky.
ras = r'H:\Documents\inputraster.tif'
ras_ws = r'H:\Documents\rasters\clippedrasters.gdb'
ras_countours = r'H:\Documents\rasters\contours.gdb'
shp_ws = r'H:\Documents\shps'
arcpy.env.workspace = shp_ws
rascount = 1
for fc in arcpy.ListFeatureClasses():
print fc
#create the clip rasters
arcpy.Clip_management(ras,"#", ras_ws + "\\ras" + str(rascount),fc, "0", "ClippingGeometry")
rascount = rascount + 1
#create the contours from the clipped rasters
### see if spatial analyst extension is available for use
availability = arcpy.CheckExtension("Spatial")
if availability == "Available":
arcpy.CheckOutExtension("Spatial")
arcpy.AddMessage("SA Ext checked out")
else:
arcpy.AddError("%s extension is not available (%s)"%("Spatial Analyst Extension",availability))
arcpy.AddError("Please ask someone who has it checked out but not using to turn off the extension")
arcpy.env.workspace = ras_ws
contourcount = 1
for ras in arcpy.ListRasters():
outname = ras_countours + "\\contour" + str(contourcount)
print "ountname: " + outname
arcpy.sa.Contour(ras, outname, 200, 0)
contourcount = contourcount + 1
#check the extension back in
arcpy.CheckInExtension("Spatial")
... View more
08-08-2014
12:23 PM
|
3
|
3
|
2021
|
|
POST
|
This is untested and I have not fully vetted this, but I think you can try to reference the path name instead of trying to add the layer from another .mxd. You can use arcpy.Describe to get the fully qualified path of the layer:
import arcpy
thisMap = arcpy.mapping.MapDocument("CURRENT")
myDF = arcpy.mapping.ListDataFrames(thisMap)[0]
arcpy.CreateFolder_management(r"D:\GIS_data", "test")
newmap = arcpy.mapping.MapDocument(r"D:\GIS_data\test\new.mxd")
newdf = arcpy.mapping.ListDataFrames(newmap)[0]
myLayers = arcpy.mapping.ListLayers(myDF)
for lyr in myLayers:
if lyr.name == "CNNDB":
#set the path of the layer
desc = arcpy.Describe(lyr)
if hasattr(desc, "catalogPath"):
addlayer = desc.catalogPath
#make a feaure layer to add to the new map
arcpy.MakeFeatureLayer_management(addlayer, "layernametocallit")
arcpy.mapping.AddLayer(newdf,"layernametocallit","AUTO ARRANGE")
arcpy.RefreshTOC
arcpy.RefreshActiveView
... View more
08-08-2014
11:34 AM
|
0
|
0
|
3311
|
| 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
|