|
POST
|
It should be possible since python(x,y) uses 2.7 and it includes numpy. I'm not sure if any other non-standard libraries are required by Arc. Since x,y is only 32-bit as far as I know you will not be able to use the new 64-bit geoprocessor which may hamper you in large operations.
... View more
11-29-2012
04:49 AM
|
0
|
0
|
953
|
|
POST
|
Using python dictionaries/lists helped a lot! Thanks to everyone for your answers. This part of the script still had to be run over night, but that is way faster than what I was doing before. Probably won't make it much faster, but this line is just ugly. logline = str(popestlist.index(line)) + ',' + str(line[0]) + ',' + str(line[1]) + ',' + str(line[2]) + ',' + str(line[3]) + ',' + str(line[4]) + ',' + str(line[5]) + ',' + str(line[6]) + ',' + str(line[7]) + ',' + str(line[8]) + ',' + str(line[9])
Assuming you are printing every item in the line list variable, I'd use this. logline = "%s," % popestlist.index(line) + ",".join(([str(item) for item in line])) Your big time sink is most likely your join field process. I'd try to convert that to search cursor/dictionary/update cursor like others have suggested.
... View more
11-28-2012
01:58 PM
|
0
|
0
|
1983
|
|
POST
|
I don't have pythonwin. I tested in IDLE and pyscripter.
... View more
11-28-2012
07:43 AM
|
0
|
0
|
2289
|
|
POST
|
Worked fine for me in Desktop 10.1 SP1 as well. May be an issue with your mxd, have you tried it on more than one? Or have you tried making a new mxd and just putting in a title, saving it then seeing if you can modify it?
... View more
11-28-2012
04:50 AM
|
0
|
0
|
2289
|
|
POST
|
Works fine for me on 10.0 SP3. What version/SP are you running?
... View more
11-28-2012
04:25 AM
|
0
|
0
|
2289
|
|
POST
|
I guess just writing it all out helped frame my problem a little better when the solution was right in front of me. Just switched a few things around. def getFieldMappings(fc_in, mapping_list): field_mappings = arcpy.FieldMappings() for in_field, out_field, out_type in mapping_list: ... field.type = out_type ... harv_list = [ ("OBJECTID", "O_OID", "Double"), (harv_field_list[0], "BLOCK_ID", "Long"), (harv_field_list[1], "START_HARV", "Date"), (harv_field_list[2], "SKID", "Date"), (harv_field_list[3], "HAUL", "Date"), (harv_field_list[4], "FINAL", "Date") ] mapped = getFieldMappings(table, harv_list)
... View more
11-27-2012
01:07 PM
|
0
|
0
|
911
|
|
POST
|
Using Arc 10.0 SP3 I am having some problems using field mapping and python. If I run the code without the field mapping parameter it executes fine, just exporting all the fields in the source table. The problem seems to be the field type is changing. Here is my code. import os
import arcpy
def getFieldMappings(fc_in, dico):
field_mappings = arcpy.FieldMappings()
for input, output in dico.iteritems():
field_map = arcpy.FieldMap()
field_map.addInputField(fc_in, input)
field = field_map.outputField
field.name = output
field_map.outputField = field
field_mappings.addFieldMap(field_map)
del field, field_map
return field_mappings
block_id_field = "BLOCKOID"
harv_field_list = [block_id_field, "STARTHARVESTDATE", "SKIDCLEARDATE", "HAULCLEARDATE", "FINALCLEARDATE"]
harv_dico = {
harv_field_list[0]: "BLOCK_ID",
harv_field_list[1]: "START_HARV",
harv_field_list[2]: "SKID",
harv_field_list[3]: "HAUL",
harv_field_list[4]: "FINAL"}
table = r"Database Connections/TFM.sde/TFM.V_TFM_HARVEST"
table_out = r"in_memory\temp_table"
if arcpy.Exists(table_out):
arcpy.Delete_management(table_out)
mapped = getFieldMappings(table, harv_dico)
arcpy.TableToTable_conversion(table, os.path.dirname(table_out), os.path.basename(table_out), "", mapped) Here is the error I get. Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "<module1>", line 39, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\conversion.py", line 1463, in TableToTable
raise e
arcgisscripting.ExecuteError: ERROR 000278: Failed on input OID -1, could not write value â??87870â?? to output field BLOCK_ID
Failed to execute (TableToTable).
Here is a dump of the mapped variable that is created. HAUL "HAULCLEARDATE" true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,HAULCLEARDATE,-1,-1;
START_HARV "STARTHARVESTDATE" true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,STARTHARVESTDATE,-1,-1;
BLOCK_ID "BLOCKOID" true true false 4 Short 0 9 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,BLOCKOID,-1,-1;
FINAL "FINALCLEARDATE" true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,FINALCLEARDATE,-1,-1;
SKID "SKIDCLEARDATE" true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,SKIDCLEARDATE,-1,-1 Using ArcMap, here is a dump of the same tool run successfully with the fields in the output as expected. BLOCKOID /\BLOCKOID/\ true true false 4 Long 0 9 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,BLOCKOID,-1,-1;
STARTHARVESTDATE /\STARTHARVESTDATE/\ true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,STARTHARVESTDATE,-1,-1;
FINALCLEARDATE /\FINALCLEARDATE/\ true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,FINALCLEARDATE,-1,-1;
HAULCLEARDATE /\HAULCLEARDATE/\ true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,HAULCLEARDATE,-1,-1;
SKIDCLEARDATE /\SKIDCLEARDATE/\ true true false 36 Date 0 0 ,First,#,Database Connections/TFM.sde/TFM.V_TFM_HARVEST,SKIDCLEARDATE,-1,-1 I highlighted what appears to be the problem. For some reason my coded field mapping function changes the field data type for BLOCKOID to short when it should be long, bombing out when it gets to a number above the limit of a short type (â??87870â??). I'm assuming a sample of a portion of the rows is taken to create the output field type instead of reading the input source field type. Has anyone observed this behaviour or know a work around? I can't seem to find a way to set the output field type which would also solve the issue.
... View more
11-27-2012
12:42 PM
|
0
|
1
|
1549
|
|
POST
|
Oh I see, I was under the impression your errors were showing up before you ran the tool. I assume in your script pdf is the variable of the path and name is the name of the pdf you want to create? Something like this should get you going. import os import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") pdf = str(arcpy.GetParameterAsText(0)) name = str(arcpy.GetParameterAsText(1)) res = int(arcpy.GetParameterAsText(2)) quality = str(arcpy.GetParameterAsText(3)) path = os.path.join(pdf, name) if os.path.exists(path): os.remove(path) arcpy.mapping.ExportToPDF(mxd, path, "Page_Layout", resolution=res, image_quality=quality)
... View more
11-22-2012
07:36 AM
|
0
|
0
|
1524
|
|
POST
|
You shouldn't be getting an error. It should just notify you that the file already exists and if you want to replace it. If you want you could just process it silently in the script by setting your parameter of your output PDF to a folder and specify the name in your script while handling if the pdf already exists. Edit: You could also just specify your parameter as input instead of output. This will allow you to take the path as a string and validate on that in your code.
... View more
11-22-2012
06:30 AM
|
0
|
0
|
1524
|
|
POST
|
The grey generally means statistics are not calculated for you to display. I'd imagine some error occurred where the overviews or pyramids were created before the statistics were completed. Try starting over. Calculate statistics and build pyramids for your source rasters. Create a new mosaic dataset and import all your source rasters. What version of ArcGIS and service pack are you using?
... View more
11-21-2012
12:31 PM
|
0
|
0
|
2224
|
|
POST
|
Can you extract the pixel values from the mosaic dataset or is it just no data? Do your statistics have the distribution you would expect? Is the uncompressed size in GB of your mosaic dataset what you would expect? What is your pixel type, depth, no data values etc?
... View more
11-21-2012
11:24 AM
|
0
|
0
|
2224
|
|
POST
|
Most admins I know use Toad for Oracle and I don't hear a lot of complaints.
... View more
11-21-2012
07:59 AM
|
0
|
0
|
854
|
|
POST
|
Can you copy and paste your code instead of using a screen shot? It is a little difficult to make out. What are the data types of your three fields? Which field and code did you add that introduced the problem?
... View more
11-21-2012
07:54 AM
|
0
|
0
|
1519
|
|
POST
|
You should be able to accomplish your end goal directly by creating a raster dataset and then using the mosaic tool to add your original rasters without having to go through a mosaic dataset. Your issue of all grey sounds like statistics are not being calculated for the overviews to display properly. Can you zoom in to pixel resolution and see if you see something different? If you have rebuilt and recalculated your statistics for your mosaic and your source data, try rebuilding your overviews.
... View more
11-21-2012
07:28 AM
|
0
|
0
|
2224
|
| 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
|