|
POST
|
Upon further investigation, i.e., looking at the link you sent, that code if for point and I am trying to get the xy coordinates for polygon centroids. Bob Noyes GIS Analyst Josephine County 541-474-5244 GIS Webpage<http://www.co.josephine.or.us/SectionIndex.asp?SectionID=129> [email protected]<mailto:[email protected]> “A road map always tells you everything, except how to refold it<http://thinkexist.com/quotation/a_road_map_always_tells_you_everything_except_how/156219.html>” unknown
... View more
04-19-2018
02:30 PM
|
0
|
0
|
18478
|
|
POST
|
Thanks for the feedback. Sounds like I need to revert back to coping from a shapefile first then doing the other processes. I mentioned above that using the arcpy.da.updateCurser I got an error but I am wondering if that is due to my working with a shapefile. Bob Noyes GIS Analyst Josephine County 541-474-5244 GIS Webpage<http://www.co.josephine.or.us/SectionIndex.asp?SectionID=129> [email protected]<mailto:[email protected]> “A road map always tells you everything, except how to refold it<http://thinkexist.com/quotation/a_road_map_always_tells_you_everything_except_how/156219.html>” unknown
... View more
04-19-2018
11:14 AM
|
0
|
0
|
18478
|
|
POST
|
I will check out your suggestions. I did try initially copying the shapefile to a feature class but the lat long function took over a half hour to calculate and I would get the error for acquiring a lock. When trying the arcpy.da.UpdateCursor<https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Farcmap%2F10.3%2Fanalyze%2Farcpy-data-access%2Fupdatecursor-class.htm> I got a sql error. Perhaps that was because I was working with a shapefile at that point? Anyway, thanks for the link to posting code and the suggestions. Bob Noyes GIS Analyst Josephine County 541-474-5244 GIS Webpage<http://www.co.josephine.or.us/SectionIndex.asp?SectionID=129> [email protected]<mailto:[email protected]> “A road map always tells you everything, except how to refold it<http://thinkexist.com/quotation/a_road_map_always_tells_you_everything_except_how/156219.html>” unknown
... View more
04-19-2018
11:08 AM
|
0
|
0
|
18478
|
|
POST
|
I tried doing the script with a single variable for the whole script and had the same problem and thought that if I recalled the file at each stage it might get rid of the lock. Sounds like I can revert back to that. I am not sure how to eliminate multiple uses of the shapefile in the loop. Suggestions? Bob Noyes GIS Analyst Josephine County 541-474-5244 GIS Webpage<http://www.co.josephine.or.us/SectionIndex.asp?SectionID=129> [email protected]<mailto:[email protected]> “A road map always tells you everything, except how to refold it<http://thinkexist.com/quotation/a_road_map_always_tells_you_everything_except_how/156219.html>” unknown
... View more
04-19-2018
11:02 AM
|
0
|
0
|
18478
|
|
POST
|
So, I have created a script that adds 6 fields to a shapefile: Situs_city, Situs_St, Situs_Zip, Latitude, Longitude, and GIS_Acres. Further, the script is set to calculate the values for the Latitude, Longitude, and GIS_Acres fields. The script will work fine until after creating the GIS_acres field. Once this field is created the next step is to calculate and that is when I get an Error 999999: cannot acquire a lock. The weird aspect is once in a while the script will run all the way through just fine... anyway, I am stumped. I am pretty new to creating python scripts. If anyone has a suggestion that would be awesome. import arcpy import os # Step 1 - Copy new [Taxlots_TEST_DeleteME.shp] from \\cove\Department Shares\Common\Assessor\ArcGIS to E:\STAGING (IKRIT) #set variables in_data = "S:\Common\Assessor\ArcGIS\Taxlots_TEST_DeleteME.shp" Shapefile = "E:\\STAGING\\Taxlots_TEST_DeleteME.shp" #out_data = "E:\STAGING\Taxlots_TEST_DeleteME.shp" arcpy.Copy_management(in_data, Shapefile) print "Step 1 complete" #Step 2: Add Situs fields # Create a new field - Situs_City (string, 25) arcpy.AddField_management(Shapefile, "Situs_City", "TEXT", "","","25","","NULLABLE","NON_REQUIRED","") print "Step 2a: Add Situs_City complete." # Create a new field - Situs_St (string, 2) arcpy.AddField_management(Shapefile, "Situs_St", "TEXT", "#", "#", "2", "#", "NULLABLE", "NON_REQUIRED", "#") print "Step 2b: Add Situs_St complete." # Create a new field - Situs_Zip (string, 10) arcpy.AddField_management(Shapefile, "Situs_Zip", "TEXT", "#", "#", "10", "#", "NULLABLE", "NON_REQUIRED", "#") print "Step 2c: Add Situs_Zip complete." print "Step 2: Create situs fields complete." # Step 3: Create and calculate Latitude and Longitude fields. latLonRef = "Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj" Taxlot_shp = "E:\STAGING\Taxlots_TEST_DeleteME.shp" featureClassesList = Taxlot_shp.split(";") field_Type = "DOUBLE" field_precision_1 = 12 field_scale_1 = 8 for featureClass in featureClassesList: arcpy.AddMessage("Calculating XY coordinates for: " + featureClass) arcpy.AddField_management(featureClass, "Latitude", field_Type, field_precision_1, field_scale_1) arcpy.AddField_management(featureClass, "Longitude", field_Type, field_precision_1, field_scale_1) rows = arcpy.UpdateCursor(featureClass, "", latLonRef) for row in rows: feat = row.getValue("shape") cent = feat.centroid # To get the polygon area: cent = feat.area row.Latitude = cent.Y row.Longitude = cent.X rows.updateRow(row) #arcpy.AddMessage(str(lat) + ", " + str(lon)) print "Step 3: Add Lat and Long complete" # Step 4: Create a new field - GIS_Acres (Double, 15, 3) Shapefile3 = "E:\STAGING\Taxlots_TEST_DeleteME.shp" #Set local variables field_Name = "GIS_Acres" field_Type = "DOUBLE" field_Precision = 15 #total number of digits stored field_Scale = 4 #number of decimals places arcpy.AddField_management(Shapefile3, field_Name, field_Type, field_Precision, field_Scale) arcpy.CalculateField_management(Shapefile3, field_Name, '!SHAPE.area@ACRES!', "PYTHON_9.3") print "Step 4: Calculate acres complete" print "Congratulations! You have completed adding fields to to the Taxlots feature class. "
... View more
04-19-2018
10:36 AM
|
0
|
16
|
28757
|
|
POST
|
This works for what I wanted except it locks up ArcMap 10.2.2 when I run it. When I check the attribute table the columns are created and populated. Any ideas why this would "freeze up" ArcMap and not continue the other request in the script? Any suggestions would be appreciated! Addendum: Okay, I wasn't patient enough. It takes almost 30 minutes for the lat long function to run. It will then complete the python script. Not sure why it takes so long. I am wondering if it has something to do with it being in a Sql GDB? After testing the lat long it looks like they are in the GDB projection (state plane) not WGS84, which is what I wanted. I am going to try Plan B and set up a staging file to add the fields and calculations in a shapefile then copy to the GDB.
... View more
04-17-2018
08:57 AM
|
0
|
0
|
4336
|
|
POST
|
Thanks for the response. I am not sure what you mean by zipper grid but dual zone would probably be correct. They would like to have a usable UTM grid on the 44'' x 62" map. It spans 2 UTM zones so, depicting this in a way that makes it easy to calculate coordinates is problematic.Your Coordinate system Zones... link seems promising.
... View more
11-15-2016
01:50 PM
|
0
|
0
|
4084
|
|
POST
|
I am building a wall map for our SAR team and the regional SAR group which includes 9 counties in southern Oregon and Northern California. They would like to have a UTM grid on it and while it is primarily in UTM T 10 the eastern portion is in UTM T 11. This creates issues with grid angles and at this point I haven’t found a projection that works with 2 different utm zones on the same map. Any ideas suggestions or ideas? What am I missing? ?
... View more
11-15-2016
12:49 PM
|
0
|
3
|
6450
|
|
POST
|
...but, I think I see where you are going with this. I will play with the spatial join, haven't really needed to use that in the past.
... View more
10-31-2016
01:34 PM
|
0
|
0
|
2518
|
|
POST
|
Generally I use select by location when working with two different layers. But, that is usually for small numbers of items. In this case it is for 382 or so features so I was hoping to automate it..... Anyway, I can't say I have a preferred method as I am always open to new methods of doing something.
... View more
10-31-2016
01:28 PM
|
0
|
0
|
2518
|
|
POST
|
Here is the problem I am hoping to get assistance with. I have a large area of points (covers 9 counties) for which I have created a grid polygon that has 382 boxes . I would like to write a python script or create a model that will select each box of the grid and then using that selected box do a "selection by location" of the point feature class finding the point with the high value in a column in the attribute table. The highest value would get a 1 in a field called "grid_ht". The code or model would work sequentially through each box of the grid and finding the highest valued point in that location. What I am trying to do is find and mark the highest point (elevation) within each part of the grid. It would need to be able ignore boxes that do not have any point features with their boundaries. Anyone have suggestions? So: - Select Grid ID #1 - Select by location - Summit points - find highest point in that box and put a 1 in it's Grid_Ht column - select Grid ID #2 - Select by location - Summit points - find highest point in that box and put a 1 in it's Grid_Ht column - Select Grid ID #3 and so on.
... View more
10-31-2016
12:33 PM
|
0
|
3
|
3237
|
|
POST
|
Did you ever complete your tips document for custom printing? If so, I would love to get a copy. Currently we are experiencing a large percent of our print request getting the "Error, try again" message. It also won't print if there is a tool opened. Very frustrating.
... View more
08-18-2016
10:36 AM
|
0
|
0
|
2282
|
|
POST
|
I took your original idea and made some adjustments. So far it seems to be working. Thanks for responding!
... View more
05-16-2016
03:02 PM
|
0
|
0
|
1493
|
|
POST
|
Interesting ideas, I will experiment with these, thanks!
... View more
05-04-2016
09:33 AM
|
0
|
0
|
1493
|
|
POST
|
I would like to add a feature in a script that I run monthly that will find a replace some text in the script. In other words when I run the script the first thing that happens is a popup opens which prompts for the text to find and the text to replace. When finished and the popup closed the scripts runs through completion. The text that needs to be found and replaced is a .dbf file that has a name change each month. So, 16AprRes.DBF becomes 16MayRes.DBF. In the attached script the goal is to add the find and replace popup that will cover steps 7 and 10. Anyone have suggestions? Thanks!
... View more
05-04-2016
08:51 AM
|
0
|
4
|
4274
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-21-2025 07:41 AM | |
| 2 | 04-18-2025 08:52 AM | |
| 1 | 04-18-2025 09:19 AM | |
| 2 | 02-14-2023 06:37 AM | |
| 1 | 07-09-2020 09:53 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|