|
POST
|
Thanks Kimo. So, I can assume that all outer rings will be clockwise? I don't care how they are built, by connecting points or converting a dxf, ArcGIS will always have outer rings in a clockwise fashion? Thanks Here is the shapefile specification http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf This explains the rules for shapes, and even more stringent rules apply to OGC polygons. http://en.wikipedia.org/wiki/Simple_Features
... View more
06-24-2010
02:12 AM
|
0
|
0
|
1571
|
|
POST
|
You can see the counts of each featureclass in ArcCatalog without any Python scripting. Add features count as a column in the options for display and then touch each featureclass to update the metadata. then when you select the geodatabase or folder the counts will display in the listing.
... View more
06-19-2010
04:12 AM
|
0
|
0
|
4343
|
|
POST
|
I understood that a polygon must be defined in a Counter-clockwise direction to be valid. (I got this reversed in my original answer) A clockwise ring will define a hole in a polygon. But it must be enclosed by the first ring. So the outside ring must start counter-clockwise with alternate clock/counter-wise nested rings if you had the (real) case of say a lake on an island in a lake. The check/repair geometry tool will soon take note if you actually manage to build an invalid topology at a low level. Somet loaders check on loading and reject invalid topology. But if you copy a featureclass using featureclassTofeatureclass you will copy the invalid geometry, storing up problems for any later analysis and drawing. OGC well known text does not define the direction except to note that the righthand rule will imply the polygon 'faces up". If you hod up your right hand with thumb, first and second fingers stretched, first finger along the line, then the second finger points to the inside and the thumb points up. KML definitely gets it 'wrong' from an Esri point of view, so always repair geometry when loading KML polygons or they won't draw properly and you will have trouble editing them. I am having trouble with loading data via spatialite too. The WKT loader seems to bypass any geometry validation and even just gets it wrong.
... View more
06-19-2010
03:54 AM
|
0
|
0
|
1570
|
|
POST
|
Create an array object to receive the geometry from the row. Then you can use that temporary feature as a mask polygon.
... View more
06-19-2010
03:48 AM
|
0
|
0
|
1632
|
|
POST
|
import sys, os, string, csv, re, arcgisscripting
gp = arcgisscripting.create()
gp.OverWriteOutput = True
# Set local variables
out_path = "d:/work"
out_name = "points.shp"
geometry_type = "POINT"
template = "DISABLED"
has_m = "DISABLED"
has_z = "DISABLED"
# Set workspace after variables
gp.workspace = out_path
#Creating a spatial reference object
spatial_reference = gp.CreateSpatialReference('Coordinate Systems/Geographic Coordinate Systems/World/WGS 1984.prj')
# use relative path for this path is an undocumented trick
#Execute CreateFeatureclass
if gp.Exists(out_name) : gp.Delete(out_name)
gp.CreateFeatureclass_management(out_path, out_name, geometry_type, '#', has_m, has_z, spatial_reference)
gp.AddField_management(out_name, "maxSize", "DOUBLE", 11, 4)
f = open("D:/work/x30minpts.txt")
# never start file or folder names with a digit, even if Windows allows it
cur = gp.InsertCursor(out_name) # open outside loop once only
pnt = gp.CreateObject('POINT') # only need one instance outside loop
csvReader = csv.reader(f) # defaults ok for example
for row in csvReader:
xCoord = row[0] # reads as strings, not numbers
yCoord = row[1]
size = row[2]
# print(xCoord,yCoord,size),type(xCoord),type(yCoord),type(size)
row = cur.NewRow()
pnt.x = float(xCoord)
pnt.y = float(yCoord)
row.maxSize = float(size) # attributes are property of the row, not the pmt
row.shape = pnt
cur.InsertRow(row)
del cur,row,pnt
f.close()
... View more
06-18-2010
02:35 PM
|
0
|
0
|
865
|
|
POST
|
You can't delete rows with a SearchCursor, it is read-only. Try an UpdateCursor You might still encounter problems, Image catalogs seem to be special tables.
... View more
06-13-2010
03:51 AM
|
0
|
0
|
547
|
|
POST
|
The proper answer is YES, at 10.0 there is a new set of tools called "Data Driven Pages" that have the equivalent utilities that were available in DS MapBook menu: I mis-understood that you wanted a text based index. Someone will have to write that in Python as a new resource. Can't be too hard with data driven pages. Might give it a go myself when I have time. I remember an AML tool that did this.
... View more
06-10-2010
03:06 AM
|
0
|
0
|
2808
|
|
POST
|
Hi, Sorry, I should be more explicit. I am using 9.3.1. In my geodatabase, I have a table (concentration) that I want to join a feature class (source) to. The "NUMR_ECHN" is the link for the table and NUMR_ECHN_LOCL" is the link for the feature class. I have about a hundred geodatabase located in about 20 different folders. the name of the geodatabase are 31M01_GR.mdb, 31M01_GS.mdb, 31M0-2_GR.mdb, 31M02_GS.mdb..etc. When I run the script with the loop, I don't receive any error message but, I don't have any output either. When I run the command lines, I have this error message: Executing: Append D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Géochimie D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Géochimie\31M01_GR.mdb\ECHANTILLON_LOCALISE_PT D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Géochimie\31M01_GR.mdb\RESULTAT_ANALYSE Start Time: Tue Jun 08 11:45:31 2010 Running script Append... <class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Feature Layer. ERROR 000840: The value is not a Raster Catalog Layer. Failed to execute (CopyFeatures). The key is just get CopyFeatures to work standalone. Even in the interactive window in pythonwin. I think the problem is your files beginning with a numeric digit. As a conservative strategy never name folders, files or featureclasses starting with a digit. You are not allowed to start field names with a digit in most databases. Also, to make life easy avoid spaces in folders and file names as well. This avoids having to quote everything and use r"path to a strange world" for everything. Although windows and Unix allows spaces, it causes endless problems in ArcGIS and other packages if you have names, variables and anything that is not meant to be a number starting with a number or including spaces.
... View more
06-10-2010
02:55 AM
|
0
|
0
|
2658
|
|
POST
|
Hi, Sorry, I should be more explicit. I am using 9.3.1. In my geodatabase, I have a table (concentration) that I want to join a feature class (source) to. The "NUMR_ECHN" is the link for the table and NUMR_ECHN_LOCL" is the link for the feature class. I have about a hundred geodatabase located in about 20 different folders. the name of the geodatabase are 31M01_GR.mdb, 31M01_GS.mdb, 31M0-2_GR.mdb, 31M02_GS.mdb..etc. When I run the script with the loop, I don't receive any error message but, I don't have any output either. When I run the command lines, I have this error message: Executing: Append D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Géochimie D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Géochimie\31M01_GR.mdb\ECHANTILLON_LOCALISE_PT D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Géochimie\31M01_GR.mdb\RESULTAT_ANALYSE Start Time: Tue Jun 08 11:45:31 2010 Running script Append... <class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Feature Layer. ERROR 000840: The value is not a Raster Catalog Layer. Failed to execute (CopyFeatures). The key is just get CopyFeatures to work standalone. Even in the interactive window in pythonwin. I think the problem is your files beginning with a numeric digit. As a conservative strategy never name folders, files or featureclasses starting with a digit. You are not allowed to start field names with a digit in most databases. Also, to make life easy avoid spaces in folders and file names as well. This avoids having to quote everything and use r"path to a strange world" for everything. Although windows and Unix allows spaces, it causes endless problems in ArcGIS and other packages if you have names, variables and anything that is not meant to be a number starting with a number.
... View more
06-10-2010
02:53 AM
|
0
|
0
|
2658
|
|
POST
|
After a bit of practice I have now completely replicated a DSMapBook application, plus a lot more. So rest easy all you DSMapBook enthusiasts. Some of the functions are still being worked on and renamed after the Pre-release, so there is a bit more to come. The basic idea is that the "mapbook" is the output document, not the project MXD. So you can load a PDF title page first, then export a series of PDF maps, each with its own MXD with different styles and page layouts, and then the trailing pages. Finally close the output document. Being able to assemble the pages from PDF individual pages avoids having to post process individual maps. There are additional tools to create strip map and grid indexes, and calculate adjacent sheet names, convergence and other settings needed for a series. Programming using the high level functions is a much easier than hacking the VB6 code for me because I have avoided using VB. At the same time the available tools are much more powerful that DSMapBook ever was. Especially the dynamic text to allow custom dynamic labels, images apart from being able to switch different layers on for each map. Not the same options form, you have to write a Python script for some things but in the end much more powerful and extendable.
... View more
06-08-2010
08:32 PM
|
0
|
0
|
4664
|
|
POST
|
The proper answer is YES, at 10.0 there is a new set of tools called "Data Driven Pages" that have the equivalent utilities that were available in DS MapBook menu: Strip Map Index Features makes a strip map Grid Map Index Features makes a grid of sheets Calculate Adjacent Fields (containing adjacent sheet names ) ... and three more relating to UTM zones, convergence and central meridians
... View more
06-08-2010
07:57 PM
|
0
|
0
|
2808
|
|
POST
|
I don't have enough information about your sources, paths and error messages to see what is going wrong.
... View more
06-08-2010
01:11 AM
|
0
|
0
|
2658
|
|
POST
|
Is there a geoprocessing tool that is equivalent to going to the options button on a table and selecting "Related Tables"? If not has anyone written a script that accomplishes the same? Thanks, Jeff Ward Try the keyfile toolbox and script. http://arcscripts.esri.com/details.asp?dbid=16286
... View more
06-03-2010
07:44 PM
|
0
|
0
|
545
|
|
POST
|
1-I want to batch the process. It will be very convenient not to select every filesmuself, but "tell python" where the files are located and let him selecting them. 2-When I run the script I get this message: Failed to execute. Parameters are not valid. The value cannot be a table ERROR 000840: The value is not a Raster Layer. Failed to execute (AddJoin). I don't see where I the raster is involved in my process. The parameter for my arguments are Folder, Feature Class and Table. No raster around??? I am a little bit desperate!! Thanks for your help Steeve AddJoin only takes Layers and Views not featureclasses and tables, odd message but that is likely the reason. Here is my edited version as I think you want to do. Might have to edit it a bit more ################################################## ########################
#Join a table to a feature layer
#Steeve Deschenes
#Carex Canada
#June 2010
################################################## #######################
# Import system modules
import sys, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
# Load required toolboxes...
## gp.AddToolbox("C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx")
## no need for system toolboxes
# Local variables...
workingfolder = sys.argv[1]
source = sys.argv[2]
concentration = sys.argv[3]
#Set workspace
gp.Workspace = workingfolder
#Get a list of the feature classes in the input folder
try:
enumFC = gp.ListFeatureClasses()
## fcs.Reset() never actually implemented
fc = enumFC.Next()
i = 0
while fc :
i+=1
print fc
gp.MakeFeatureLayer_management (source, "source_lay")
gp.MakeTableView_management ("NUMR_ECHN", "con_lay")
# have to have Layers or Views for AddJoin not featureclasses or tables
gp.AddJoin_management("con_lay", "NUMR_ECHN", "out_lay", "NUMR_ECHN_LOCL", "KEEP_ALL")
gp.CopyFeatures_management ("out_lay", fc + "_resultat.shp")
fc = enumFC.Next()
except Exception, errmsg:
gp.AddError(gp.GetMessages())
print errmsg,gp.GetMessages
... View more
06-03-2010
07:38 PM
|
0
|
0
|
2657
|
|
POST
|
I've actually tried VB and Python (and every punctuation mark I could think of) and neither works. I ran out of things to try and ended up just doing this in ArcMap. I think the Calculate_Field tool is buggy or something because it works sometimes and othertimes it doesn't. It is more likely that you have data that causes a crash in the expression. If you use the field calculator you do not have the opportunity to trap data errors in a try/except block and its impossible to see what record caused it. Since the CalculateField simply wraps the expression in a cursor, it is much much better to use your own cursor in a script and do the expression inside a try/except block. CalculateField is more useful in interactive processes or models.
... View more
06-03-2010
06:22 AM
|
0
|
0
|
1370
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-15-2024 10:32 PM | |
| 1 | 03-12-2026 01:10 AM | |
| 1 | 03-13-2026 08:30 PM | |
| 1 | 03-13-2026 05:17 PM | |
| 1 | 03-12-2026 05:14 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-13-2026
05:04 PM
|