|
POST
|
It is usually in the units your dataframe is in. You can use the measure tool on the toolbar to check a sample distance between points in a unit of your choice to double check. Your dataframe units can be found in the bottom right corner of the map, or by checking your dataframe properties.
... View more
07-23-2014
01:32 PM
|
0
|
0
|
899
|
|
POST
|
also as far as the capitilization being off, when you run the script when you have the row[0] == row[1], change it to row[0].upper() == row[1].upper(). This will match those where there is mixed capitalization since it makes all the characters in the string uppercase, so you can't mix and match upper and lowers. Also I might do something where I check the length of !Owner!.split(" "), and if it is 1, have a print statement or write to a text file, that way you know which ones have only a single name.
... View more
07-23-2014
11:41 AM
|
2
|
0
|
1733
|
|
POST
|
Thomas, I would use [-1] for the Owner Last Name field, that way you get the last record, regardless of if there are two names on the record. Unfortunately it looks like you will need to manually fix some of your data, since like the example you showed, there are records where someone did not put in a space. These records seem pretty poor, as some people used last names, and some didn't so you will probably have to spot check alot of this unfortunately.
... View more
07-23-2014
11:23 AM
|
1
|
2
|
1733
|
|
POST
|
I've used LASTOOLs quite a bit and they can be very useful.
... View more
07-23-2014
09:50 AM
|
0
|
0
|
2153
|
|
POST
|
Python is already on your computer, since you have ArcGIS it comes with Python 2.7 (or 2.6). You can just copy and paste the code I used into any text editor and save it as a .py file extension, and your computer should be able to run it by double clicking on it. The lock file exists when you open ArcMap to prevent edits being made if the file is being accessed more than once(you have multiple maps open with that data, multipler users are using the same data, etc.). The code should work in the ArcMap python window, but might not if the map is open and the program is being run outside of ArcMap, since it is updating values, not just reading them.
... View more
07-23-2014
08:59 AM
|
0
|
9
|
4427
|
|
POST
|
Gordon, this topic got remade after the transfer to GeoNET, and was answered on this thread Would like to get rasters into a USGS .dem file. Thanks for the extra info though!
... View more
07-22-2014
03:51 PM
|
0
|
0
|
2153
|
|
POST
|
If you want to know which parcel the well point is on, why not do a spatial join first, that way you only need to iterate over 1 attribute table, after you do the spatial join. ArcGIS Help (10.2, 10.2.1, and 10.2.2) You will need to add another field to your points, so you can put "YES" it in. This way you should only need 1 search cursor, which will need the the field names for the well owner, parcel owner, and field name that will contain the "Yes". so after doing a spatial join and adding your new field it would look something like this.
import arcpy
wells = "path here"
wellowner = "Owner" #or whatever your field name is
parcelowner = "Owner1" #or whatever your field name is
with arcpy.da.UpdateCursor(wells, [wellowner, parcelowner, "Nameofyournewfieldhere"]) as cursor:
for row in cursor:
if row[0] == row[1]:
row[2] = "YES"
cursor.updateRow(row)
else:
continue
You did pretty well with your code, cursors can take a little while to get use to. A little critique of your code:
import arcpy #perfect!
wells = "path here" #good
parcels = "path here" # good
owner = ["Owner"] #no brackets needed, you want a string not a list(though it turns out okay in this case)
powner = ["Owner1"] #see above
cursor = arcpy.da.UpdateCursor(wells, ["Public"]) #correct syntax for making a cursor, kudos for using the data access cursor
wellowner = arcpy.da.SearchCursor(wells, owner) #again correct syntax
parcelowner = arcpy.da.SearchCursor(parcels, powner)#ditto
if ( wellowner == parcelowner ) : #here would be the problem, you are comparing two cursor objects and not their values
for row in cursor: #correct syntax for accessing your update cursor object
row = YES #would be row[indexvalueofyourfield] See my example
else row = cursor.next()
A good attempt for a first time, I would recommend trying some of their sample code first to get use to the syntax and outputs.
... View more
07-22-2014
01:22 PM
|
3
|
14
|
4427
|
|
POST
|
Theo, try this
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
pageNumbers = [1,2,3,4,9,10,45] #put your page numbers in brackets separated by commas
for pageNum in pageNumbers:
mxd.dataDrivenPages.currentPageID = pageNum
print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
arcpy.mapping.ExportToJPEG(mxd, r"X:\DVDs to burn\South Atlantic Margins\Arcview projects\A3 & A4 Images and Export mxd's\2014 DDP A3 Exports\Images\Free Air" + str(pageNum) + ".jpg")
del mxd
All you do is put the page numbers in the brackets separated by commas, and it should export only those page numbers, feel free to delete the ones currently in there, they are for representation only. It just takes the list of numbers and go to each of those page numbers and exports it out.
... View more
07-22-2014
10:04 AM
|
0
|
1
|
1928
|
|
POST
|
Alright, well you could just make a manual list in your python script, then have only loop through those numbers. pageNumbers = [Your page numbers here] for page in pageNumbers: ... Regardless of how you do this, it is going to take some user input, so depending on how you are picking the pages, there are different ways to do this most efficiently. The first post I had is probably the simplest way for odd pages, but if you need 1,4-9, 18-29, 33-57, then it gets a bit more complicated.
... View more
07-22-2014
08:02 AM
|
0
|
3
|
1928
|
|
POST
|
If you are only needing odd numbered pages, you could use an if/else statement and use a modulo to check if there is a remainder when the page number is divided by 2. So after mxd.dataDrivenPages.currentPageID = pageNum
if int(pageNum) % 2 == 1:
print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
arcpy.mapping.ExportToJPEG(mxd, r"X:\DVDs to burn\South Atlantic Margins\Arcview projects\A3 & A4 Images and Export mxd's\2014 DDP A3 Exports\Images\Free Air" + str(pageNum) + ".jpg")
else:
continue
if you there are more than 10 pages and you only wanted odds up to 9, you could put an and statement in that first if statement to check if they page number is less than 10 as well.
... View more
07-22-2014
07:52 AM
|
0
|
5
|
1928
|
|
POST
|
According to the tool help, they can be fields or numerical values, so it is completely acceptable to just put in an offset of 6. "It can be a field in the input observer features dataset or a numerical value. By default, a numerical field OFFSETB is used if it exists in the input observer features attribute table. You may overwrite it by specifying another numerical field or constant" What format are you putting the AGL in? Maybe try changing the file format for the output(I'm grasping at straws here).
... View more
07-21-2014
01:34 PM
|
0
|
2
|
2155
|
|
POST
|
Multiple viewpoints shouldn't matter, and your testing on a single viewpoint had the same issue, so that shouldn't be a problem. Even if all the points on your raster were visible, it should still make the AGL raster, they would all have 0 values though. Is the raster being created on the hard drive and just not adding to the display?
... View more
07-21-2014
01:15 PM
|
0
|
5
|
2155
|
|
POST
|
You can also center or right justify with string.center or string.rjust. Glad you found a solution that works, though its not entirely ideal. Maplex tends to do what it wants to make your label "fit best" so it doesn't surprise me that it remove extra spaces.
... View more
07-18-2014
03:00 PM
|
0
|
0
|
2886
|
|
POST
|
You could use string formatting to make sure that all labels have the same spacing if you are adding multiple fields to your string.
def FindLabel():
x = "cats"
y = "dogs"
a = "cat"
b = "dog"
return x.ljust(10) + y.ljust(10) + "\n" + a.ljust(10) + b
So for any length of string for x, y and a, it would add spaces after to make the entire string length 10, and be left justified. This way all your labels would have same length and be lined up. I haven't tried yours out yet, but this does add the spaces in my own sample map I made. 7.1. string — Common string operations — Python v2.7.8 documentation EDIT: Actually both using multiple spaces and using tabs makes wider spaces in my labels in ArcMAP then using a single space. "\t" looks about 4 spaces as opposed to a single " ". I'm on ArcGIS 10.2.0.3348
... View more
07-18-2014
02:36 PM
|
0
|
2
|
2886
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-22-2017 08:58 AM | |
| 1 | 10-05-2015 05:43 AM | |
| 1 | 05-08-2015 07:03 AM | |
| 1 | 10-20-2015 02:20 PM | |
| 1 | 10-05-2015 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|