POST
|
I'm trying to run Con on a specific band of a multiband geotif. It works fine when I use arcpy.gp.Con_sa but it does nothing when I use arcpy.sa.Con. And when I say nothing I mean no errors, no results, nothing i.e. it's a NoOp. Anyway here's my code: import arcpy from arcpy.sa import * # set my workspace to a multiband tif. arcpy.env.workspace = "D:/lf_composite.tif" # now run arcpy.gp.Con_sa on one band (DEM) of the tif arcpy.gp.Con_sa("DEM", "400", "d:/test1.tif", "1") # Now I have test1.tif with all pixel values of 400 - as expected. # Now run arcpy.sa.Con on same band. new_raster = Con("DEM", 400, 1) print type(new_raster) # Also tried this new_raster = Con(arcpy.Raster("DEM"), 400, 1) print type(new_raster) # Con runs with no errors but type of new_raster doesn't print i.e. it doesn't have a type. # I expect it to be <type 'Raster'> How can I make arcpy.sa.Con work with a mutiband tif? I want to use arcpy.sa.Con because I'll be stringing together muliple cons in sequence and don't want to have to deal with intermediate files that arcpy.gp.Con_sa produces. Thanks for you help.
... View more
10-29-2020
01:00 PM
|
0
|
0
|
660
|
POST
|
Hello, I'm trying to upload a zip file using php and cURL library using Upload Item : but the file doesn't get uploaded. I'm able to upload a file using that site using a web browser but no-go with php. What am I doing wrong? Thanks for your help. Here's my code: $LCPRequest = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/uploads/upload"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $LCPRequest); curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $cfile = curl_file_create('D:\Services\shapefiles\shapefiles.zip','application/zip','shapefiles.zip'); $requestParameters = array('file'=>$cfile, 'f'=>'pjson', 'description'=>'sample'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestParameters)); $output = curl_exec($ch); print_r(curl_getinfo($ch)); curl_close($ch); echo $output . "\r\n"; And here's my output: Array ( [url] => https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/uploads/upload [content_type] => text/plain;charset=UTF-8 [http_code] => 200 [header_size] => 616 [request_size] => 436 [filetime] => -1 [ssl_verify_result] => 20 [redirect_count] => 0 [total_time] => 0.266 [namelookup_time] => 0.125 [connect_time] => 0.157 [pretransfer_time] => 0.219 [size_upload] => 166 [size_download] => 99 [speed_download] => 372 [speed_upload] => 624 [download_content_length] => 99 [upload_content_length] => 166 [starttransfer_time] => 0.266 [redirect_time] => 0 [redirect_url] => [primary_ip] => 52.4.149.135 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => xxxxxxxxx [local_port] => 50416 ) { "error": { "code": 500, "message": "Error performing upload operation", "details": [] } }
... View more
10-23-2020
07:59 AM
|
0
|
1
|
466
|
POST
|
Hello, I have a folder full of dbf files that contain thematic information. I would like to create Attribute Table Function templates (rft.xml files) for each of these dbfs so they they can applied to mosaic datasets that I will be creating later on. I know of the Raster Function Template Tool in ArcMap to do this but that is a very tedious process when I have 50+ dbfs to walk through. Does anybody know of an Arcpy(thonic) way to create Attribute Table Function templates for all these dbfs? Thank you.
... View more
11-15-2017
12:15 PM
|
0
|
0
|
459
|
POST
|
I see there's a property called listCustomCRS for adding a custom projection to a WMS service. Is there a similar property for adding a custom projection to a WCS service? I tried addiing the listCustomCRS property to my WCS service but no luck. I would like to be able to perform a GetCoverage operation with a custom projection. How would I do that? Thank you.
... View more
04-05-2017
07:06 PM
|
0
|
0
|
527
|
POST
|
I can't find serverScan.py in (<installation location>\arcgis\server\tools\admin) in either my 10.4 or 10.4.1 installation. Any ideas where I can get this tool?
... View more
07-07-2016
08:22 AM
|
0
|
1
|
1745
|
POST
|
I figured it out. Remove Login and "Get Token" links by editing Server\framework\runtime\tomcat\webapps\arcgis#rest\www\app\common\header.jsp in your ArcGIS install.
... View more
06-05-2015
06:36 AM
|
1
|
0
|
483
|
POST
|
Hello, How do I remove the Login and "Get Token" links on my ArcGIS REST Services web pages? I'm running ArcGIS Server version 10.22. Thank you.
... View more
06-04-2015
06:43 AM
|
0
|
1
|
4213
|
POST
|
I'm using RepairMosaicDatasetPaths_management to change my mosaic datasets to use a new sde database. Here's my code: fullname = r"D:\services_mosaicdatasets\md.gdb\US_130EVC_1" paths = r"D:\is_server_config\arcims_edclfs2d.cr.usgs.gov.sde D:\is_server_config\SDWCLUA_ARCIMS.sde" query = "#" arcpy.RepairMosaicDatasetPaths_management(fullname, paths, query) After running the code I can see the new path in my mosaic dataset by exporting the paths however the mosaic dataset is still accessing the old sde database. I know this because the data isn't in the old sde db anymore and the mosaic dataset displays a checkerboard. I've verified that the data does exist in the new database. What am I doing wrong? Why won't my mosaic dataset use the new sde connection? Should I be using some other arcpy utility to change the source path? I'm using ArcGIS 10.2.1 on Windows 2008 R2. Thank you in advance for your help.
... View more
05-27-2015
10:32 AM
|
0
|
0
|
2569
|
POST
|
I have a file geodatabase comprised of many Mosaic Datasets. The Mosaic Datasets, in turn, are comprised of Oracle SDE rasters. We have a mandate to change the Orace SDE password for the user that I'm using for my Mosaic Datasets. Of course, doing so will immediately break my Mosaic Datasets and they will produce the checkerboard map. So I found the RepairMosaicDatasetPaths_management tool and thought that would solve my problems. But it doesn't seem to be working. Here's my code: arcpy.RepairMosaicDatasetPaths_management("D:/services_mosaicdatasets/md.gdb/US_test","* D:\\is_server_config\\new_rasxtrct_edclfs2d.cr.usgs.gov.sde","#") After I run that command and then open that Mosaic Dataset in Catalog I can see the path has changed to the new path but Preview still shows a checkerboard. It's as if it's not reading the credentials from the new .sde file. I've verified the .sde file works by opening it in Catalog. I've also tried Modify->Repair option for the selected Mosaic Dataset and also Repair Mosaic Dataset Paths tool in ArcToolbox. They both produce the same result as the RepairMosaicDatasetPaths_management command - path changes but credentials aren't read. I'm running Arc 10.2.1 on Windows 2003 Service Pack 2. What am I doing wrong? Why aren't the credentials getting read from the new .sde file? Is there a way to force the Mosaic Dataset to read the credentials from the new .sde file? Thank you.
... View more
09-20-2014
09:06 AM
|
0
|
0
|
2181
|
POST
|
So according to this document (http://resources.arcgis.com/en/help/main/10.2/index.html#/Filtering_features_using_the_layerDefs_parameter_in_WMS_requests/015400000604000000/) there's a layerDefs parameter that can be appended to a WMS getMap that will filter your results. Apparently this parameter only applies to MapServer services, though. Because when I try it on my ImageServer service I get an error. My url is: http://igskmncngs137.cr.usgs.gov/arcgis/services/Greenness/USGS_Greenness/ImageServer/WMSServer?request=getmap&service=WMS&version=1.3.0&styles=&crs=crs:84&format=image/png&bgcolor=0xFFFFFF&transparent=true&layers=USGS_Greenness&bbox=-96.0922942546,25.9674163260731,-76.7324944072095,45.2375171362684&width=600&height=600&layerDefs={"USGS_Greenness":"Name='GREENNESS.GREENNESS_DAV_1'"} My response is: <ServiceExceptionReport version="1.1.1"><ServiceException code="InvalidFormat"> Can't parse XML request. </ServiceException></ServiceExceptionReport> Can anybody confirm layerDefs doesn't work with ImageServer services? Or if it is supposed to work, what does a valid request look like? I've also tried defining and using an OGC dimension called "name". Then my wms call looks like this: "http://igskmncngs137.cr.usgs.gov/arcgis/services/Greenness/USGS_Greenness/ImageServer/WMSServer?request=getmap&service=WMS&version=1.3.0&styles=&crs=crs:84&format=image/png&bgcolor=0xFFFFFF&transparent=true&layers=USGS_Greenness&bbox=-96.0922942546,25.9674163260731,-76.7324944072095,45.2375171362684&width=600&height=600&dim_name=GREENNESS.GREENNESS_DAV_1" But no matter what value I put in for dim_name I always get back the same image. Any help you can provide on either parameter will be greatly appreciated. Thank you.
... View more
06-26-2014
11:36 AM
|
0
|
1
|
2232
|
POST
|
Does anybody know how to programatically update Mosaic Dataset attributes such as MaxPS using python? I've tried code such as this: ##################### cursor = arcpy.da.UpdateCursor(fullname, "MaxPS") for row in cursor: print row.getValue("MaxPS") ##################### but no luck. It says field does not exist. Thanks.
... View more
05-08-2014
05:02 AM
|
0
|
1
|
905
|
POST
|
Ok, so I have a Mosaic Dataset that has an Attribute Table Function added to it (the attribute table is a dbf that contains Category names along with Red, Green, Blue values). I exported the function as a template (rft.xml) file with the intention of using it when programmatically creating other Mosaic Datasets and using it in the arcpy.EditRasterFunction_management call. I thought it'd be as simple as changing the dbf file name within the template to the correct dbf before making the arcpy.EditRasterFunction_management call. Turns out it's not that simple. The dbf file name is nowhere to be found in the template. Instead I see this: <Value xsi:type='typens:XMLPersistedObject'> <Bytes>sT14Bu7l0RGwogAA+HgIIAAAAAABACgAAAB0AGUAcwB0AEwAQQBOAEQARgBJAFIARQAuADEAMgAw AEUAVgBIAAAAAgAAAAAAGAAAAGQAQgBBAFMARQAgAFQAYQBiAGwAZQAAABEANVpx49ERqoIAwE+j OhUBAAAAAQA8AAAARAA6AFwAaQBzAF8AcwBlAHIAdgBlAHIAXwBjAG8AbgBmAGkAZwBcAGUAeABw AG8AcgB0AFwATQBEAAAAAgAAAAAAHgAAAFMAaABhAHAAZQBmAGkAbABlACAARABhAHQAYQAAABFa jlib0NERqnwAwE+jOhUCAAAAAQABAAAAEgAAAEQAQQBUAEEAQgBBAFMARQAAAAgAPAAAAEQAOgBc AGkAcwBfAHMAZQByAHYAZQByAF8AYwBvAG4AZgBpAGcAXABlAHgAcABvAHIAdABcAE0ARAAAAAGW 22qgXNnREaqBAMBPozoVAAAAAA== </Bytes> </Value> I've determined that the above value does contain the dbf file name and that it's a serialized file object of some type. I don't know how to get from a file name such as "D:\dbfs\test.dbf" to that XMLPersistedObject data above, though. Would somebody provide me some C# code or Python code for doing that? On a side note I exported the template for the Colormap Function and it stores the clr file name as a regular old text string like this: <Value xsi:type='xs:string'>D:\services_mosaicdatasets\dbfs\Image.clr</Value> Which is what I expected of the Attribute Table Function template. Anyway, I appreciate any help you might provide. Thank you.
... View more
04-21-2014
08:45 AM
|
0
|
0
|
679
|
POST
|
I am trying to programmatically add a DBF file containing themes/color values to a Mosaic Dataset using arcpy.EditRasterFunction_management. It runs without errors but it's not working because after I run my script I don't see any color in my mosaic dataset nor do I see Attribute Table Function in the Function Chain of the Mosaic Dataset Properties. Here's my stand-alone script: import arcpy arcpy.env.workspace = "D:/is_server_config/export/MD/toddo.gdb" mdname = "HI_120EVC" editmode = "EDIT_MOSAIC_DATASET" editmethod = "INSERT" funcfile = "D:/services_mxds/publish_image_service/attr_table_function.rft.xml" funcname = "Attribute Table Function" arcpy.EditRasterFunction_management(mdname, editmode, editmethod, funcfile, funcname) Here's my attr_table_function.rft.xml template which I exported from the Raster Function Template Editor. The only thing I modified in the template was the red section which points to my DBF file. <XmlRasterFunctionTemplate xsi:type='typens:RasterFunctionTemplate' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.1'> <Name>empty_attr_table_function</Name> <Description>A raster function template.</Description> <Function xsi:type='typens:TableFunction'> <Name>Attribute Table Function</Name> <Description>Associates a raster attribute table to a given single band raster.</Description> <PixelType>S16</PixelType> </Function> <Arguments xsi:type='typens:TableFunctionArguments'> <Names xsi:type='typens:ArrayOfString'> <String>Raster</String> <String>D:\is_server_config\export\MD\HI_120EVC.dbf</String> </Names> <Values xsi:type='typens:ArrayOfAnyType'> <AnyType xsi:type='typens:RasterFunctionVariable'> <Name>Raster</Name> <Description> </Description> <Value> </Value> <IsDataset>true</IsDataset> </AnyType> <AnyType xsi:type='typens:RasterFunctionVariable'> <Name>AttributeTable_2014413_165548_590</Name> <Description> </Description> <Value xsi:nil='true'/> <IsDataset>false</IsDataset> </AnyType> </Values> </Arguments> <Help> </Help> </XmlRasterFunctionTemplate> I know there is nothing wrong with the DBF because I'm able to manually add the DBF to my Mosaic Dataset using Properties->Functions tab ... What am I doing wrong? Thank you for your help.
... View more
04-14-2014
04:32 AM
|
0
|
0
|
353
|
POST
|
I'm using http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/project to project an esriGeometryEnvelope from GCS_WGS_1984 to USA_Contiguous_Albers_Equal_Area _Conic_USGS_version. Here's my input: {'geometryType':'esriGeometryEnvelope','geometries':[{'xmin':-127.98775264,'xmax':-118.097294455,'ymin':40.6114817258,'ymax':49.4786153647}]}&f=json&inSR=4326&outSR=102039 This is the output: {u'xmin': -2633438.20097998, u'ymin': 2170059.14546908, u'ymax': 3332882.97158141, u'xmax': -1610306.50465533} Now I use that output as input to reproject back to GCS_WGS_1984 like this: {'geometryType':'esriGeometryEnvelope','geometries':[{'xmin':-2633438.20098,'xmax':-1610306.50466,'ymin':2170059.14547,'ymax':3332882.97158}]}&f=json&inSR=102039&outSR=4326 and I get this as my result: {u'xmin': -132.098826940963, u'ymin': 38.6468804758576, u'ymax': 51.2969623956981, u'xmax': -115.447453297465} As you can see those final WGS84 coordinates are quite a bit off from my original WGS84 coordinates. Should they be off by that much? I've also tried arcpy.Project_management and get the same results. And I've also tried an intermediate projection (Sphere_Cylindrical_Equal_Area) where my sequence was 4326->53034->102039 and then back 102039->53034->4326 and still get the same results. Any ideas why this is happening? Thank you for your help. Here are the complete to/from REST calls: http://sampleserver1.arcgisonline.com//arcgis/rest/services/Geometry/GeometryServer/project?geometries={'geometryType':'esriGeometryEnvelope','geometries':[{'xmin':-127.98775264,'xmax':-118.097294455,'ymin':40.6114817258,'ymax':49.4786153647}]}&f=json&inSR=4326&outSR=102039 http://sampleserver1.arcgisonline.com//arcgis/rest/services/Geometry/GeometryServer/project?geometries={'geometryType':'esriGeometryEnvelope','geometries':[{'xmin':-2633438.20098,'xmax':-1610306.50466,'ymin':2170059.14547,'ymax':3332882.97158}]}&f=json&inSR=102039&outSR=4326
... View more
02-19-2014
05:04 AM
|
0
|
0
|
1483
|
POST
|
I'm using http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/project and trying to project coordinates in an esriGeometryEnvelope. I keep getting "The specified geometry is not in the correct format" message. Here are my inputs: Input Spatial Reference: 4326 Output Spatial Reference: 102039 Geometries: geometries={"geometryType":"esriGeometryEnvelope","geometries":[{"xmin":-127.987753,"ymin":40.611482,"xmax":-118.097294,"ymax":49.478615}]} Format: HTML Would somebody help me with the correct format, please? Thank you.
... View more
02-10-2014
06:49 AM
|
0
|
1
|
3452
|
Title | Kudos | Posted |
---|---|---|
1 | 06-05-2015 06:36 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|