|
POST
|
Note that you can only do this in v10.1. The embedding of the .py code into a .tbx is pretty nice as it obfuscates the code as well, rendering it unreadable to general end users.
... View more
05-20-2013
08:51 AM
|
0
|
0
|
2966
|
|
POST
|
Actually I meant delete the FGDB. For example: import arcpy, os
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\Temp\CCAP.gdb"
TonyTwoWay_DBO_CCAP = "C:\Temp\CCAP.gdb\TonyTwoWay.DBO.CCAP"
CCAP = r'Database Servers\DSD15_SQLEXPRESS.gds\TonyTwoWay (VERSION:dbo.DEFAULT)\TonyTwoWay.DBO.CCAP'
CCAP2 = "C:\Temp\CCAP.gdb"
if arcpy.Exists(CCAP2):
arcpy.Delete_managementCCAP2)
arcpy.FeatureClassToGeodatabase_conversion(CCAP, CCAP2)
... View more
05-20-2013
07:56 AM
|
0
|
0
|
2212
|
|
POST
|
Not sure why it's creating dulplicates, but I would either: 1. Delete the existing FGDB, before you run the FeatureClassToGeodatabase tool. or 2. Create a FGDB, and then run the CopyFeatures tool.
... View more
05-17-2013
02:48 PM
|
0
|
0
|
2212
|
|
POST
|
All you should need is something like this: outZonalStatistics.save(outWorkspace + '\\FT_SAT') BTW: ESRI grids need a <= 13 character name
... View more
05-15-2013
10:38 AM
|
1
|
0
|
2838
|
|
POST
|
Another caution is to make sure your input features have a relatively small vertex count... For example, it'd be a bad thing to try and dissolve three road segments that are each composed of 1,000,000 verticies, since the feature that would need to be held in RAM (prior to writing to disk) would be composed of all 3,000,0000 verticies (so 6,000,000 x and y coordinate values). So I'll amend my sugested work flow: 1. Create a fishnet that covers the entent of your dissolve layer. 2. Dice the input layer (maybe a vertex limit of 10k verticies) 3. Using a spatial join, tag your diced street features with the ID of the fishnet polygon. 4. In the Dissolve tool, specify this ID field as one of the dissolve fields. Recognize too that the output may not be 100% completely dissolved using this method, but pretty close.
... View more
05-15-2013
09:42 AM
|
0
|
0
|
5744
|
|
POST
|
The performace of the Dissolve tool is dependednt on the complexity of your data. The real issue is that the Dissolve tool must hold the entire output dissolved geometry in RAM all at once, and once it's done dissolving, then it'll write it out to disk. The larger/more complex the feature, the more RAM required, and if neccessary, the more behind the scenes tiling that must be donein order to keep the rAM usage under control. So basically, Dissolve performace is largely dictated by the number of verticies in your input layer. One of the worst examples is a large stream or road layer - and an even worse example is the buffer of such a layer (since the buffers have even more verticies than the input!). One trick I have learned is to "tag" the features you want to dissolve with some sort of "region-based" unique id, and then specify this field value in the Dissolve. An easy example: 1. Create a fishnet that covers the entent of your dissolve layer. 2. Using a spatial join, tag your street features with the ID of the fishnet polygon. 3. In the Dissolve tool, specify this ID field as one of teh dissolev fields. Make sure your fishnet is sufficiently small.
... View more
05-15-2013
09:29 AM
|
0
|
0
|
5744
|
|
POST
|
Do you want the user to select the field(s) they want to use? If so, the Data Type would be 'Field' with MultiValue = 'Yes' (to allow for multiple selections) and Obtained From would be set to your input feature class. I would recomend that you set your input layer to be a Data Type of 'Feature Layer', that way users can drag layers into the tool from the ArcMap TOC. If you just want to list the fields in the input layer, it'd be something like this: print ",".join([field.name for field in arcpy.ListFields(inputLayer)])
... View more
05-15-2013
09:05 AM
|
0
|
0
|
5188
|
|
POST
|
This sounds like a job for euclidean allocation (Spatial Analyst): http://resources.arcgis.com/en/help/main/10.1/index.html#//009z0000001m000000 With some monkey business, this could also be a job for Thiessen Polygons: http://resources.arcgis.com/en/help/main/10.1/index.html#//00080000001m000000 Get your city boundary allocations 1st, then do any buffering (and division of the buffer areas) as a second operation.
... View more
05-14-2013
10:09 AM
|
0
|
0
|
1883
|
|
POST
|
I think this would be the "best" way. Since it's a point you could also use the .centroid property (and some other ones too). partObj = wgs84PntGeom.getPart(0)
partObj.X
partObj.Y So, just to clarify - probably best not to parse the JSON... I just put that in there to illustrate it was returning WGS84 coordinates.
... View more
05-13-2013
12:19 PM
|
0
|
0
|
1391
|
|
POST
|
I think you want GCS_WGS_1984 = 4326 (on page 18). I messed around with it and it seems to work for me like this: pntObj = arcpy.Point(X= 12345,Y=6789) inSr = arcpy.SpatialReference(2927) #NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet outSr = arcpy.SpatialReference(4326) #GCS_WGS_1984 pntGeom = arcpy.PointGeometry(pntObj, inSr) wgs84PntGeom = pntGeom.projectAs(outSr, "NAD_1983_HARN_To_WGS_1984_2") Which yields: >>> wgs84PntGeom.JSON u'{"x":-126.81813166550971,"y":45.173061523748544,"spatialReference":{"wkid":4326}}'
... View more
05-13-2013
10:53 AM
|
0
|
0
|
4424
|
|
POST
|
Just use the integer (don't format as string): projectedPoint = ptGeometry.projectAs(12345, 54321)
... View more
05-13-2013
10:09 AM
|
0
|
0
|
3033
|
|
POST
|
It makes the code a bit harder to comprehend, but how about using the WKID (well known id) for your projections and transformation definitions? I have notices some "discrepencies" in the naming conventions, and well, computers like numbers, right? I just pull the codes from these documents: C:\Program Files (x86)\ArcGIS\Desktop10.1\Documentation\geographic_transformations.pdf C:\Program Files (x86)\ArcGIS\Desktop10.1\Documentation\geographic_coordinate_systems.pdf C:\Program Files (x86)\ArcGIS\Desktop10.1\Documentation\projected_coordinate_systems.pdf
... View more
05-13-2013
09:46 AM
|
0
|
0
|
3033
|
|
POST
|
As far as I know, there is no way to do this in ArcPy. However, there are ways to get a user-drawn feature (point, poly, line) as input to a tool. See: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w00000023000000
... View more
05-09-2013
10:47 AM
|
0
|
0
|
796
|
|
POST
|
I think the tool you want is Path Distance: http://resources.arcgis.com/en/help/main/10.1/index.html#//009z0000001q000000
... View more
05-07-2013
04:51 PM
|
0
|
0
|
1148
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2014 12:57 PM | |
| 1 | 08-29-2024 08:23 AM | |
| 1 | 08-29-2024 08:21 AM | |
| 1 | 02-13-2012 09:06 AM | |
| 2 | 10-05-2010 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-30-2024
12:25 AM
|