|
POST
|
Depending on how dedicated the person attempting to get to your source code, there really is no foolproof way. Any system or password can be cracked given the time, resources, and willingness to do it. http://stackoverflow.com/questions/261638/how-do-i-protect-python-code Using a .pyc and maybe include a licensing agreement should be sufficient for most cases.
... View more
03-13-2013
02:12 PM
|
0
|
0
|
1949
|
|
POST
|
Yes it's your order, switch the last two [field[urLatIndex],field[urLonIndex]],[field[lrLatIndex],field[lrLonIndex]] to [field[lrLatIndex],field[lrLonIndex], [field[urLatIndex],field[urLonIndex]]]
... View more
03-12-2013
12:34 PM
|
0
|
0
|
2422
|
|
POST
|
This may be one way, just came up with it and it is pretty untested, though gives more or less right results for me. lock_list = [item.split('.')[0] for item in os.listdir(your_gdb) if item.endswith('.lock') and not item.startswith('_gdb')]
... View more
03-12-2013
10:06 AM
|
0
|
0
|
3366
|
|
POST
|
If you are just creating a polygon from your coordinates out of your CSV there is no need to create point objects to then create a polygon from, you can add them to an array and input them all at once skipping the need for the minimum bounding geometry tool completely. Unless there is some other reason you are going this route. http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000061000000
... View more
03-12-2013
09:39 AM
|
0
|
0
|
2422
|
|
POST
|
The second statement should release the locks automatically, but there appears to be a bug with this- NIM089529: The data access arcpy cursors do not release locks when using with statement. Otherwise, an easy thing to do to see if it is working is to just watch your workspace in Windows Explorer and see if you see either a shared or exclusive lock file is being applied. They should be pretty easy to spot and will show up as a data type of LOCK. Oh yeah look at that. Never noticed that issue before. Deleting the cursor object gets rid of it though. Edit: I can't seem to be able to find the NIM entry on the support page though. Is it new?
... View more
03-12-2013
08:32 AM
|
0
|
0
|
3366
|
|
POST
|
The '__enter__' and '__exit__' methods were added to the da cursors to help with locking issues. They are most easily and explicitly accessed via the with statement which is the preferred method of opening and closing da cursors. That being said, your code should be releasing the locks immediately after it runs, assuming there were no other errors.
... View more
03-12-2013
08:17 AM
|
0
|
0
|
3366
|
|
POST
|
Something like this should work for you. import os
file = r'C:\GeoSpatialTraining\ArcGIS10\GISProgramming101\Exercises\Data\Local data\LotPlan_List.txt'
f_count = open(file, "r")
#Count records number
numRec = len(f_count.readlines())
print("There are {0} records in the file.".format(numRec))
f = open(file, "r")
field = 'LOT_PLAN'
lots_list = []
for rec in f:
rec = rec.rstrip('\n')
lots_list.append(rec)
sQuery = '''"{0}" in ('{1}')'''.format(field, "', '".join(lots_list))
f.close()
print(sQuery)
... View more
03-12-2013
05:18 AM
|
0
|
0
|
3704
|
|
POST
|
If think you may be conflating your Oracle cursors and arcpy cursors. Any access to a DB could trigger a cursor to fetch the data. It would be helpful to post your code even though it may not be directly in error. Also, adding fields in your DB changes the schema. This is generally not recommended practice to do on the fly, especially if it requires subsequent processing dependant on those created fields. You mentioned you were running 10.0. What SP are you on? Have you tested to see if this behaviour occurs in 10.1? Is this a new error that occurs in previously working scripts or has it always occurred? Have you contacted your DBA to see if any tuning needs to be done or if the Oracle logs show any more info?
... View more
03-11-2013
12:33 PM
|
0
|
0
|
1153
|
|
POST
|
Check your field names held by your Fields list variable again. Print out rows.fields to make sure.
... View more
03-11-2013
12:18 PM
|
0
|
0
|
1391
|
|
POST
|
Ah sorry I misunderstood, I thought you had a list of feature classes with various t* fields. Could you provide a sample schema of what you are working with? Based on what you've posted this might get you going, but it is hard to code without knowing your fields you are working with.
field_list = ['t75c', 'SHAPE@AREA', 'MD_NLC_Area']
t_list = [t for t in field_list if t.startswith('t')]
with arcpy.da.UpdateCursor(fc, field_list) as cursor:
for row in cursor:
for index, field in enumerate(t_list):
row[index] = (row[index]*(row[-2]/row[-1]*100))/100
cursor.updateRow(row)
... View more
03-07-2013
01:31 PM
|
0
|
0
|
1735
|
|
POST
|
You can just get a field list and add it to your base field list you want for every calculation. You can give something like this a try.
base_list = ["Shape_Area","MD_NLC_Area"]
f_list = [f.name for f in arcpy.ListFields(fc, 't*', 'DOUBLE')]
final_list = f_list + base_list
cursor = arcpy.da.UpdateCursor(fc, final_list) Or if you just want to take the first 't*' field you can do this.
t_field = arcpy.ListFields(fc, 't*', 'DOUBLE')[0].name
... View more
03-07-2013
12:56 PM
|
0
|
0
|
1735
|
|
POST
|
I'd use Feature Class to Feature Class. Feature Class to Shapefile is more for bulk loading.
... View more
03-07-2013
11:51 AM
|
0
|
0
|
572
|
|
POST
|
See the code sample at the bottom of this help page. http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000061000000
... View more
03-07-2013
04:19 AM
|
0
|
0
|
1434
|
|
POST
|
The properties are all listed in the help which you linked to in a previous post. It is pretty simple to tell the difference. A property of row requires a parameter. row.getValue(field) Whereas a field referenced by the row object does not. row.field If for some reason you happen to have a row with the same name as a property, such as getValue, the property will take precedence. Your example of length doesn't work since it is a property of the geometry object not the row. It is accessed like this. row.shape.length
... View more
03-07-2013
04:11 AM
|
0
|
0
|
2365
|
|
POST
|
Thanks for the pointer, but I cannot find any reference to .shape on the page you linked. There is no property of the Geometry class called 'shape'. So, as far as I can see, my original question stands: where is .shape documented? Why does the following work, when the Row class doesn't even have a property called 'shape'? And why is there no object model diagram? It's so difficult to see how classes interact when you have to hop from one help entry to the other. We need a diagram to see how they fit together! >>> cur = arcpy.SearchCursor("Landscan_Sample")
>>> for row in cur:
... print row.shape.extent.XMax
...
-10.8041666667
-10.7958333333
-10.7875 It accesses the shape field, which is a geometry object. You could get the same with geom = row.getValue('Shape')
... View more
03-06-2013
07:19 AM
|
0
|
0
|
2365
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|