POST
|
Hello. I have a geoprocessing service that has several fields, most of them are strings. One field in particular is the streamcode, which can be up to 35 characters (numbers as characters). When I run the script in ArcCatalog, it works, even with a long value in the streamcode field. Then I publish it. When I run the same job with the same parameters from the rest service GPServer, it does not work. The problem is the streamcode field can only have 19 characters. I have not found any way to specify the number of characters and I find it weird that this one field can't handle anything more than 19. Any ideas? Dorothy
... View more
09-24-2015
12:10 PM
|
0
|
0
|
2493
|
POST
|
I have found a work around with using arcpy script. If you put the simplify polygon into ModelBuilder, then export as a script, you get an incorrect script: # Process: Simplify Polygon arcpy.SimplifyPolygon_cartography(plss_section, plss_section_simplify, "POINT_REMOVE", "", "10 SquareFeet", "NO_CHECK", "KEEP_COLLAPSED_POINTS") What works is: arcpy.SimplifyPolygon_cartography(plss_section, plss_section_simplify, "POINT_REMOVE", 10, 50, "NO_CHECK", "KEEP_COLLAPSED_POINTS") If you use the tool, it is setting the tolerance to null, not 0 or some other number. Too bad this tool isn't working, but if you need to get on with your day, try using arcpy.
... View more
08-20-2015
08:33 AM
|
1
|
1
|
891
|
POST
|
I have use the Image Analysis tool in ArcMap to create an NDVI image. Looks great - but this is a temporary file. I would like to export it with the colormap in place. I've done this in 10.1 and it worked as expected: * User Renderer * use Colormap *format .tiff Save. When I do this in 10.2, I do not get the same result. It no longer has the colormap, It's a gray scale. I cannot seem to get the colormap to stick (so you can look at the NDVI image in Catalog without having to do anything special). Am I missing a setting somewhere? Thank you. Dorothy
... View more
04-30-2015
09:04 AM
|
0
|
2
|
3762
|
POST
|
Hello. We have a hydro dataset that is routed. To get some route information, in ArcMap, there is a tool called "Identify Route Locations". When you click on a stream, it will give you the measures for that stream. Is there anything like this for a Rest Service? I want to be able to do the same thing but in a web application. The application will be written in JavaScript. Dorothy
... View more
12-26-2014
07:34 AM
|
1
|
2
|
3434
|
POST
|
That may help me with another issue I have. But I still don't understand why it locks the file.
... View more
10-15-2014
01:14 PM
|
0
|
2
|
2142
|
POST
|
Hello. I have a geoprocessing service that kicks off a python script. In that python script: make a map take the map as a png file and insert it into a sql table Python script works fine on the server. Python script works fine as a custom ArcTool. So I create a geoprocessing service. It fails. I have stripped the code down to just the insert. It appears I can insert into the sql table as long as I do not include the map. but if I do, it does not work in the geoprocessing service. I thought it might be a pathname issue, so I tried putting the png in the same directory as the script. Here is the code: ============================================================================= import pypyodbc rec_creation_userid = '1234' wl_id = 99 mime_type = 'image/png' map_file_name = '99.png' # tried with pathname - does NOT work in gp service well_location_map = 'C:\\pathname\\maps\\99.png' # tried with null- does work in gp service well_location_map= "" # tried with no pathname - does NOT work in gp service well_location_map = '99.png' parameters = rec_creation_userid, wl_id, mime_type, map_file_name, well_location_map cnxn = None; cnxn = pypyodbc.connect('DRIVER={SQL Server Native Client 10.0};SERVER=myserver\\AAAA;DATABASE=database;UID=username;PWD=password') cursor = cnxn.cursor() #==== uses a stored procedure for the insert======= sp = "set nocount on ; " sp = sp + "DECLARE @return_value int; " sp = sp + "DECLARE @new_serial_id int; " sp = sp + "DECLARE @return_msg varchar(250); " sp = sp + "exec @return_value = dbo.wrd_wl_pend_map_attachment_insert @new_serial_id OUTPUT, \ @return_msg OUTPUT, \ @current_userid = ?, \ @wl_id = ?, \ @mime_type = ?, \ @map_file_name = ? , \ @map_attachment = ? " sp = sp + "select @return_value as return_value, @new_serial_id as new_serial_id, @return_msg as return_msg ; " cursor.execute(sp, parameters) row = cursor.fetchone() if (row[0] > 0): logfile.write("There was an error: " + str(row[0]) + "\n\n") print row cursor.close() cnxn.commit() cnxn.close()
... View more
10-15-2014
11:01 AM
|
0
|
0
|
1427
|
POST
|
I have used the pypyodbc for one project and it seems to be ok. Next project - script works fine as a python script. Works fine as a custom ArcTool pointing to the script. Turn it into a geoprocessing service and it fails at the cursor.execute line.
... View more
10-15-2014
08:28 AM
|
0
|
0
|
1169
|
POST
|
See above. In the cleanup section, I ended up deleting the temp point to get rid of the locked files. But in other cases, I may not want to do that.
... View more
10-15-2014
07:42 AM
|
0
|
4
|
2142
|
POST
|
Here is the code: def make_map(wl_id, well_label_text, well_label_nbr, well_label_lat_dd , well_label_long_dd , x_coord , y_coord, trsqq_key , address_of_well , submitted_by , location_source 😞 # ----------- IMPORTS ---------------------------------------------------------- import datetime, sys, arcpy, os, shutil, time # ------------------------------------------------------------------------------------ #=================================================================== # PATHNAMES AND OTHER VARIABLES #=================================================================== blah, blah #=================================================================== # CREATE POINT #=================================================================== spatialRef = arcpy.Describe(dataset).spatialReference if arcpy.Exists(temp_well_point): arcpy.Delete_management(temp_well_point) print "Old version of well point was deleted." ptx = float(x_coord) pty = float(y_coord) well_point = arcpy.Point(ptx, pty) pointGeometry = arcpy.PointGeometry(well_point, spatialRef) logfile.write("\n... Geometry of point is created...\n") arcpy.CopyFeatures_management(pointGeometry, temp_well_point) arcpy.AddField_management(temp_well_point, "MAP_LABEL", "TEXT", "", "", 20) map_label = "\"" + well_label_nbr + "\"" arcpy.CalculateField_management(temp_well_point, "MAP_LABEL", map_label, "PYTHON") #=================================================================== # CREATE MAP #=================================================================== # Process: Delete pre-existing png... if os.path.exists(well_location_map): os.remove(well_location_map) # .... Change the extent to the selected area ... df = arcpy.mapping.ListDataFrames(well_mxd,"Layers") [0] newExtent = df.extent newExtent.XMin, newExtent.YMin = xmin, ymin newExtent.XMax, newExtent.YMax = xmax, ymax df.panToExtent(newExtent) #... Add the Layer and Change the Cartography ..... wellLayer = arcpy.mapping.Layer(well_layer) wellLayer.replaceDataSource(workspace_temp, "SHAPEFILE_WORKSPACE", wl_id) arcpy.mapping.AddLayer(df, wellLayer, "TOP") wellLayer.showLabels = True # change the text of the map for elm in arcpy.mapping.ListLayoutElements(well_mxd, "TEXT_ELEMENT"): if elm.text == "latitude_text": elm.text = lat_line if elm.text == "longitude_text": elm.text = long_line if elm.text == "trsqq_text": elm.text = trsqq_line if elm.text == "well_label": elm.text = well_label_line if elm.text == "address_of_well_text": elm.text = address_of_well_line if elm.text == "source_text": elm.text = location_source # ... refresh the map ..... arcpy.RefreshActiveView() arcpy.mapping.ExportToPNG(well_mxd, well_location_map) #=================================================================== # CLEANUP #=================================================================== # ended up deleting the temp point to get rid of the locked files. # in other applications, I may not want to do this. #--------------------------------------------------------------------------------------------------------------------- if arcpy.Exists(temp_well_point): arcpy.Delete_management(temp_well_point) del well_mxd del arcpy
... View more
10-15-2014
07:41 AM
|
0
|
0
|
2142
|
POST
|
Did you ever find a solution to this? I am running into something similar. Works fine in ArcTools, create the GP Service, go to the web service and it creates a locked file. I had thought that del mxd (name of the mxd used) del arcpy would work, but it doesn't.
... View more
10-14-2014
03:02 PM
|
0
|
1
|
2142
|
POST
|
Hello. I am running a geoprocessing script from JavaScript. The script s a python script and does several things, some are not gis related. If I run into an error, I'd like to send the error message back to the user - or even send a message if it was successful. My question is, in ArcCatalog, Toolbox - tool properties -> Parameters. I have set a parameter of "result" as a string, Type = Derived, Direction = Output. What do I do to make the resulting message come back to this service? I have made a very simple python script as an example. def helloworld(a, b): z = "Hello " + a + " and " + b print "Inside: " + z return z import mod_hello z = mod_hello.helloworld("Tom", "Carol Ann") print "outside: " + z result = z How do I get the geoprocessing service to see "Hello Tom and Carol Ann" ? Thank you.
... View more
10-13-2014
09:18 AM
|
0
|
0
|
1238
|
POST
|
Thanks for the tip on the pypyodbc. Who would have guessed the pyodbc wouldn't work even for a simple select statement.
... View more
08-22-2014
10:08 AM
|
0
|
1
|
1169
|
POST
|
Yeah! Nice one, and a nice way to top of the end of the week.
... View more
07-18-2014
11:18 AM
|
1
|
0
|
4058
|
POST
|
I'm afraid I'm still a little thick. I get what both of you are saying, I'm just not quite sure how to specify the workspace and file. I'm fine with the pdf staying in the scratchworkspace. I'd also be ok if it was in memory. Please help me with the following: arcpy.env.scratchWorkspace = '%scratchworkspace%' (is this in quotes?) mxd = "C:\\mystuff\\ArcMap\\well_map_template.mxd" fn = arcpy.env.scratchWorkspace + "well_map.pdf" (this is the line I'm most confused on how to write) arcpy.mapping.ExportToPDF(mxd, fn, resolution=self.dpi,image_compression="JPEG",jpeg_compression_quality=90)
... View more
07-17-2014
11:09 AM
|
0
|
3
|
4058
|
Title | Kudos | Posted |
---|---|---|
1 | 07-16-2014 02:08 PM | |
1 | 08-20-2015 08:33 AM | |
1 | 12-26-2014 07:34 AM | |
1 | 07-18-2014 11:18 AM | |
1 | 07-10-2014 10:46 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|