POST
|
I'm running a fairly complex python script, exported from Model Builder and customized. The input feature class has about 5000 features, basically the script is loop to run the entire analysis on a single feature and then move on to the next feature. The script will run until feature 94, then I get ERROR 999999: Error executing function. General Function failure System Resources Exceeded. I've ran complex models before on large feature class, but never this large. Is there a limit to the number of geoprocessing operations Arc 9.3.1 can do at one time? Thanks
... View more
12-31-2010
04:58 AM
|
0
|
1
|
267
|
POST
|
I don't know of another way to build a dynamic model. Arc will generate 90% of the python code for you, if you export you model to python script. When I started to learn python this is the process I used, it is really not that bad to learn. Since, I've learned python is has added a lot of functionality that would normally take a GIS tech hours and hours to do. Instead, python allows me to script processes and set Arc to run over night, so Arc does not take valuable computer resources during normal office hours. Thus the process is automated and no human resources are required to run the model.
... View more
11-09-2010
09:53 AM
|
0
|
0
|
519
|
POST
|
I figured it out last night. I was trying to write the attribute in the same for loop as the feature(s) were being added to the feature classes. To fix it, I created 1 for loop to add the feature geometries and a second for loop, that ran after all the features were added to the feature class, that would write all of the attribute information.
... View more
11-07-2010
12:32 PM
|
0
|
0
|
254
|
POST
|
I have several working scripts that are updating the value of attribute tables using the row.setValue(attribute_Field, New_Value) syntax. However, with a new script I am writing I get the following error: "'NoneType' object has no attribute 'setValue'" Has anyone else run into this problem? The previous script still run on the same machine.
... View more
11-06-2010
04:46 PM
|
0
|
2
|
761
|
POST
|
The easiest way is to run this model from python script. This way you can get the X and Y coordinates and feed them directly into the Rotate Raster Tool.
... View more
11-05-2010
03:35 PM
|
0
|
0
|
519
|
POST
|
public void GetThicknessData(IRasterLayer rAlamoSurface, IFeatureLayer fThicknessProfile)
{
try
{
IFeature fProfile = fThicknessProfile.FeatureClass.GetFeature(11);
IPointCollection pPointCollection = null;
IPolyline pPolyLine = null;
IGeometry pGeom = null;
Double dCellSize = 30;
IRasterSurface pRasterSurface = null;
pRasterSurface.RasterBand = rasterBand;
ISurface pSurface = pRasterSurface as ISurface;
pPolyLine = fProfile.Shape as IPolyline;
pPointCollection = pPolyLine as IPointCollection;
pGeom = pPointCollection as IGeometry;
IPoint tmpPt = null;
IPoint tmpPt2 = null;
IPoint stepPoint = null;
int ArrayCtr, loopCount, ptCtr, sgCtr;
ArrayCtr = 0;
double[] XArray = new double[1000];
double[] YArray = new double[1000];
double[] ElevArray = new double[1000];
double pElev, dX, dY, segLength, runStep, riseStep, lastPointX, lastPointY, gridNoData;
gridNoData = -99999;
tmpPt = pPointCollection.get_Point(0);
XArray[ArrayCtr] = tmpPt.X;
YArray[ArrayCtr] = tmpPt.Y;
pElev = pSurface.GetElevation(tmpPt);
if (pElev != gridNoData)
{
ElevArray[ArrayCtr] = pElev;
}
for (ptCtr = 1; ptCtr <= pPointCollection.PointCount - 1; ptCtr++)
{
tmpPt.X = pPointCollection.get_Point(ptCtr - 1).X;
tmpPt.Y = pPointCollection.get_Point(ptCtr - 1).Y;
tmpPt2.X = pPointCollection.get_Point(ptCtr).X;
tmpPt2.Y = pPointCollection.get_Point(ptCtr).Y;
dX = (tmpPt2.X - tmpPt.X);
dY = (tmpPt2.Y - tmpPt.Y);
segLength = Math.Sqrt(Math.Pow(dX, 2) + Math.Pow(dY, 2));
runStep = dCellSize * (dX) / segLength;
riseStep = dCellSize * (dY) / segLength;
loopCount = (int)Math.Round((segLength * 10000) / (dCellSize * 10000));
//*10000 because the cell size is so small it causes a divide by zero error.
lastPointX = tmpPt.X;
lastPointY = tmpPt.Y;
for (sgCtr = 1; sgCtr <= loopCount; sgCtr++)
{
ArrayCtr = ArrayCtr + 1;
stepPoint.X = lastPointX + runStep;
stepPoint.Y = lastPointY + riseStep;
XArray[ArrayCtr] = stepPoint.X;
YArray[ArrayCtr] = stepPoint.Y;
pElev = pSurface.GetElevation(stepPoint);
if (pElev != gridNoData)
{
ElevArray[ArrayCtr] = pElev;
lastPointX = stepPoint.X;
lastPointY = stepPoint.Y;
}
}
if ((segLength * 10000) % (dCellSize * 10000) != 0)
{
ArrayCtr = ArrayCtr + 1;
stepPoint.X = lastPointX + runStep;
stepPoint.Y = lastPointY + riseStep;
XArray[ArrayCtr] = stepPoint.X;
YArray[ArrayCtr] = stepPoint.Y;
pElev = pSurface.GetElevation(stepPoint);
if (pElev != gridNoData)
{
ElevArray[ArrayCtr] = pElev;
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
... View more
11-05-2010
01:13 PM
|
0
|
0
|
276
|
POST
|
I see that now. However, the step that gives me an error each time is: rasterSurface.RasterBand = rasterBand; In every example of code I can find I see this same step and I get the same error each time.
... View more
11-05-2010
12:42 PM
|
0
|
0
|
391
|
POST
|
In the same code I see two ways of doing it: pSurface = GetSurfaceFromLayer(pLayer.Name; or pRasterSurface.RasterBand = pRasterBands.Item(0); In both cases I get an error. I don't see a method (GetSurfaceFromLayer) on the pSurface. The error I am getting is "Object reference not set to an instance of an object."
... View more
11-05-2010
12:04 PM
|
0
|
0
|
391
|
POST
|
I'm using ArcGIS 10. I've used the same methodology as with the code I have for VBA in ArcGIS 9.3. Based on the link I've tired: pRasterSurface.RasterBand = pRasterBands.Item(0); And I still get an error.
... View more
11-05-2010
10:57 AM
|
0
|
0
|
391
|
POST
|
The Developer Help does not include sample code that helps me figure out how to cast the IRasterBand to IRasterSurface. I have the code working in VBA for Arc 9.3, I'm migrating it over to Arc 10. Every resource I can finds leads me to believe that the correct syntax is: pRasterSurface.RasterBand = pRasterBand However, when I run the code nothing is passed into pRasterSurface. I get a null value.
... View more
11-04-2010
06:01 PM
|
0
|
0
|
391
|
POST
|
I'm facing the same issue. I've ended up writing my own code to extract the profile graphs from a raster. I have a version working for Arc 9.3 and I am in the process of migrating this code over to Arc10. However, I'm having an issue. When trying to get the raster from a IRasterBand data type to the IRasterSurface I get a null return. Here is the code so far: public void GetThicknessData(IRasterLayer rAlamoSurface, IFeatureLayer fThicknessProfile)
{
try
{
IFeature fProfile = fThicknessProfile.FeatureClass.GetFeature(11);
IPointCollection pPointCollection = null;
IPolyline pPolyLine = null;
IGeometry pGeom = null;
Double dCellSize = 30;
IRasterBandCollection pRasterBands = null;
pRasterBands = rAlamoSurface.Raster as IRasterBandCollection;
IRasterBand pRasterBand = pRasterBands.Item(0);
IRasterSurface pRasterSurface = null;
//I get the error here....trying to cast an IRasterBand to an IRasterSurface
//pRasterSurface.RasterBand = pRasterBand as IRasterSurface;
//I've found other VB.net references that use:
//pRasterSurface.RasterBand = pRasterBand;
//In every case I try the pRasterSurface is null.
pRasterSurface = rAlamoSurface.Raster as IRasterSurface;
... View more
11-04-2010
05:46 PM
|
0
|
0
|
227
|
POST
|
So I've figure out part of the problem. I can get the raster to a IRasterBand class, but I can't figure out the code/syntax to get the raster to a IRasterSurface class: Here is the code: IFeature fProfile = fThicknessProfile.FeatureClass.GetFeature(11);
IPointCollection pPointCollection = null;
IPolyline pPolyLine = null;
IGeometry pGeom = null;
Double dCellSize = 30;
IRasterBandCollection pRasterBands = null;
pRasterBands = rAlamoSurface.Raster as IRasterBandCollection;
IRasterBand pRasterBand = pRasterBands.Item(0);
IRasterSurface pRasterSurface = null;
//I get the error here....trying to cast an IRasterBand to an IRasterSurface
pRasterSurface.RasterBand = pRasterBand as IRasterSurface;
//I've found other VB.net references that use:
//pRasterSurface.RasterBand = pRasterBand Thanks in advance for anyone who can help me.
... View more
10-23-2010
11:40 AM
|
0
|
0
|
391
|
POST
|
I'm trying to get the elevation value from a raster along a specific line. I'm passing in the raster layer as a IRasterLayer and the feature class as IFeatureLayer. I know I have to the raster from a IRasterLayer data type to an ISurface data type. Does anyone know the way to do so? Here is the relevant code block: public void GetThicknessData(IRasterLayer rAlamoSurface, IFeatureLayer fThicknessProfile) { try { IFeature fProfile = fThicknessProfile.FeatureClass.GetFeature(11); IPointCollection pPointCollection = null; IPolyline pPolyLine = null; IGeometry pGeom = null; Double dCellSize = 30; IRasterSurface pRasterSurface = rAlamoSurface as IRasterSurface; ISurface pSurface = pRasterSurface as ISurface; pPolyLine = fProfile.Shape as IPolyline; pPointCollection = pPolyLine as IPointCollection; pGeom = pPointCollection as IGeometry; IPoint tmpPt = null; IPoint tmpPt2 = null; IPoint stepPoint = null; int ArrayCtr, loopCount, ptCtr, sgCtr; ArrayCtr = 0; double[] XArray = new double[1000]; double[] YArray = new double[1000]; double[] ElevArray = new double[1000]; double pElev, dX, dY, segLength, runStep, riseStep, lastPointX, lastPointY, gridNoData; gridNoData = -99999; tmpPt = pPointCollection.get_Point(0); XArray[ArrayCtr] = tmpPt.X; YArray[ArrayCtr] = tmpPt.Y; pElev = pSurface.GetElevation(tmpPt); if (pElev != gridNoData) { ElevArray[ArrayCtr] = pElev; } for (ptCtr = 1; ptCtr <= pPointCollection.PointCount - 1; ptCtr++) { tmpPt.X = pPointCollection.get_Point(ptCtr - 1).X; tmpPt.Y = pPointCollection.get_Point(ptCtr - 1).Y; tmpPt2.X = pPointCollection.get_Point(ptCtr).X; tmpPt2.Y = pPointCollection.get_Point(ptCtr).Y; dX = (tmpPt2.X - tmpPt.X); dY = (tmpPt2.Y - tmpPt.Y); segLength = Math.Sqrt(Math.Pow(dX, 2) + Math.Pow(dY, 2)); runStep = dCellSize * (dX) / segLength; riseStep = dCellSize * (dY) / segLength; loopCount = (int)Math.Round((segLength * 10000) / (dCellSize * 10000)); //*10000 because the cell size is so small it causes a divide by zero error. lastPointX = tmpPt.X; lastPointY = tmpPt.Y; for (sgCtr = 1; sgCtr <= loopCount; sgCtr++) { ArrayCtr = ArrayCtr + 1; stepPoint.X = lastPointX + runStep; stepPoint.Y = lastPointY + riseStep; XArray[ArrayCtr] = stepPoint.X; YArray[ArrayCtr] = stepPoint.Y; pElev = pSurface.GetElevation(stepPoint); if (pElev != gridNoData) { ElevArray[ArrayCtr] = pElev; lastPointX = stepPoint.X; lastPointY = stepPoint.Y; } } if ((segLength * 10000) % (dCellSize * 10000) != 0) { ArrayCtr = ArrayCtr + 1; stepPoint.X = lastPointX + runStep; stepPoint.Y = lastPointY + riseStep; XArray[ArrayCtr] = stepPoint.X; YArray[ArrayCtr] = stepPoint.Y; pElev = pSurface.GetElevation(stepPoint); if (pElev != gridNoData) { ElevArray[ArrayCtr] = pElev; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
... View more
10-22-2010
06:02 AM
|
0
|
17
|
2885
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|