Rasters, cell size and projections

3356
12
10-04-2015 12:28 AM
LlorençCastell_Fabregues
New Contributor

Hello everybody,

I have two questions about rasters:

1- I created a raster doing some operation with rasters using python. I used a raster of 200 x 200 meters of cell size. Once I got the final raster, when I chech its properties the cell size is 1x1. What does it mean?? Is the final raster 1x1 m o 200x200 m??

2- When I am doing the python code I define a raster projection (In this case ED 50 Zone 31) but when I load to arcgis It is not the same with other layers with this projection. I am trying to project the spatial reference, but it does not work... Any help???

Thank you for your attention!

0 Kudos
12 Replies
DanPatterson_Retired
MVP Emeritus

what were the operations?

was the data in the correct coordinate system first?  just defining it won't make it so.

0 Kudos
LlorençCastell_Fabregues
New Contributor

The operations were the sum of the differences among one pixl and the 8 neighbors.

Tthe data was in the same coordinate system.

What do you think?

Thanks!

0 Kudos
XanderBakker
Esri Esteemed Contributor

I think some additional information would be welcome.

Can your provide more details about your the environment settings: Using environment settings in Python—Help | ArcGIS for Desktop . Also the place were you are running your code (stand alone or in the Python Window of ArcGIS is important. If you run your code in the Python Window inside ArcMap (or ArcGIS Pro), and you don't set any geoprocessing environment settings in your code, the geoprocessing environment settings from your ArcMap session will be taken.

The coordinate system of the input rasters has no effect over the output pixel size.

There are some operations that will result in a raster with a different cell size (like Resample—Help | ArcGIS for Desktop  and Aggregate—Help | ArcGIS for Desktop ), but by default the Raster Analysis Cell Size setting is "Maximum of Inputs" (which means that it will take the largest cell size of all inputs and use that size for the output). 

0 Kudos
ChrisDonohue__GISP
MVP Alum

Dan has some valid points.  To help troubleshoot this, can you provide some more detail on what you did?  You can upload screenshots if that is easiest.  You can also post your code, which would be of great help in troubleshooting.  To keep it formatted correctly, see this post:

Posting Code blocks in the new GeoNet

Chris Donohue, GISP

0 Kudos
LlorençCastell_Fabregues
New Contributor

Hello,

that is the code comented yesterday. Any help!?

Thank you so much!screenshot.png

0 Kudos
XanderBakker
Esri Esteemed Contributor

It would be more helpful if you would follow the suggestion by Chris Donohue on Posting Code blocks in the new GeoNet .

You don't seem to use any ArcGIS (arcpy) components. Is there any particular reason why you post your questions at GeoNet?

0 Kudos
LlorençCastell_Fabregues
New Contributor

I don't use ARCGIS components because I don't know them, I am starting with python. I use python to get a raster to work in arcgis. For this Iam writting here.

0 Kudos
LlorençCastell_Fabregues
New Contributor

Do you Know any raster function to uses in python?

thanks!

0 Kudos
DanPatterson_Retired
MVP Emeritus

You should learn...unless you want to replicate a whole world of moving and block window functions on your own.  Your kernel window and its python implementation will take forever on a moderate sized raster, so unless you are using very small arrays for demonstration-educational purposes, you might want to investigate

  • using the functions implemented in ArcGIS
  • using numpy and/or scipy functions and not coding in pure python.
  • using tools in an open source GIS (which you appear to have access to)

0 Kudos