|
POST
|
If your boundary lines are horizontal and vertical then it is relatively easy. Step 1: use Create Fishnet tool (Data Management > Feature Class) with parameter values as: Output feature class: full path (with name) for the new feature class, say the name be poly2andhalf Template extent (this is important): Select the 'Same as layer poly10by10 (the 10m by 10m polygons) by clicking on the drop-down arrow. [You must be in ArcMap] Cell Size Width: 2.5 Cell Size Height: 2.5 Number of Rows: 0 (0 means the tool will calculate the value) Number of Rows: 0 Opposite corner: automatically fills in if you select a template. Check off Create Label Points Geometry type: POLYGON Origin is the lower-left corner. Must be same for both (poly10by10 and poly2andhalf) polygon feature classes. Step 2: run Feature To Point (Data Management > Features) with poly2andhalf as input - say its output is ply2andhalf_ftp Step 3: transfer the attribute of poly10by10 to poly2andhalf_ftp using the Spatial Join tool (Analysis tools > Overlay). Use parameter values as: Target Features: poly2andhalf_ftp Join Features: poly10by10 Output: poly2andhalf_ftp_spj Join Operation: JOIN_ONE_TO_ONE Field Map: Do not change. Match Option: WITHIN After running the Spatial Join, you'll see that the attributes of 10by10 polys are transferred to poly2andhalf_ftp_spj. Step 4: use Join Field (Data Management > Joins) tool as follows: Input Table: poly2andhalf Input Join Field: OID Join Table: poly2andhalf_ftp_spj Output Join Field: ORIG_FID Join Fields: select the fields of the larger grids you want to join to the smaller grids. Let me know how it goes.
... View more
06-22-2012
01:44 PM
|
0
|
0
|
2230
|
|
POST
|
I think it is the same for 9.3 as well. Follow this link - you will see FIDSet property on a described object for a layer: http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Layer_properties
... View more
06-22-2012
12:16 PM
|
0
|
0
|
1375
|
|
POST
|
How is your population data (age data) stored? As points or polygons? If points, you can use Spatial Join with the polygon as target and points as join features. In the field map, add a new field of type long - set the Merge rule to Median and input field to be the age field of point data. The output of Spatial Join will have a new field with median age.
... View more
06-21-2012
10:53 PM
|
0
|
0
|
647
|
|
POST
|
Why not start with a shapefile instead of an Excel sheet? Include the factors important to you in deciding which property to buy. For me, the important factors were location (proximity to work), price, proximity of elementary schools etc.
... View more
06-21-2012
10:09 PM
|
0
|
0
|
725
|
|
POST
|
If you have ArcGIS 10.0 or 10.1 then you don't need to worry about keeping a dictionary. I'm on 10.0 and this code works: dsc = arcpy.Describe(infc)
fields = dsc.fields
for field in fields:
print field.name, field.type
arcpy.AddField_management(infc2, field.name, field.type)
Although the print statement shows the field type to be SmallInteger - internally it is made consistent with Short type.
... View more
06-21-2012
09:45 PM
|
0
|
0
|
1517
|
|
POST
|
Make your input a model parameter (right-click on the oval and select Model Parameter). Now, run the model as a tool (double-click the model in the toolbox). If there is any selection, the tool should work only on the selected features.
... View more
06-21-2012
11:37 AM
|
0
|
0
|
1751
|
|
POST
|
If you have updated to sp4 please install this spatial join patch as well: http://resources.arcgis.com/content/patches-and-service-packs?fa=viewPatch&PID=160&MetaID=1857 It fixes some defects introduced to spatial join field mapping in sp4. Lesson learned: update only when your workflow breaks 🙂 * Please mark the thread 'answered'.
... View more
06-20-2012
02:24 PM
|
0
|
0
|
924
|
|
POST
|
I'm really sorry that nothing is working for you 😞 Which Service Pack you are using? I'm on 10 sp5. The tool is working as expected on my machine. Let me know if are on a different service pack - I'll try on that setup.
... View more
06-20-2012
11:11 AM
|
0
|
0
|
924
|
|
POST
|
If you want to add the layer to the map and show up instantly (while the map is open) then you can create a script tool with the code as the source of the tool. I've attached a tool with the script. Open the map document you want to add layer. From the catalog window browse to the location where you unpacked the zip file. Double click on the toolbox named AddLayerToMap - you'll see a tool named AddLayerTool. Open the tool by double-clicking on it. The tool dialog is simple - it asks for a layer. The type of acceptable input is a feature class, a map layer or a layer file (.lyr). [ATTACH=CONFIG]15360[/ATTACH] Drag-drop any input and hit 'OK'. If everything goes okay then you'll see the layer added to the first data frame.
... View more
06-20-2012
09:03 AM
|
0
|
0
|
3923
|
|
POST
|
What values you are setting for your Compare Status output? I guess True/False. Just connect your next step to this output. When you run your model the subsequent steps will only be executed if the status is True.
... View more
06-19-2012
01:43 PM
|
0
|
0
|
3389
|
|
POST
|
Not sure what's going on. Try both of these: Make a layer file of your data - in ArcMap, from Table of Content right-click on the layer and select Save Layer as. The file name will have a *.lyr extension. Use the layerfile.lyr instead of a feature class. And enclose your code with try-except as in my sample. Write the except block as follows: except Exception as ex:
print ex Let me what error message you get.
... View more
06-19-2012
09:43 AM
|
0
|
0
|
3923
|
|
POST
|
Can you try copying one feature class manually? Rigth-click on your data in the SDE database and select Copy... Then, right-click on the local file geodatabase (outside of any SDE) and paste it. Does it work?
... View more
06-19-2012
08:37 AM
|
0
|
0
|
3389
|
|
POST
|
Here is my code: import arcpy
try:
mxd = arcpy.mapping.MapDocument(r"C:\temp\mymap.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
newlayer1 = arcpy.mapping.Layer(r"C:\data\redlands.gdb\rdls_street")
print newlayer1
arcpy.mapping.AddLayer(df, newlayer1, "TOP")
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
# save the map to persist the added layer
mxd.save()
del mxd, df, newlayer1
print 'Done'
except Exception as ex:
print ex.args[0]
Which version of ArcGIS (service pack) you are using?
... View more
06-19-2012
08:22 AM
|
0
|
0
|
3923
|
|
POST
|
I created a script with your code and it is working. What is the data type of "state_GA"? If you want to persist the added new layer (after you get over the exception) to the map, use mxd.save() before del statement. Note: don't forget to enclose your code with CODE tabs - click on the '#' button above and paste your code insde the tags.
... View more
06-18-2012
04:13 PM
|
0
|
0
|
3923
|
|
POST
|
Make two lists from the first two tables with SearchCursor. Use Python's zip function to combine two lists - item by item. Finally, iterate over the UpdateCursor and update using the values from the zipped list. Here is my sample code for your case: import arcpy
# setting workspace and then using the data name is better
s_rank_fc = r"path_to_your_data\s_rank.shp"
g_rank_fc = r"path_to_your_data\g_rank.shp"
anhic_fc = r"path_to_your_data\anhic.shp"
rows_s = arcpy.SearchCursor(s_rank_fc)
# use list comprehension to create a list of lists
# each item is a list of two values rank and description
s_rank_list = [[row_s.CLASS, row_s.CLASS_DESC] for row_s in rows_s]
rows_g = arcpy.SearchCursor(g_rank_fc)
# use list comprehension to create a list of lists
# each item is a list of two values rank and description
g_rank_list = [[row_g.CLASS, row_g.CLASS_DESC] for row_g in rows_g]
# zip two lists
s_g_list = zip(s_rank_list, g_rank_list)
# open an UpdateCursor
rows = arcpy.UpdateCursor(anhic_fc)
i = 0 # this index is used to extract values from the zipped list
for row in rows:
s_rank_desc = s_g_list[0]
s_rank = s_rank_desc[0]
s_desc = s_rank_desc[1]
g_rank_desc = s_g_list[1]
g_rank = g_rank_desc[0]
g_desc = g_rank_desc[1]
row.CLASS = s_rank + g_rank
row.CLASS_DESC = s_desc + "; " + g_desc
rows.updateRow(row)
i += 1
del row
del rows
... View more
06-15-2012
09:17 AM
|
0
|
0
|
1510
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-25-2012 08:20 AM | |
| 1 | 12-18-2019 03:56 PM | |
| 1 | 05-06-2020 01:18 PM | |
| 1 | 07-23-2021 10:33 AM | |
| 1 | 07-28-2020 09:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-25-2021
03:13 PM
|