Quantcast
Channel: Forums - Geoprocessing
Viewing all 1751 articles
Browse latest View live

Extract Multi Values to Points: correct values in GUI, incorrect values with Python

$
0
0
Hello,

I just ran into a strange problem, which surely has a logical explanation and an easy workaround, but I just can't seem to find it.

Let's assume I have a raster "raster1.tif" (Pixel type: unsigned integer, Pixel depth: 8 bit, 6 bands) and a point shapefile "points.shp". Both layers have the same projection.

I now want to extract point values of raster1 at locations specified by "points". I can do this in the GUI with the Extract Multi Values to Point-Tool and the result is as expected. For example, band 1 of "raster1.tif" has values in a range between 60 and 100, and points.shp has a column called "b1_raster1" with a range of 70-90.

However, I need to do this in Python. I write the corresponding code and execute it. No errors are given. However, when I check the values in points.shp, the column "b1_raster1" has values in a range between 9-12.

Here's the python code:

Code:


in_shp = "points.shp"
in_raster = "raster1.tif"
ExtractMultiValuesToPoints(in_shp, in_raster, "NONE")

I'd be grateful for any input. :)

Reclassification Error

$
0
0
i get a GRID error when i9 try to reclassify. How do i resolve this problem?

Model will not run in background

$
0
0
Made a behemoth of a model, I ensured background geoprocessing was enabled in ArcCatalog, and that the model was also set to be allowed to run in the background. Also, all of the tools that the model calls had their properties set to background processing, and all of the layers were set to be parameters (as stipulated at http://resources.arcgis.com/en/help/...00000021000000).

Alas, it would not run in the background. I then did some testing. First, I ran the ‘OD Cost Matrix Layer’ tool from ArcCatalog’s toolbox and it ran in the background. Cool. I then made a test model using the same tool-

Attachment 27184

Not cool. The model ran in the foreground. Any idea why this would be?

One other thing that is curious is that the option to toggle between running in the foreground or background is greyed out / disabled for all of the ArcToolbox tools (although the 'Always run in the foreground' option is unchecked for all of the tools that I have been using). Not sure whether this is normal or not?

Attachment 27185

Regards

Paul
Attached Thumbnails
Click image for larger version

Name:	model.jpg‎
Views:	N/A
Size:	11.5 KB
ID:	27184   Click image for larger version

Name:	tool properties.jpg‎
Views:	N/A
Size:	30.4 KB
ID:	27185  

Conversion from Point to Raster

$
0
0
Hello,
I am new to ArcMap and I would really appreciate some help. I want to create a new raster using a value in a column of a point shapefile.
I had a 8bands raster image and used the 'raster to point' tool to extract all points from the raster, in this way I obtained a point shapefile with a number of points equal to the number of pixels in the raster and with the points placed in the center of each pixel.
I extracted the values from the 8band raster and run (with other software) some analysis on each point (= each pixel) and joined it to the point table in a new column.
Now I want to create a raster with the same resolution of the original 8band raster but using as value the new column in the table. How can I do that?

I tried running 'Point to raster' but it's not doing what I am looking for.
Thank you for your help!
Attached Thumbnails
Click image for larger version

Name:	conversionTo Raster.png‎
Views:	N/A
Size:	24.2 KB
ID:	27186  

Why would the Add Value button be grayed out for a tool parameter?

$
0
0
Any guesses as to why the "Add Value" button would be grayed out for a parameter so that you could not enter a parameter, but it is a required parameter so you have to have it to run the tool? (It is just a string).


Update: There appears to be a bug where it cannot handle entry of multivalue strings. If you turn off multivalue, you can enter a value, but then it does not work because it is supposed to be multivalue so it can populate a Python dictionary object.

At 10.0, one did not have to run the tool from the Desktop, only browse to it to create a geoprocessing service from it and it worked fine. Now one apparently has to run all of their server based tools from the Desktop just to be able to create a Geoprocessing Service from them as far as I can tell.

'Turn Table To Turn feature class' Toolbox

$
0
0
Hi

I will convert a Turn.dbf file with 'Turn Table To Turn feature class' Toolbox so I can make me one way online. But I get a warning:

Edge features are not connected. Turn OID = 8
Edge features are not connected. Turn OID = 8 "C: \ DOCUME ~ 1 \ Tae \ LOCAL ~ 1 \ Temp \ turn4.fid" contains the full list of turns not comfortable to be imported.

Does anyone know what this comes from?

Regards

Tom Anders Engebakken

Mobile Tools - ERROR 000584 Implementation of this Tool's Validate is invalid

$
0
0
I'm currently having issues using either of the Mobile geoprocessing tools (Create Mobile Map and Synchronize Mobile Map) on one particular server. The tools work fine for other users on this server and for me on other servers.

If I user the Create Mobile Map tool, as soon as I select the mxd to use, the following error is displayed:

ERROR 000584
Implementation of this Tool's Validate is invalid.


Similarly, as soon as I open the Syncronize Mobile Cache tool the same error is displayed.

I have tried clearing out my local and roaming profile (eg. users\<username>\appdata\roaming\ESRI) and this makes no difference. I've also tried removing and re-adding the mobile toolbox tools. I am an admin on the server and have full control on the directory structure where the mxds, caches etc are stored.

Anyone have any idea as to why it's not working or what might cause this error message?

Regards

John

Field Info data type in Custom geoprocessing tool

$
0
0
For custom geo processing tool, I want to use Field Info data type. I need only 2 columns as it is there in Geocode Addresses tool. Some one please let me know how to customize the field info UI.

Model to calculate various fields for each feature class in a gdb

$
0
0
Hello all:

I need to know how to:
Using model builder to automate,
Joining two feature class tables (Add join)
calculate fields (4 fields)
for each feature class in a gdb

The model works fine for a layer that is present in arcmap. It does not work on other feature classes because the field name keeps hardcoded and does not change with each feature class.

add join --> fc table , fc join table.
then calculate previously added fields based on the joined table.
remove join.
Problem: field names keep "hardcoded" pointing to the original feature class name and field names.

I need to automate this process for many feature classes in a gdb.

Your help will be appreciated

Iván Santiago
San Juan, PR

Iterate Files and GPX to Features

$
0
0
I am trying to use Iterate Files. Those files are GPX files. I would like to iterate through the GPX files, passing each one to the GPX to Features script. The GPX To Features script is not accepting input from Iterate Files. Am I missing something here?

Thanks for any help,
Paul Lohr

Error in Automating Legacy Conversion

$
0
0
Hello,

I recently had to convert a series of MXDs to legacy 9.2. The script attached works, however, only the static data were successfully exported, that is to say the non-data components of the MXDs. The data and symbolization w

Thanks for any insight.
Attached Files

Cannot declare field 'Name' at "Field Mappings" parameter

$
0
0
I have a model that uses the 'Add Locations' tool (among others). I have "Field Mappings" set as a parameter and I want users to be able to declare the name of the field at the 'Name' property in the "Field Mappings" box.

Here is an example model-

Attachment 27219

And here is the model dialogue when it is opened-

Attachment 27220

For some reason, the "Field Mappings" box is not being populated with any options, and the 'Use Network Location Fields instead of Geometry' option is greyed out.

What am I doing wrong? Or alternatively, is there a way to pass a string variable to the "Field Mappings" 'Name' property?

Thanks

Paul
Attached Thumbnails
Click image for larger version

Name:	model.jpg‎
Views:	N/A
Size:	43.9 KB
ID:	27219   Click image for larger version

Name:	field mappings.jpg‎
Views:	N/A
Size:	38.8 KB
ID:	27220  

Model stopping with empty outputs

$
0
0
Hi,

I'm running a very large model, and the very beginning of this process involves creating numerous point files from line files (for an eventual series of veiwsheds.

To create these point files, I'm using the "create random points" tool, and using a field in the line file to get an average point spacing distance of 10m. There are 3 line files I am using, producing 3 point files.

Sometimes, there's only 2 such line files. This is a problem for model builder as it cannot ignore the fact there's empty output and continue to do the others. I have a feeling I need to create an if-else script, but I really don't know where to start and I can't seem to find an answer online.

Can anybody help with this? I've added a much simplified example to show the beginning process. So say there's no roads (or paths), I would like it to go through to the next regardless of whether one appears to have an empty output.
Attachment 27228
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG‎
Views:	N/A
Size:	49.9 KB
ID:	27228  

Cell Values to NoData

$
0
0
Hi all,

I'm trying to use the SetNull function in Raster Calculator with no results so far:

I have Raster1 and Raster2. Boths Rasters share some pixel cells locations. For those cells that have the same location in Raster1 andRaster2 I need to set those cells to No Data in Raster1.

I've tried with SetNull(Raster1, Raster2, Raster1) but it doesn't do the job.

Any help would be greatly appreciated.

Many thanks

Toni

merge certain layers within multiple feature datasets in a geodatabase

$
0
0
I have a geodatabase with multiple feature datasets inside. Each of these feature datasets contains multiple layers of different geometry types. I would like to create a comprehensive file of each of these geometry types.

In order to do this i would normally just open the merge tool and pick out all the ones i want.

Well in this case there are over 100 so i was thinking this would be a lot easier if there was a script that could crawl through the geodatabase, pull out the certain geometry type from each feature dataset and merge them all together. And what would be even better would be if it added a field to the final file with the layer name of each merged file so that i'd know which was which.

Anyone have something like that lying around? or is this something easy to create?

I have little to know python experience so any help would be appreciated.

thank you.

Create Query Layer Tool Output Object Not Found or Recognized

$
0
0
ArcGIS 10.1 SP1. ArcSDE 10.1, SQL Server 2008 R2

I have been trying to use the Make Query Layer Tool to create a table view from SDE tables (_VM) in SQL Server 2008 R2 and save the table by a number of export methods with limited success. I have been unsuccessful in saving the information through either the tools, modelbuilder, python window or arcpy (external python). Only manual export is working.

The tool "make query layer" ran from within ArcMap will create the proper table from the SDE/SQL Server 2008R2 query and tables, however, it is not possible to export this Table_View layer using export Table to Table or CopyRows or Table to Geodatabase as shown in the help literature. The ONLY method to export the information has been in the Table of Contents (TOC), through export from the table.


Delving a little deeper I tried to get a little infomration on this object and it appears to contain part of the SQL/SDE connection string as part of it's object as several tools have indicated a .name of "SEKI_HazardTrees.DBO.%HazTree" when the original given name is HazTree only (SEKI_HazardTrees is the name of the SQL/SDE database). I also receive this name when I run arcpy.describe on the object and return a path of the sde connection string.

desc.name = SEKI_HazardTrees.DBO.%HazTree
desc.dataType = TableView
desc.nameString = HazTree
desc.path = Z:\Projects\HazardTrees\inpsekigistest_HazardTrees.sde ( the path of the SQL database)


The error received is very general and similar between failing tools:

Failed to convert SEKI_HazardTrees.DBO.%HazTree. ERROR 999999: Error executing function.
Failed to execute (CopyRows).

or

Cannot open HazTree (the Table View - in arcpy)

I have tried to override the tool from including the SEKI_HazardTrees to it's name by setting up the scratch and normal workspaces to no avail.

IF you have a working python .py example of this (not from the ESRI site that does not work) please post. I have tried all the versions posted by ESRI.

Thanks
Kevin






I'm including my code here for what its worth, but since the stand-alone tools couldn't work I wouldn't expect the arcpy gp tools to work any better (although sometimes they do).



python code
Code:

#Import system modules
import arcpy

arcpy.env.overwriteOutput = True

# Set data path also tried removing the r and change / to //
workspace = r"Z:/Projects/HazardTrees/Results.gdb"
intable = r"Z:/Projects/HazardTrees/Results.gdb/Veg_HazardTreeSurvey_tbl"

inpsekigistest_HazardTrees_sde = r"Z:/Projects/HazardTrees/inpsekigistest_HazardTrees.sde"

arcpy.env.workspace = workspace
arcpy.env.scratch = workspace

# Create the Query Layer and return the Table-View name for verification
test = arcpy.MakeQueryLayer_management(inpsekigistest_HazardTrees_sde, "HazTree", "SELECT * from SEKI_HazardTrees.dbo.Veg_HazardTreeSurvey_tbl_VW", "OBJECTID", "", "", "").getOutput(0)
# Get the properties of the Query Layer if possible
objMQ = arcpy.Describe(test)
print objMQ.name
print objMQ.dataType
print objMQ.nameString
print objMQ.path
print test

# Get column count - note that if the MakequeryLayer function fails, then an empty table with only the schema will be produced.
# However, we have tested this and copied the SQL query and parameters from ArcMap tools for which we were successful generating the Table View so this should be ok

#print int(arcpy.GetCount_management(test).getOutput(0))  # doesn't work
#print int(arcpy.GetCount_management("HazTree").getOutput(0)) # doesn't work

#arcpy.CopyRows_management(test, r"Z:/Projects/HazardTrees/hz002.dbf")  # doesn't work Error 99999
#arcpy.CopyRows_management(test, "Z://Projects//HazardTrees//hz002.dbf")  # doesn't work Error 99999

ModelBuilder with precondition in batch mode fail

$
0
0
I have a model that recalculates and applies a new spatial index to a feature class which came from the discussion Batch recalculate spatial index. One issue I had with it is that it would fail if the feature class didn't have any features. When running a batch, this would suck as it would come across an empty feature class then stop. So I added a precondition to use Get Count to check that the number of rows wasn't 0. Works great on a single class. If it's empty, it indicates that the precondition fails and skips the spatial index stuff instead of throwing an error.

Now, run this in batch mode with two feature classes, one with features and one without. If the one without features is first, then the precondition fails on both and nothing happens. If the one with features is first, then the precondition passes and both run which causes it to error on the empty class. You would think that running in batch means run the model X amount of times with the different input values. But it would appear there is something that crosses between inputs that causes a precondition result from one input to be applied to all input.

Attached is a test toolbox with the model in it. Has anybody else noticed this issue? Is there some option or setting that is missing that would allow this to work? In the end, I created a python script that does the same thing and that works in batch mode just fine. Ran into some issues with python as well, but that's a discussion for another day.
Attached Files

arcpy.getparameter type returned for multivalue changed in 10.1?

$
0
0
Can anyone confirm whether the variable type returned for multivalue parameters by arcpy.getparameter() changed in 10.1?

I run the same tool with the same parameters in ArcGIS 10.0 and 10.1 and the 10.0 version returns a Arcpy ValueTable object, but 10.1 is returning a list object (which breaks the tool).

According to the 10.1 documentation here: http://resources.arcgis.com/en/help/...00000013000000
AND the 10.0 documentation here: http://help.arcgis.com/en/arcgisdesk...00000013000000
both should be able to return either a string, a Python list, or a ValueTable, but why would the exact same script return a different type of object if run in 10.1?

The line doing it is simply elemSet = arcpy.GetParameter(9)
On the next line if I do type(elemSet) I get different object types as noted above. Anybody know any way to force 10.1 to return a ValueTable?

Thanks!!!!

How to resolve encoding errors in python geoprocessing?

$
0
0
I have a simple python script that reads a string from a text file and inserts it into an Oracle database.

When I run the script with Eclipse using Pydev plugin I get no error and the message is inserted into database.

However, when I run the script using an ArcGIS geoprocessing service (using a toolbox), I get the following error in the logs, and no insertion is performed into database:

Code:

[06/09/2013-10:30:39.380] ERROR - APPLICATION <module>(<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u"INSERT INTO APPLI.ALERT (ID_ALERT,MESSAGE,TYPE_ALERT) values(1617.0,q'[Les coordonn\xe9es ne sont pas correctes\n]',3)", 94, 95, 'ordinal not in range(128)'))
The code is the following:

Code:

try:
    msg=open("myFile.log", 'r')
    a=msg.read(20)
    strInsert = "INSERT INTO  APPLI.ALERT(ID_ALERT,MESSAGE,TYPE_ALERT) values(1625.0,'"+a.replace('\"','').decode('utf-8')+"',3)"
    logger_module.debug(str(strInsert))
    SdeExecuteSQL(CONNEXION_FILE,strInsert )
except:
    python_error_handler()

When I open myFile.log with Notepad++ the encoding is ANSI as UTF-8.

Do you have any hint?

Regards.

How to georeference multiple images in ArcGIS 10.1

$
0
0
I have scanned about 200 aerial photographies and want to georeference these to fit the area they are covering. I'm using the Imagery basemap, because this is the only free georeferenced map I have found of the area.

This basemap is a very big file, covering the whole world. For my project i only need a small part of Greenland. Does anyone know if it is possible to crop this map to only cover my area of interest?

Second question, when i georeference one picture and rectify this it is saved so that I can close and open it again. But when i try to put another picture in the same file and georeference the second picture, the first one snapps back to original position.

Is it possible to georefernece several pictures in the same file, to make them fit together?

Hope to get a quick answer!

Stine M.
Viewing all 1751 articles
Browse latest View live