Problem with Point to Raster code

3201
9
05-27-2013 02:03 PM
JulieMalingowski1
New Contributor
Hi there,

I am working with a lightning dataset in ArcGIS 10.0, trying to create a raster (actually, 100s of them), and have the GUI tool working correctly, but cannot get the code to work correctly, despite the code being exactly the same from the example code. Here is the input on the GUI I am using: [ATTACH=CONFIG]24723[/ATTACH]

I have the following code, and it does not produce the same thing, but what I can see, it should! Any thoughts? I really appreciate the help. The code runs, but I am not getting the same results. Note: I changed the directories for the forum text, so just ignore those. The problem lies elsewhere.

import arcpy
from arcpy import env
env.workspace = "//gjt-s-filesvr/users_docs$/ArcGIS/Default.gdb"
arcpy.PointToRaster_conversion("X:/GIS/Default.gdb/earlyaug1995", "MULTIPLICI",
                                "H:/ArcGIS/Default.gdb/earlyaug1995m", "COUNT", "", 10000)

Thank you!
0 Kudos
9 Replies
SteveLynch
Esri Regular Contributor
Julie

- Have you installed Service Pack 5?
- What are the differences?

Steve
0 Kudos
JulieMalingowski1
New Contributor
Hi Steve,

I am using Arc at work and found out that SP2, 3, 4, and 5 have not been installed. I'm hoping this will fix the problem, but I don't see anything about this issue mentioned in the documentation of patches. I was having a range of 1 to 100000+ come out on my raster, as if the program was counting the number of data points, instead of summing the values in the MULTIPLI column. What should have been produced, was a value range from 1 to 50 or so on the new raster. Thanks!
0 Kudos
T__WayneWhitley
Frequent Contributor
...by your last statement, you want to 'SUM' point attribute values in the cell (not 'COUNT').

Enjoy,
Wayne
0 Kudos
JulieMalingowski1
New Contributor
...by your last statement, you want to 'SUM' point attribute values in the cell (not 'COUNT').

Enjoy,
Wayne


I worded that incorrectly. I want to create a raster counting how many data points there are in each grid cell. See this screenshot:

[ATTACH=CONFIG]24915[/ATTACH]

The points are the lightning strikes, and the corresponding colors is the correct raster I'd like to get. I accomplished this by using the point to raster tool with the COUNT option. When I try to run the above code in Python, I get a range that does not make sense.
0 Kudos
T__WayneWhitley
Frequent Contributor
I see, then the next thing I would check is if the output grid size corresponds with your previous result, in other words, is the size you expect.

What is the current status of intallation of your service packs?

For example, these problems (and there are more) may or may not be related to your problem, which should have been addressed by service pack 5:

NIM068062 - The Point, Polyline, Polygon To Raster tools do not honor the environment cellsize, and when the cellsize is cleared on the dialog, the default value is not filled out.

NIM060777 - Point, Polyline, Polygon, Feature To Raster tools crash when output is a fGDB raster.
0 Kudos
JulieMalingowski1
New Contributor
I see, then the next thing I would check is if the output grid size corresponds with your previous result, in other words, is the size you expect.

What is the current status of intallation of your service packs?

For example, these problems (and there are more) may or may not be related to your problem, which should have been addressed by service pack 5:

NIM068062 - The Point, Polyline, Polygon To Raster tools do not honor the environment cellsize, and when the cellsize is cleared on the dialog, the default value is not filled out.

NIM060777 - Point, Polyline, Polygon, Feature To Raster tools crash when output is a fGDB raster.


Interesting. Here is my wacky result.. and cell size is (0, 0) through python code instead of (10000,10000) when running the GUI. I hope you are right and it is a SP problem. I just found out this evening that only SP1 is installed.. so we are missing 2,3,4, and 5. I can't do anything about it until the techs come in tomorrow. Thanks for your help! I'll let you know if it solves the problem. Fingers crossed.

[ATTACH=CONFIG]24916[/ATTACH]
0 Kudos
T__WayneWhitley
Frequent Contributor
Also, guess your tech guys know this, that the SPs should be cumulative, meaning if you install SP5 that should get you current.  Hope that works...

BTW, your spatial reference is right?...it usually helps to check everything - you know the saying, that what you're looking for can be the last place you search.  (A corollary to Murphy's law?)

Good Luck,
Wayne
0 Kudos
JulieMalingowski1
New Contributor
Also, guess your tech guys know this, that the SPs should be cumulative, meaning if you install SP5 that should get you current.  Hope that works...

BTW, your spatial reference is right?...it usually helps to check everything - you know the saying, that what you're looking for can be the last place you search.  (A corollary to Murphy's law?)

Good Luck,
Wayne


Wayne - I'm glad you mentioned the SP5 thing - the techs likely don't know that since they are not GIS guys but rather network upkeepers for everything including any software on our machines.

The spatial reference is right when I run the GUI but not with the code. Is there something I need to add into the code for that?

Thanks.
0 Kudos
T__WayneWhitley
Frequent Contributor
Interesting...then (until you can get service pack 5 installed) try making sure the coord sys is defined on your input point layer.
Or you can try setting the environment variable in the gp process you're running in (the ArcMap session if you're launching the tool in-process from within an open map doc).

Or, try 'manually' setting the output coord system as given in the scripting example here:

Output Coordinate System (Environment setting)
Resource Center » Professional Library » Geoprocessing » Geoprocessing environment settings » Output coordinates
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001w00000005000000


I would try those options...
Wayne
0 Kudos